liveBook · Manning

Normalization

As explained in The Complete Obsolete Guide to Generative AI

Data normalization is the transformation of values to a comparable scale or representation so differences among variables can be meaningfully visualized or analyzed.

Normalization puts values with wildly different units onto a common scale, so one giant number does not squash every other line into visual irrelevance. It preserves each series’s relative variation while making patterns easier to compare. section 6.11

Min–max normalization maps a feature to 0–1: subtract its minimum, then divide by its range. Zero represents that feature’s minimum and one its maximum. section 6.11

Plotting server trends

Clock speed in GHz, RAM in GB, and storage in GB share little numerical common ground. An unnormalized plot makes clock-speed growth look flat beside storage; normalizing reveals growth trends across all three. The trade-off: because every line starts at 0 and ends at 1, the chart cannot show which category grew faster overall. section 6.12 section 6.13

Listing 6.2 Visualizing a time series with normalization
import pandas as pd
from matplotlib import pyplot as plt
from sklearn.preprocessing import MinMaxScaler
 
df_servers = pd.read_csv("AllServers.csv")
 
 
years = df_servers['Year'].values                               #1
scaler = MinMaxScaler()
normalized_data = scaler.fit_transform\
    (df_servers.drop(columns=['Year']))
 
 
plt.figure(figsize=(10, 6))                                     #2
 
 
for i, column_name in enumerate(df_servers.columns[1:]):
    plt.plot(years, normalized_data[:, i], label=column_name)   #3
 
 
plt.xlabel('Year')                                              #4
plt.ylabel('Normalized Values')                                 #4
plt.title('"All Servers" (Normalized) Specs Over Time')         #4
 
 
plt.legend()                                                    #5
 
 
plt.grid(True)
plt.show()                                                      #6

This Python example uses sklearn’s MinMaxScaler on every column except Year, then plots each normalized series against time. section 6.13

A normalized chart can make a useful visual comparison, not a truth machine. Check the underlying data before drawing consequential conclusions, especially when the values came from an AI system. section 6.13

How The Complete Obsolete Guide to Generative AI covers it

How deep it goes
Explains min–max scaling with its formula and demonstrates MinMaxScaler plotting, while noting the resulting comparison limit.
Examples
Uses CPU clock speed, maximum RAM, and drive capacity across years in normalized and unnormalized line charts.
What it assumes
Uses CSV data, pandas, Matplotlib, and basic Python column selection without detailing their foundations.
What you can do after
Apply it via MinMaxScaler to plot differently scaled data series and inspect their relative trends.
How it connects
Connects normalization to data visualization, time-series data, min–max scaling, and machine learning techniques.

Also explained in

Compare how 21 books explain normalization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Complete Obsolete Guide to Generative AI. The section links point to the parts of the book it draws on.