WRITE · TRACE · UNDERSTAND
Project: nested group validation with auditable outer predictions
Rows have unique id, string group, finite scalar x,y.
Read lesson: Project: nested group validation with auditable outer predictions →
Your experiment
Rows have unique id, string group, finite scalar x,y. Require at least three groups and positive finite penalties. Outer leave-one-group-out evaluation must exclude that group's rows from both tuning and fitting. For each penalty, inner leave-one-group-out validation over the remaining groups computes equal-fold mean MSE; choose (MSE,penalty) minimum. Fit centered one-feature ridge with slope=sum((x-mx)*(y-my))/(sum((x-mx)**2)+alpha), unpenalized intercept. Return oof mapping, row-weighted outer mse and folds with group, alpha, fit_ids, held_ids.
Python runs in your browser. Your draft stays on this device.
What to look for
Explain inner selection versus outer evaluation, group weighting and the final refit that would follow evaluation. Audit sample identities, not only aggregate scores. Replay follows the main orchestration function; helper computations execute and are checked separately.
Watch your code work
Ready to experimentWrite a solution or load the worked answer, then choose Trace & check.
Step through arrays, variables and training curves produced by your own Python.
