We fit a two-feature calibration model to a fixed set of observations. Both versions of the model can express exactly the same predictions. One uses raw feature units. The other divides each feature by its length.
Two Coordinate Systems
Predict which design will have the larger ratio between the steepest and shallowest loss curvatures. scale changes the units of the second feature while preserving its contribution to the labels.
import numpy as npimport matplotlib.pyplot as pltplt.style.use("../figure_style.mplstyle")rng = np.random.default_rng(7)n =200features = rng.normal(size=(n, 2))y = features @ np.array([1.0, 1.0]) + rng.normal(0, 0.2, n)scale =20.0# Change this and rerun all cells.X = features.copy()X[:, 1] *= scalecolumn_lengths = np.linalg.norm(X, axis=0)X_scaled = X / column_lengthsfor label, design in [("Raw", X), ("Scaled", X_scaled)]: H =2* design.T @ design / n eigenvalues = np.linalg.eigvalsh(H)print(f"{label} Hessian condition number: {eigenvalues[-1] / eigenvalues[0]:.2f}")
Raw Hessian condition number: 410.91
Scaled Hessian condition number: 1.29
Changing feature units changes curvature in parameter coordinates. It preserves the column space, so both models have the same least-squares prediction.
Equal Iteration Budgets
Each run starts at zero and gets 2,000 full-gradient updates. We give each coordinate system its own optimal fixed step \(2/(\lambda_{\max}+\lambda_{\min})\). Each system therefore uses its own best fixed step size. Predict whether either run can beat the exact least-squares loss.
Raw Features: step 0.002875, final MSE 0.034768
Scaled Features: step 100, final MSE 0.034768
The reference line is the smallest loss either coordinate system can reach. The scaled features let a single learning rate make progress in both directions. The raw features require a compromise.
The Predicted Contraction
The reading predicts that an error component along an eigenvector changes by \(1-\alpha\lambda\) each step. We start with an error only in the shallowest direction and compare that exact prediction with the updates.
The numerical updates agree with the predicted geometric contraction. Changing scale changes that factor while keeping the observations and attainable predictions fixed. Scaling can remove a difference in units. Nearly parallel feature columns can still leave a shallow direction.