Computer Science Principles
Titanic Survival Predictor - Aaryav
Titanic Survival Predictor
Cleaner layout, clearer form flow, and a better read on the model output.
This page sends the same passenger payload to the notebook-backed Flask route, but the interface is now organized around three things: building the record, reviewing the live manifest, and reading the prediction without visual clutter.
Prediction Route
POST /api/titanic/predict
Returns die and survive probabilities from the notebook-trained model.
Notebook Parity
Derived alone + encoded port
The frontend still mirrors the notebook preprocessing flow before the request is sent.
Inputs Passed Through
9 fields
Name, class, sex, age, fare, embarkation, family counts, and a derived solo-travel flag.
Design Direction
Less noise
The right rail handles preview and results so the form can stay focused and readable.
Step 1
Build the passenger
Fill in class, age, fare, departure port, and family details in a tighter form layout.
Step 2
Review the manifest
The live summary updates before any API request so you can spot mistakes early.
Step 3
Read the output
The result card separates the survival signal, meter, and optional model weights.
Passenger Builder
Build a boarding record
The form is grouped by identity, ticket details, and travel group so the record reads clearly before submission.
Live Manifest
Passenger summary
Manifest readout
Avery Dawson boards from Southampton with a second-class ticket and a solo travel profile.
Cabin tier
2nd Class
Party size
1 passenger
Departure port
Southampton
Fare signal
$16.00
Defaults to the local Flask service on localhost:8587 and falls back to the deployed Flask host elsewhere.
Prediction Output
Awaiting result
Run the predictor to see the model output.
Survival chance
0.0%
Death chance
0.0%
Global feature weights
Rendered only if the backend sends weights. These are model-level importances, not passenger-specific explanations.
Notebook Pipeline
What this page is hosting
1. Load data
Seaborn Titanic dataset
The notebook starts from the standard Titanic dataset and narrows the columns used for training.
2. Clean inputs
Binary + one-hot preprocessing
Sex and alone become numeric fields, while embarkation is encoded across dedicated feature columns.
3. Predict
Logistic regression via Flask
The page sends the same notebook-shaped payload to /api/titanic/predict and renders the returned probabilities.
Notebook source: _notebooks/CSP/big-ideas/big-idea-2/2025-02-19-pandas-ml_titanic.ipynb
Payload sent: name, pclass, sex, age, sibsp, parch, fare, embarked, and the derived alone value.