PythiloLesson 11 of 12 · progress kept in this browser

Reject overlapping or incomplete out-of-fold predictions

A stacking model needs predictions made without fitting the first-stage estimator on the same row. Out-of-fold construction can silently leak if a row appears in two held-out sets or if training predictions fill missing positions.

This exercise validates coverage while assembling predictions supplied by fold. It cannot inspect how each estimator was trained, so the fold-training contract remains a separate responsibility. Preserve row identity explicitly and reject duplicates instead of averaging them away. A complete audit retains each fold's training and validation identities and the preprocessing state fitted on its training partition.

predictions=[None]*3
for index,value in [(2,.8),(0,.1),(1,.4)]:
    predictions[index]=value
print(predictions)
Your task

Implement assemble_oof(n,folds) where folds contain (indices,predictions). Require each index in range(n) exactly once and equal lengths per fold; return predictions in row order. Reject missing or duplicate indices.