The sinking of the Titanic is one of the most infamous shipwrecks in history.
On April 15, 1912, during her maiden voyage, the widely considered “unsinkable” RMS Titanic sank after colliding with an iceberg. Unfortunately, there weren’t enough lifeboats for everyone on board, resulting in the death of 1502 out of 2224 passengers and crew.
While some element of luck was involved in surviving, some groups of people seemed more likely to survive than others.
In this challenge, we ask you to build a predictive model that answers the question: “what sorts of people were more likely to survive?” using passenger data (ie name, age, gender, socio-economic class, etc).
Download the dataset from - https://www.kaggle.com/datasets/yasserh/titanic-dataset Titanic dataset contains 891 rows and 12 columns. The columns are
- PassengerId - PassengerId.
- Survival - Survival in Titanic.
- pclass - Passenger class.
- Name - Name of the passenger.
- Sex - Sex.
- Age - Age in year.
- SibSp - Siblings/spouses aboard the Titanic.
- Parch - Parents/children aboard the Titanic.
- Ticket - ticket number.
- Fare - Passenger fare.
- Cabin - cabin number.
- Embarked - Port of embarkation (C-Cherbourg, Q- Queenstown, S- Southampton, O- others)
Data Preprocessing and Cleaning
- Deals with NaN values using heatmap.
- Drop the Cabin column.
- Impute NaN Age based on the mean age.
- Impute NaN Embarked based on the mode embarked.
Data Visualization
- Plottig histogram of the dataset.
- Illustrate the trends in survival rates and demographic characteristics.
- Plotting passenger class survives.
- Showing Distribution of Pclass Sex wise.
Building Model
- Label encoding.
- Selecting independent and dependent features.
- Split data for training and testing.
- Train,Predict, and evaluate the Logistic Regression, Random Forest Classifier, DecisionTreeClassifier,KNeighborsClassifier,SVC, and AdaBoostClassifier.