Raw Features Have Different Scales
Measure column-wise min-to-max spans on a raw feature table to see how arbitrary measurement units dominate unscaled geometry.
The problem
Tabular datasets place columns measured in unrelated physical units side by side. Consider four homes recorded with three raw features [rooms, floor_sqft, age_years]: [2, 600, 5], [3, 900, 15], [4, 1500, 20], and [6, 2100, 45]. Every column describes the same four buildings, yet their numeric magnitudes differ by orders of magnitude.
Before rescaling anything, we need an exact column-by-column diagnostic: the range () of each feature across rows. Reducing across the wrong tensor axis mixes rooms with square feet and years, producing numbers with no physical meaning.
Work through the numbers
Scan down axis (across the four rows) for each of the three columns. In column (rooms), values [2, 3, 4, 6] have minimum and maximum , giving span rooms.
In column (floor_sqft), values [600, 900, 1500, 2100] have minimum and maximum , giving span square feet. In column (age_years), values [5, 15, 20, 45] have minimum and maximum , giving span years.
Collecting all three column ranges yields [4, 1500, 40]. Floor area spans times as many raw units as room count and times as many units as building age, purely because area was recorded in square feet rather than hundreds of square meters.
The live model
Each bar shows one feature column's raw span as unit_scale multiplies column (simulating a unit conversion on floor area). At default unit_scale , the spans are [4, 1500, 40] and column dwarfs the other two bars. Lowering unit_scale to (tens of square feet) shrinks column 's span to ([4, 150, 40]); raising unit_scale to stretches column 's span to ([4, 3000, 40]) without changing a single house.
![Horizontal bars comparing raw column spans [4, 1500, 40] where floor_sqft dominates rooms and age_years.](../assets/ml/raw-features-have-different-scales--demo.png)
let unit_scale = scene.parameter("unit_scale", 1.0, 0.1, 2.0, 0.1);
let c0 = input.select(1, 0).unsqueeze(1);
let c1 = (input.select(1, 1) * unit_scale).unsqueeze(1);
let c2 = input.select(1, 2).unsqueeze(1);
let tbl = torch.cat(torch.list().add(c0).add(c1).add(c2), 1);
let answer = tbl.amax(0) - tbl.amin(0);
out.set("column_spans", answer);
{
"column_spans": [
4,
1500,
40
]
}Watch the parameter change
Your turn
The starter program mixes unrelated units within each row, returning the four-element vector [598, 897, 1496, 2094] instead of one range per feature column. Set answer to the 1D vector of per-column spans () across rows; Check evaluates both the four-home table ([4, 1500, 40]) and unseen matrices with different row and column counts.

let row_hi = input.amax(1);
let row_lo = input.amin(1);
let answer = row_hi - row_lo;
out.set("column_spans", answer);
{
"column_spans": [
598,
897,
1496,
2094
]
}Return the 1D vector of column spans (column maximum minus column minimum across rows) for the 2D table input.
Read the result carefully
Look at what unit_scale versus demonstrates: recording floor area in tens of square feet divides its numeric span by (), recording it in doubled units doubles the span (), and the underlying homes never change. The ratio between column and column moves from to or .
Any algorithm that treats raw coordinate differences equally — Euclidean nearest neighbors, -means clustering, gradient descent with a shared learning rate, or weight penalties — will let the widest-span column dominate.
Measuring column spans is also your safety check against constant columns: a column whose span is carries zero variation across training rows and cannot be divided by without special handling.
Recap
- Raw feature columns reflect arbitrary measurement units, producing spans like
[4, 1500, 40]on the same four observations. - Column statistics always reduce along axis (across rows), never along axis (across unrelated columns of one row).
- Distance-based and regularized models require scaling because changing a feature's unit rescales its raw differences proportionally.