Skip to content
DeepForgeby svx
All problems
MediumML Fundamentalsml-262

Out-of-Fold Predictions

Problem

Collect out-of-fold predictions. For each fold f, fold_predictions[f] holds predictions for the samples whose fold_of_sample equals f, in ascending sample order; assemble them back in the original sample order.

Hint

Each sample's prediction comes from the model that did not train on it.

Test cases

case 1
in: [4,[0,0,1,1],[[0.1,0.2],[0.8,0.9]]]
expected: [0.1,0.2,0.8,0.9]
case 2
in: [3,[1,0,1],[[0.5],[0.7,0.9]]]
expected: [0.7,0.5,0.9]
case 3
in: [0,[],[]]
expected: []
Starter codePython
def out_of_fold_predictions(n, fold_of_sample, fold_predictions):
    # Your code here
    pass

3 test cases · run your code against them in the editor