Titanic Survival Analysis in Python
Explore the Titanic dataset with survival rates by class, sex, and age, handle missing values, and visualize patterns using an AI data analyst.
What this AI workflow does
This AI Data Analyst workflow loads the Titanic training dataset from a URL and computes the overall survival rate and dataset shape. It generates visual comparisons of survival rates by passenger class and sex, and plots age distributions for survivors versus non-survivors. It also audits missing values by column to identify fields that need cleaning or imputation.
Who this example is for
This is for analysts and students who want a guided, conversational EDA example on a well-known classification dataset. It helps anyone practicing data cleaning and basic demographic breakdowns with reproducible Python code and plots.
Expected analysis outcomes
These are the results the AI workflow is expected to generate.
- Load the Titanic CSV from the provided URL and confirm shape (891, 12)
- Compute overall survival rate (38.4%)
- Create a grouped bar chart of survival rate by class and sex
- Plot survivor vs non-survivor age distributions
- Report missing values: Age 177, Cabin 687, Embarked 2
Tools and libraries used
Main Python packages and tooling used to run this AI data analysis task.
- pandas
- numpy
- matplotlib
- seaborn
- requests
Prompt sequence
This is the exact list of prompts used in this workflow. The same prompt sequence is sent to each model so outputs and scores can be compared fairly.
- 1load titanic dataset from https://raw.githubusercontent.com/pplonski/datasets-for-start/refs/heads/master/Titanic/train.csv and show survival rate overall
- 2plot survival rate by passenger class and sex
- 3show age distribution for survivors vs non-survivors
- 4how many missing values are there and which columns?
Model Comparison
We compared several LLM models on the same analysis task. The table below shows their scores side by side. You can also open each model run to check the full conversation and notebook results.
| Model Source | Score | Task | Execution | Output | Reasoning | Reliability | Run |
|---|---|---|---|---|---|---|---|
| gemma4:31b | 10/10 | 2/2 | 2/2 | 3/3 | 2/2 | 1/1 | Open gemma4:31b conversation |
| glm-5.1 | 10/10 | 2/2 | 2/2 | 3/3 | 2/2 | 1/1 | Open glm-5.1 conversation |
| gpt-5.4 | 10/10 | 2/2 | 2/2 | 3/3 | 2/2 | 1/1 | Open gpt-5.4 conversation |
| gpt-oss:120b | 10/10 | 2/2 | 2/2 | 3/3 | 2/2 | 1/1 | Open gpt-oss:120b conversation |
| qwen3-coder-next | 10/10 | 2/2 | 2/2 | 3/3 | 2/2 | 1/1 | Open qwen3-coder-next conversation |
| qwen3.5:397b | 10/10 | 2/2 | 2/2 | 3/3 | 2/2 | 1/1 | Open qwen3.5:397b conversation |
How scoring works
Each run is graded on five dimensions:
- Task Completion (0-2): how fully the workflow answered the requested analysis task and completed required steps.
- Execution Correctness (0-2): whether generated code is correct, consistent, and likely runnable without major fixes.
- Output Quality (0-3): how well tables, charts, and results match the expected analytical outcomes.
- Reasoning Quality (0-2): clarity and correctness of interpretation, explanation, and conclusions.
- Reliability (0-1): robustness of the run, including low hallucination risk and stable behavior.
The final score is the sum of these dimensions, so total score = 0-10. Higher values indicate more complete, correct, and reliable notebook results for this workflow.
AI Analysis with gpt-5.4
This run uses AI with a step-by-step list of prompts to perform the analysis task Titanic Survival Analysis in Python. Below, you can review the full conversation generated with gpt-5.4. After the conversation, we show detailed score cards for this run.
Score cards for gpt-5.4 for Titanic Survival Analysis in Python
Total score: 10/10
Task Completion: 2/2
ExcellentAll four requested analyses were completed: overall survival rate, survival by class and sex, age distribution by survival status, and missing values by column.
Execution Correctness: 2/2
ExcellentThe code is coherent and likely runnable as shown, with valid pandas/seaborn/matplotlib usage and outputs consistent with the Titanic dataset.
Output Quality: 3/3
ExcellentOutputs match the expected outcomes semantically: 38.38% survival, 891x12 shape, correct missing-value counts, and the expected survival pattern by class and sex. The age comparison also correctly indicates survivors skew younger.
Reasoning Quality: 2/2
ExcellentThe explanations are clear and grounded in the computed results, correctly interpreting the survival patterns and age distribution without obvious errors.
Reliability: 1/1
ExcellentThe workflow is consistent and uses direct computations from the dataset, with no hallucinated methods or unsupported claims.
Try MLJAR Studio
Run the same type of AI-powered data analysis on your own datasets with conversational notebooks in MLJAR Studio.
Explore More AI Analysis Examples
Discover additional workflows across categories. Each example includes prompts, conversation outputs, and model-level scoring so you can compare approaches and results.