Prepare the data
Identify class labels and any subject or time groups before choosing folds.
Repeat the split. Measure the variation.
Cross-validation estimates how performance varies across training and validation partitions. The split strategy must respect class balance, repeated entities and time ordering.
Learning concept · Not a validated service
Cross-validation estimates how performance varies across training and validation partitions. The split strategy must respect class balance, repeated entities and time ordering.
A possible application for ml instructors: Give instructors a visual checker for leakage-prone student validation plans. This extension is not delivered by the supplied starter.
Identify class labels and any subject or time groups before choosing folds.
Run cross_validate with a complete preprocessing pipeline and an appropriate stratified or grouped splitter.
Report per-fold scores and their spread, then evaluate the chosen approach once on an untouched holdout.
Create a fold report that exposes row assignments and preprocessing boundaries.
The supplied starter creates 800 synthetic binary-classification rows with ten numeric features. It makes a stratified train/test split, fits a scaled RandomForestClassifier pipeline and prints a classification report.
model = Pipeline(
steps=[
("scale", StandardScaler()),
("classifier", RandomForestClassifier(
n_estimators=250, random_state=RANDOM_STATE)),
]
)
model.fit(X_train, y_train)
predictions = model.predict(X_test)
print(classification_report(y_test, predictions))The source uses one train/test split; it never runs cross-validation. Synthetic binary classification does not establish performance on the proposed application. The source report uses one split; it supplies no deployment or real-world validation.
Proposed extension: Give instructors a visual checker for leakage-prone student validation plans.
This is a potential application pathway, not a delivered product. The supplied starter does not implement this service or validate it with real users.
Networkers Home runs this topic inside its AI Engineer Course, with placement support and hands-on labs.