Add k-folds, hyperparameter tuning, and SMOTE optimisation to dropout…#108
Open
ataridan7-cpu wants to merge 5 commits into
Open
Add k-folds, hyperparameter tuning, and SMOTE optimisation to dropout…#108ataridan7-cpu wants to merge 5 commits into
ataridan7-cpu wants to merge 5 commits into
Conversation
… 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… notebook
https://claude.ai/code/session_01XVtfC29AsorZa48fT4152Z