Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🚒 Titanic Survival Prediction using Decision Tree

Python scikit-learn License: MIT

This project uses a Decision Tree Classifier to predict passenger survival on the Titanic based on selected features such as age, fare, and class. It also includes a simple prediction for a hypothetical passenger and a scatter plot to visualize actual vs. predicted outcomes.


πŸ“ Project Files

  • titanic.csv – Dataset with passenger information (must be placed in the same directory)
  • titanic_survival_decision_tree.py – Python script for training, testing, and predicting
  • README.md – Project documentation

πŸ“Š Dataset Overview

The Titanic dataset contains demographic and travel information of passengers. The target variable is:

  • Survived: 1 if the passenger survived, 0 otherwise

Features used in this model:

Feature Description
Pclass Passenger class (1 = 1st, 2 = 2nd, 3 = 3rd)
Sex Gender (encoded: male = 0, female = 1)
Age Age in years (missing values imputed)
SibSp Number of siblings/spouses aboard
Parch Number of parents/children aboard
Fare Ticket fare (missing values imputed)

βš™οΈ Model Details

  • Model: Decision Tree Classifier
  • Library: scikit-learn
  • Evaluation Metric: Accuracy

βœ… Sample Output

The model is trained using 80% of the data and tested on the remaining 20%.


πŸ“ˆ Visualization

A scatter plot compares actual survival outcomes with predicted outcomes.

Actual vs Predicted


πŸ§ͺ Example: New Passenger Prediction

The script includes an example prediction for a new passenger with the following features:

  • Class: 2nd
  • Gender: Female
  • Age: 30
  • Siblings/Spouses aboard: 0
  • Parents/Children aboard: 0
  • Fare: 10

Prediction output:

Prediction for new passenger: Survived

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages