Project: fit, select and evaluate without leaking the test set
Build one complete numeric regression experiment: fit preprocessing on training data, train candidate ridge models, choose a penalty using validation error and evaluate the chosen model once on the test partition. Store the preprocessing state with the selected model.
The tests change test targets and ensure selection does not move. The review should explain the split unit, baseline, metric uncertainty and how an artifact would be reproduced from data and code versions. A tiny one-feature experiment makes leakage inspectable; it is not a claim that one validation split establishes generalization for every deployment population.
train=[0.,2.]
mean=sum(train)/len(train)
scale=(sum((x-mean)**2 for x in train)/len(train))**.5 or 1
print([(x-mean)/scale for x in [1.,100.]])Review the design
A reproducible experiment retains preprocessing, model state and the selection decision. A senior review should add baselines, confidence, slice analysis, dataset lineage and a release/rollback plan rather than treating zero error on a tiny fixture as deployment proof.
Your task
Implement regression_experiment(train,validation,test,penalties), each dataset=(xs,ys) nonempty equal lengths finite. Fit train mean/population scale (constant ->1), unpenalized intercept and ridge slope minimizing SSE+penalty*w² in standardized space. Select lowest validation MSE, smaller penalty on ties. Return dict mean,scale,w,b,penalty,validation_mse,test_mse,test_predictions. Require nonempty finite nonnegative penalties. Never fit on validation/test.
The explanation opens here once every check passes.