This repository contains a modern data science case study and a clean learning workflow using the Titanic dataset.
- Companion Website:
https://sid0sid-ops.github.io/titanic-data-to-discovery/ - Assignment Page:
https://sid0sid-ops.github.io/titanic-data-to-discovery/#assignment - Jupyter/Colab Notebooks:
notebooks/
This academic project connects class questions to reproducible evidence. It keeps the exact professor questions, day-wise preparation, generated plots/tables/metrics, a leakage-safe baseline, and blank student reflection areas in one reviewable repository.
Day 2 covers the Python data-science workflow, Day 3 covers visual design and communication, and Day 4 covers descriptive statistics, hypothesis testing, regression, fairness, traceability, and documentation. Exact wording is preserved in docs/professor_questions.md.
| Days | Focus | Project evidence |
|---|---|---|
| 1–4 | AI/ML, Python, visualization, statistics | Questions, plots, tables, hypothesis test |
| 5–10 | Preprocessing and supervised models | Pipeline, logistic baseline, model comparison |
| 11–15 | Later workshop topics and mini project | Placeholders until class material is received |
The full 15-day schedule is in docs/class_schedule.md; preparation status is in docs/day_wise_preparation.md and reports/preparation_tracker.md.
Assignment evidence uses only local kaggle/train.csv (891 labeled rows). Kaggle, Seaborn, and OpenML Titanic variants have different schemas and must not be mixed blindly. boat and body are post-outcome leakage fields in OpenML and are explicitly excluded from model features.
Local data → schema/source check → clean categories → feature construction → stratified split → ColumnTransformer → imputation/encoding → Logistic Regression → metrics/tables/figures → GitHub Pages assets
Static evidence includes survival by gender/class, age distribution, correlation heatmap, confusion matrix, and ROC curve. Interactive evidence includes a sunburst, cleaned parallel-categories flow, grouped clear view, fare-vs-age scatter, and passenger dashboard. Statistical evidence includes descriptive measures, correlation, a documented gender survival test, and held-out classification metrics.
The project is structured into exactly three Jupyter/Colab notebooks:
- 00_Titanic_Kaggle_Main_Workflow.ipynb:
- Purpose: The main, most important notebook. Houses the complete Kaggle Titanic workflow.
- Workflow: Data loading, data audit, EDA (with static & interactive Plotly charts), feature engineering, classical ML model training, cross-validation, and submission export.
- 01_Titanic_Model_Comparison_Project.ipynb:
- Purpose: Comparative machine learning project evaluating multiple algorithms on the Kaggle dataset.
- Workflow: Uses grouped age imputation, explicit missing-cabin features, title/family engineering, fold-fitted preprocessing, five-fold CV, and an untouched holdout to compare Logistic Regression, KNN, Decision Tree, Random Forest, YDF, XGBoost, LightGBM, CatBoost, TensorFlow, and a soft-voting ensemble.
- 02_Titanic_OpenML_Reference_Workflow.ipynb:
- Purpose: A separate reference comparison workflow utilizing the larger OpenML Titanic dataset.
- Workflow: Ingestion from OpenML, separate EDA, baseline classical modeling, and validation.
The Kaggle local dataset is the default and main project dataset. It resides in the kaggle/ directory:
train.csv(891 rows): Contains labels (Survived) and is used for EDA, training, and validation.test.csv(418 rows): Contains passenger profiles with hidden labels (noSurvivedcolumn). Used only for final predictions.gender_submission.csv(418 rows): Example template submission representing a gender heuristic baseline.
- No Test Accuracy:
test.csvhas hidden labels. Do not attempt to compute accuracy ontest.csv. - Heuristic Baseline: Do not treat
gender_submission.csvas ground-truth labels. - Validation Fold: All validation accuracy, cross-validation, and diagnostic metrics must be calculated purely from splits of
train.csv.
OpenML Titanic is a separate reference workflow. The dataset commonly contains around 1,309 records with additional columns like boat, body, and home.dest.
- Zero Mixing: Never mix Kaggle and OpenML rows together.
- No Joint Training: Do not train models using a combination of both datasets.
- Fair Comparisons: Do not compare OpenML metrics directly with Kaggle validation without explaining the structure differences.
- No Kaggle Submissions: OpenML data is unified and public; it is not used to generate Kaggle submission entries.
- Google Colab Notebooks: The real analysis, interactive plotting, model training, hyperparameter grid search (GridSearchCV), TensorFlow Decision Forests modeling, and submission exports happen exclusively in the Jupyter notebooks.
- React Web Companion: The frontend website acts strictly as a polished, lightweight, static visualization showcase, chart dictionary, and Colab workflow guide. It runs no heavy library operations (like TensorFlow) and does not train models in the browser.
- Install dependencies:
pip install -r requirements.txt
- Validate Kaggle dataset files:
python scripts/validate_kaggle_dataset.py
- Generate Kaggle visualizations and model metrics:
python scripts/generate_kaggle_visuals.py
- Generate OpenML reference visualizations and metrics:
python scripts/generate_openml_reference.py
python3 scripts/generate_assignment_evidence.pyThis writes matching evidence trees under reports/ and public/reports/.
The Day 3 null check is documented separately before and after assignment cleaning in reports/tables/missing_values_before_cleaning.csv and reports/tables/missing_values_after_cleaning.csv.
Put the official Kaggle Titanic files in kaggle_uploads/:
kaggle_uploads/train.csv
kaggle_uploads/test.csv
Then generate the final no-leakage upload:
venv/bin/python scripts/generate_kaggle_ultimate_submission.pyThis writes kaggle_uploads/submission.csv only. No OpenML rows, gender_submission.csv labels, or hidden test labels are used.
- Install node packages:
npm install
- Start local Vite development server:
npm run dev
- Build for static deployment:
npm run build
You can run your local Python files and notebook pipelines directly inside Google Colab from your terminal using the google-colab-cli tool.
First, install uv (recommended):
brew install uvThen install the Colab CLI:
uv tool install google-colab-cliAlternative install using pip:
pip install google-colab-cli- Create a Colab runtime:
colab new
- Create a GPU runtime (T4):
colab new --gpu T4
- Run a local Python file on Colab:
colab exec -f scripts/create_model_comparison_notebook.py - Open an interactive Python REPL on Colab:
colab repl
- Open a remote terminal/console session:
colab console
- List active Colab runtime sessions:
colab sessions
- Stop the Colab runtime:
colab stop
Below is the Kaggle model-comparison result produced through Google Colab CLI on June 24, 2026 from notebooks/01_Titanic_Model_Comparison_Project.py.
Metric provenance: Kaggle train.csv, 891 rows; grouped Age imputation by Pclass and Sex; explicit unknown cabin handling; title, family, alone, ticket-prefix, deck, and fare-per-person features; stratified 80/20 holdout; five-fold stratified training CV; random_state=42. Models are ranked only by training CV ROC-AUC.
| Rank | Model Name | CV ROC-AUC | Holdout Accuracy | Balanced Accuracy | F1 | Holdout ROC-AUC | Log Loss |
|---|---|---|---|---|---|---|---|
| 1 | Soft Voting Ensemble | 0.8986 | 0.7989 | 0.7850 | 0.7353 | 0.8620 | 0.4437 |
| 2 | XGBoost | 0.8979 | 0.7933 | 0.7751 | 0.7218 | 0.8385 | 0.4975 |
| 3 | CatBoost | 0.8931 | 0.7989 | 0.7850 | 0.7353 | 0.8636 | 0.4623 |
| 4 | YDF Gradient Boosted Trees | 0.8880 | 0.7821 | 0.7552 | 0.6929 | 0.8432 | 0.4466 |
| 5 | Random Forest | 0.8872 | 0.7877 | 0.7625 | 0.7031 | 0.8431 | 0.4504 |
| 6 | LightGBM | 0.8863 | 0.8268 | 0.8132 | 0.7704 | 0.8479 | 0.4813 |
| 7 | YDF Random Forest | 0.8836 | 0.8045 | 0.7815 | 0.7287 | 0.8540 | 0.6141 |
| 8 | TensorFlow Neural Net | 0.8829 | 0.8156 | 0.7987 | 0.7519 | 0.8643 | 0.4330 |
| 9 | Logistic Regression | 0.8739 | 0.8324 | 0.8177 | 0.7761 | 0.8697 | 0.4245 |
| 10 | Decision Tree | 0.8723 | 0.8101 | 0.7995 | 0.7536 | 0.8650 | 0.8051 |
| 11 | KNN | 0.8608 | 0.7877 | 0.7706 | 0.7164 | 0.8553 | 0.8148 |
- Accuracy impact: Basic preprocessing produced
0.7936mean CV accuracy. Grouped Age imputation increased it to0.7950, and full leakage-safe feature engineering increased it to0.8287. - Selection result: The XGBoost/CatBoost/Random Forest soft-voting ensemble had the highest training CV ROC-AUC (
0.8986) and generatedsubmissions/submission_model_comparison.csv. - Holdout result: Logistic Regression produced the strongest single holdout results, including accuracy
0.8324, F10.7761, ROC-AUC0.8697, and log loss0.4245. - Interpretation: CV and one holdout can rank models differently. The workflow selects by training CV to avoid tuning decisions against the final holdout.
Generate graph images:
python3 scripts/generate_titanic_figures.pyGenerate the static model JSON used by the browser predictor:
python3 scripts/export_titanic_web_model.pyThe graph script writes PNG files to public/assets/plots/ and creates:
public/assets/titanic_graphs.zip
kaggle_uploads/ is local only and ignored by Git.
Download the official Titanic competition files from Kaggle and place them here:
kaggle_uploads/train.csv
kaggle_uploads/test.csv
Then generate no-leakage candidate uploads:
venv/bin/python scripts/generate_kaggle_score_candidates.pyIf your shell does not provide venv/bin/python, use:
python3 scripts/generate_kaggle_score_candidates.pyThe script writes one submission file:
kaggle_uploads/submission.csv
Kaggle public score must be checked by submitting the file on Kaggle because local holdout accuracy and the Kaggle public leaderboard can differ.
No OpenML rows, gender_submission.csv labels, leaked test labels, or hidden ground truth are used.
Before deploying, replace sid0sid-ops placeholders in:
README.mdpackage.jsonsrc/data/projectContent.jsdocs/deployment.md
GitHub Actions deployment:
- Push the repository to GitHub.
- Open Settings -> Pages.
- Set Build and deployment source to GitHub Actions.
- Push to
main. - Wait for the deploy workflow to finish.
Manual deployment with gh-pages:
npm run build
npm run deployThe live website will be:
https://sid0sid-ops.github.io/titanic-data-to-discovery/
The assignment baseline is generated from a fixed 80/20 stratified split of the Kaggle 891-row training set with RANDOM_STATE = 42. Current values are stored in reports/metrics/model_metrics.json; rerun the generator rather than copying metrics into documentation.
Current generated baseline result: Kaggle train.csv; 891 rows; Logistic Regression; features pclass, sex, age, sibsp, parch, fare, embarked, family_size, is_alone; stratified 80/20 holdout (179 validation rows); random_state=42; accuracy 0.8156; ROC-AUC 0.8499; source scripts/generate_assignment_evidence.py.
The repository contains evidence, explanations, and editable learning scaffolds. Final submitted answers should be reviewed and written by the student.
This project was inspired by Ashok Gopalakrishnan during a lecture under the IICT Summer Internship Program in AI & Machine Learning (2026). His discussion on using historical events as a foundation for data analysis encouraged me to explore the Titanic dataset as my first structured data science project.
Through this work, I tried to connect history with Python-based data analysis, visualization, machine learning, and clear project communication. I also acknowledge the learning support of AI tools, which helped me structure, refine, and improve the project while understanding the workflow step by step.
- OpenML Titanic dataset.
- DataScienceDojo Titanic dataset.
- Seaborn Titanic dataset.
- Scikit-Learn documentation for Pipeline and ColumnTransformer.
- Project blueprint:
docs/Titanic Data Science Blueprint.docx.