Our goal is to find out what factors affected who lived or died on the Titanic.
We ask questions like:
• Did men die more than women?
• Did the passenger class make a difference?
• Did the place where people got on the ship matter?
• Did having family members aboard affect survival?
By asking these questions, we can guide our analysis and focus only on the most important details that may have influenced death rates.
We used the Titanic dataset which is stored in a CSV file.
Each row represents one passenger, and each column gives information about them.
The dataset includes:
• Sex
• Passenger class (1, 2, or 3)
• Embarkment point (Cherbourg, Queenstown, Southampton)
• Number of siblings/spouses aboard (SibSp)
• Number of parents/children aboard (Parch)
• Age
• Survival status (0 = Died, 1 = Survived)
Although some values like age were missing, the dataset still provided enough information to study which factors affected deaths the most.
We explored the dataset using graphs to find patterns and relationships.
We created several bar plots to compare survival with different factors.
From the graphs, we found that:
• More men died than women — sex strongly affected survival.
• Third-class passengers had a much higher death rate.
• People who boarded from Southampton died more often.
• Passengers with many or no siblings/spouses had lower survival rates.
This step helped us clearly identify which features were most linked to people dying on the Titanic.
We split the dataset into two parts — training and testing.
We used a logistic regression model to predict survival.
The model studied different features like sex, class, embarkment point, and family members aboard to find patterns.
It learned that:
• Being female increased chances of survival.
• First-class passengers were more likely to live.
• Passengers from Cherbourg had better chances.
• Having one or two family members improved survival chances.
After training, the model could predict survival for new passengers based on these factors.
We tested the model to check how accurate it was.
The model reached an accuracy of % 80 (0.80), meaning it predicted most cases correctly.
If the accuracy was lower, we would have adjusted the model or cleaned the data more.
This step showed that the model was reliable enough to explain which factors affected death and survival.
Finally, we used the model and graphs to present the results.
We found that the main factors affecting death on the Titanic were sex, class, embarkment point, and number of siblings or spouses aboard.
By studying these factors, our AI model helps us understand the reasons behind survival patterns on the Titanic.
Output: