A data-based approach to uncover what sorts of people were more likely to survive in one of the most infamous shipwrecks. Read detailed blog here.
We will be trying to answer the following questions -
- Were the rich given priority while assigning lifeboats?
- Were women evacuated first?
- How did family size impact the chance of survival?
- How important were boarding point and cabin location?
- The dataset has information on 1309 passengers who boarded the ship. It comprises 12 attributes of passenger information like name, age, gender, socio-economic class.
- Roughly 20 percent of the Age data is missing. The proportion of Age missing is likely small enough for reasonable replacement with some form of imputation. Looking at the Cabin column, it looks like we are just missing too much of that data to do something useful with at a basic level. We'll probably drop this later, or change it to another feature like "Cabin Known: 1 or 0"
- Sex and Embarked are categorical features which we'll need to convert to dummy variables using pandas! Otherwise our machine learning algorithm won't be able to directly take in those features as inputs.
- Imputed passenger age according to average age in Passenger class as wealthier passengers in the higher classes were found to be older.
- Handled the categorical variables like Sex and Embarked
- Extracted cabin distribution and level of cabin from 20% of available fields.
Used logistic regression to for prediction and got 81% accuracy.
Conclusions made after exploring the Titanic dataset
- Women and children were given priority during the evacuation process and had much higher chances of surviving.
- The wealthy first-class people had a good chance to survive irrespective of their boarding location.
- Midsize families had a higher chance of surviving than lone individuals and large families.
- Finally, we looked into the location of rooms in the Titanic and found out that people in upper blocks, nearer to the deck, were better off in comparison to mid and lower blocks (towards the bottom of ship and farther from the deck).
There should be no necessary libraries to run the code here beyond the Anaconda distribution of Python. The code should run with no issues using Python versions 3.*.
For this project, I was interestested in using Titanic Dataset to better understand:
- How was evacuation prioritized when ship was sinking?
- Were the rich given priority while assigning lifeboats?
- Were women and evacuated first?
- How did family size impact the chance of survival?
- How important were boarding point and cabin location?
There are three files available here to showcase work related to the above questions. The notebooks is exploratory in searching through the data pertaining to the questions showcased by the notebook title. Markdown cells were used to assist in walking through the thought process for individual steps.
At the end of the notebook, there is necessary code to obtain the final model used to predict whether person will survive or not.
The main findings of the code can be found at the post available here.
You can find the Licensing for the data and other descriptive information at the Kaggle link available here. Otherwise, feel free to use the code here as you would like!