End‑to‑end pipeline for the Kaggle Introvert vs Extrovert challenge.
Target: Personality (1 = Extrovert, 0 = Introvert).
Leaderboard (Final):
- Public: 0.973279
- Private: 0.970040
.
├── df_model_ready_top20.csv # Train-ready feature table (top-20 features + label)
├── df_test_ready_top20.csv # Test-ready feature table (top-20 features)
├── eda.ipynb # Full EDA & feature engineering
├── eda_test.ipynb # EDA & checks on test set
├── models (1).ipynb # Training (SMOTE, LR/NB/SVM/AdaBoost/XGBoost), thresholds, submissions
├── train.csv # Kaggle train (raw)
└── test.csv # Kaggle test (raw)
If you use a different structure later (e.g.,
src/), adjust commands below accordingly.
- Base rename:
Time_spent_Alone→alone,Social_event_attendance→events,Going_outside→outside,Friends_circle_size→friends,Post_frequency→posts - Ratios & interactions:
social_activity_index,extroversion_strength,social_vs_alone_ratio,alone_per_post,events_per_outside,friends_posts_interaction, etc. - Binning:
_bin4per core numeric feature - Skew fix: Yeo–Johnson on
Time_spent_Alone - Scaling: StandardScaler on numeric block
- Missing data: mode for binaries; KNNImputer (k=5) for behavior counts; MICE/IterativeImputer for
Time_spent_Alone
- Split: stratified train/valid (80/20,
random_state=42) - Imbalance: SMOTE (train only, no leakage)
- Baselines: GaussianNB, Logistic Regression (ridge tuned), SVM (RBF grid), AdaBoost (stumps/depth=2)
- XGBoost: random search (global → local), 5‑fold CV AUC, early stopping; small seed‑ensemble
- Thresholding: Youden‑J & best‑F1; report ROC‑AUC, F1, confusion matrix
- Submission: export predictions (
final_predictions_xgboost.csv,final_predictions_logreg.csv)
# 1) Environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install -U pip
pip install -r requirements.txt
# 2) Put Kaggle CSVs (if not already here)
# train.csv, test.csv at repo root
# 3) Run notebooks (recommended)
# - eda.ipynb → data checks + feature engineering ideas
# - models (1).ipynb → SMOTE + models + XGBoost + submissions
# - eda_test.ipynb → sanity checks for test
# 4) Ready-made tables (optional)
# If you already have these produced, you can skip straight to modeling:
# - df_model_ready_top20.csv
# - df_test_ready_top20.csvTip: If you convert the training cells into a script later (e.g.,
train_infer.py), add a CLI block and document it here.
- Metrics tracked: ROC‑AUC (primary), F1, Precision/Recall, Accuracy, Balanced Accuracy, MCC
- Threshold picked via Youden‑J or Best‑F1 depending on objective
- Final Kaggle: Public 0.973279, Private 0.970040
Artifacts:
final_predictions_xgboost.csvfinal_predictions_logreg.csv
- Class distribution is skewed toward Extrovert (1).
- We apply SMOTE to training only; validation remains untouched to reflect real distribution.
- Global
random_state = 42where applicable - Seed‑ensemble for XGBoost:
[7, 17, 29, 42, 73] - Minor nondeterminism can arise from BLAS/threads; best submissions are versioned in
/
See requirements.txt for the exact list:
- pandas, numpy, scikit‑learn, imbalanced‑learn, xgboost
- matplotlib, seaborn, scipy, statsmodels, joblib
MIT (see LICENSE)
- Kaggle Introvert vs Extrovert dataset & community.
- Thanks to reviewers and discussion threads that inspired additional feature ideas.