5 hidden checks
Write the evaluation tools you'll use in the module project. Labels and predictions are 0/1 integer arrays; 1 is positive.
confusion(y, pred): return the tuple(tp, fp, fn, tn)as integers.precision_recall_f1(y, pred): return(precision, recall, f1). Define any 0/0 as 0.0.kfold_indices(n, k, seed): shufflenp.arange(n)withnp.random.default_rng(seed).permutation(n), split it intoknearly equal folds withnp.array_split, and return a list ofkpairs(train_idx, val_idx).
- confusion counts the four cellsnot run
- precision, recall and F1not run
- no division-by-zero when nothing is predicted positivenot run
- kfold_indices covers every index exactly once as validationnot run
- kfold_indices uses the seeded shufflenot run