Code Room
Code reviewHardcr-g634
Subject Ml cross validationLevel Senior–Staff~20 minCommon in ML systems interviewsIndustries Software development

Question

Review this Python cross-validation for a medical-imaging classifier.

CV AUC is 0.95 but a prospective study gets 0.70. Explain the gap.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewpython
import numpy as npfrom sklearn.model_selection import cross_val_scorefrom sklearn.svm import SVC def evaluate(X, y):    # each patient contributes ~8 image patches; X is one row per patch    clf = SVC(kernel="rbf", probability=False)    scores = cross_val_score(clf, X, y, cv=5, scoring="roc_auc")    print("CV AUC:", scores.mean())    return scores.mean()
Run or narrate your approach, then ask the coach.