Skip to content
DeepForgeby svx
All problems
MediumML Fundamentalsml-118

Cross-Validation Mean Score

Problem

Compute the mean cross-validation score across folds: average each fold's scores, then average the fold means (empty folds are ignored).

Empty input or only empty folds returns 0.0.

Hint

Average within folds first so each fold gets equal weight, then average across folds.

Test cases

case 1
in: [[[0.8,0.9],[1],[0.6,0.7]]]
expected: 0.8333333333333334
case 2
in: [[[1,1],[0,0]]]
expected: 0.5
case 3
in: [[[0.5],[]]]
expected: 0.5
case 4
in: [[]]
expected: 0
Starter codePython
def cv_mean_score(fold_scores):
    # Your code here
    pass

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