Skip to content

Add k-folds, hyperparameter tuning, and SMOTE optimisation to dropout…#108

Open
ataridan7-cpu wants to merge 5 commits into
anthropics:mainfrom
ataridan7-cpu:claude/enhance-ml-model-training-vVNAh
Open

Add k-folds, hyperparameter tuning, and SMOTE optimisation to dropout…#108
ataridan7-cpu wants to merge 5 commits into
anthropics:mainfrom
ataridan7-cpu:claude/enhance-ml-model-training-vVNAh

Conversation

@ataridan7-cpu

Copy link
Copy Markdown

… notebook

  • SMOTE sampling strategy is now searched (0.3–1.0) with 5-fold CV instead of fixed 0.9; applied inside ImbPipeline to prevent data leakage into test folds
  • GridSearchCV with inner 5-fold StratifiedKFold tunes all three models: KNN (n_neighbors, weights, metric), SVM (C, kernel, gamma), MLP (architecture, activation, lr, alpha) — replaces hard-coded k=95 / linear-only / tiny MLP
  • Outer 10-fold cross-validation added for unbiased generalisation estimate
  • Final summary table reports test accuracy, F1-macro, and 10-fold CV score

https://claude.ai/code/session_01XVtfC29AsorZa48fT4152Z

claude added 5 commits May 14, 2026 09:51
… notebook

- SMOTE sampling strategy is now searched (0.3–1.0) with 5-fold CV instead of
  fixed 0.9; applied inside ImbPipeline to prevent data leakage into test folds
- GridSearchCV with inner 5-fold StratifiedKFold tunes all three models:
  KNN (n_neighbors, weights, metric), SVM (C, kernel, gamma), MLP (architecture,
  activation, lr, alpha) — replaces hard-coded k=95 / linear-only / tiny MLP
- Outer 10-fold cross-validation added for unbiased generalisation estimate
- Final summary table reports test accuracy, F1-macro, and 10-fold CV score

https://claude.ai/code/session_01XVtfC29AsorZa48fT4152Z
- GridSearchCV → RandomizedSearchCV (n_iter=10) for all three models
- Inner CV: 5-fold → 3-fold; outer CV: 10-fold → 5-fold
- SMOTE search: 5 ratios × 5-fold → 3 ratios × 3-fold
- MLP max_iter: 500 → 200 (early stopping still active)
- KNN candidates: 5 k values → 3; MLP param grid reduced by one axis
Total fits: ~435 → ~120 (~3.5× faster), quality impact is minimal

https://claude.ai/code/session_01XVtfC29AsorZa48fT4152Z
- SMOTE: reverted to 5 ratios × 5-fold (unchanged from first improved version)
- KNN: reverted to GridSearchCV with full grid (5 k-values, 2 weights, 2 metrics),
  inner 5-fold, outer 10-fold (unchanged)
- SVM: RandomizedSearchCV n_iter=10, inner 3-fold, outer 5-fold
- MLP: RandomizedSearchCV n_iter=10, inner 3-fold, outer 5-fold, max_iter=200

https://claude.ai/code/session_01XVtfC29AsorZa48fT4152Z
Outer loop over scalers (mn, std) runs all three models under each
normalisation, producing 6 result entries in the summary table.

https://claude.ai/code/session_01XVtfC29AsorZa48fT4152Z
Feature selection (cell 25):
- Tests all 3-5 feature combinations from 5 candidates
  (adds Study_Hours_per_Day to the existing 4)
- Uses 5-fold CV with SVC(rbf) as proxy; prints top-10 combos
- Updates x_train/x_test to the best-scoring subset

Feature engineering (cell 26):
- Creates 4 interaction/ratio features:
  GPA×Attendance, Stress/StudyHours, Delay×Stress, GPA/StudyHours
- Compares engineered vs base features via CV
- Adopts engineered features only if they improve F1-macro

Both cells run before SMOTE/training so the whole pipeline
automatically benefits from the improved feature set.

https://claude.ai/code/session_01XVtfC29AsorZa48fT4152Z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants