Risk, regularization & optimization
Does minimizing training error give you the model you actually want?
Fit a line to noisy observations. Rotate the entire two-parameter objective, follow its true gradient, and compare a numerical update with the analytic minimum.
Define the experiment
The slope w is penalized; the intercept b is not. Features and targets are dimensionless synthetic values. Seventeen training observations and 31 distinct validation observations cover [−1, 1]. The generating mean is 1.4x − 0.3; changing noise regenerates both fixtures and resets learning.
Ready · no updates yet
The objective is a surface
The fitted-line plot, gradients, and all numerical controls below still work. Use the analytic-minimum control to compare the optimum.
Drag to orbit; use the wheel or two-finger pinch to zoom. Arrow keys orbit when the scene has focus; +/− zoom. Height is linearly scaled to fit the view; the numeric readout reports the actual objective. This is the full objective for two parameters, not a neural-network slice.
Fit versus held-out observations
Validation MSE excludes the penalty. It estimates error on this fixture, not on arbitrary unseen populations. Trying many settings on it makes it a model-selection set; a final test set must remain untouched.
Derive what the scene shows
For this data, the positive-definite Hessian gives a unique global minimum. Increasing λ steepens curvature in the w direction and shrinks the slope toward zero. It changes the objective, rather than improving the optimizer’s ability to solve the same problem.
Investigate: set λ to 0 and 2. Compare training MSE, penalty, and validation MSE at each analytic optimum. Then increase η: why can updates diverge even on a convex bowl? Derive the condition η < 2/λmax(H), where H is the Hessian.
What should you conclude?
Regularization is a modeling choice; optimization is the procedure used to solve that choice. A penalty can worsen training fit while constraining sensitivity. Whether that helps new data is an empirical question about the evaluation distribution.
Deliverable: report the chosen λ, starting parameters, rate, update count, gradient norm, and validation error. Explain why one successful deterministic run is weaker evidence than repeating an experiment across seeds and datasets.