Predicting Titanic Survival Rate.
- Arunesh Mishra
- Jul 5, 2019
- 1 min read
Updated: Aug 2, 2019
Would you have survived the Titanic?
The RMS Titanic set sail on its maiden voyage in 1912, crossing the Atlantic from Southampton, England to New York City. The ship never completed the voyage, sinking to the bottom of the Atlantic Ocean after hitting an iceberg, bringing down 1,502 of 2,224 passengers onboard.
In this project you will create a Logistic Regression model that predicts which passengers survived the sinking of the Titanic, based on features like age and class.
The data we will be using for training our model is provided by Kaggle.

The first task was importing important libraries.

Pandas comes in very handy when it comes to read and analyze the dataset. On the other hand, Matplotlib is very useful when we want to visvualise the results in form of graphs. Next step was to find important factors that crucuial to get ypu a life boat in Titanic. Was it age, was it the class of your ticket, or some other factor?

After using the _coeff to find relationships between the factors, the Linear Regressor model was fitted to the dataset.
So what were the final results ?

What were the factors that affected the odds of surviving? It turns out that there were three major variables age, gender, and ticket class that were most important to get a lifeboat!
How does it work?
Copy the whole code to a python compiler. Make sure to fill your details in the "You" - line 52 under the Sample Passenger Features. Age (0 for male, 1 for female), age, ticket class (first class etc).
Happy findings !!
Kommentarer