Exploratory Data Analysis (EDA)

End-to-End Machine Learning: Titanic Survival Prediction

1 min read

Published Nov 18 2025, updated Aug 17 2026


10
0
0
0

KerasMachine LearningMatplotlibNumPyPandasPythonscikit-learnSciPySeabornTensorFlow

Before building models, we explore the data. EDA helps validate assumptions, spot issues, and inspire feature engineering.



Overall survival rate

titanic["survived"].value_counts(normalize=True).plot(kind="bar")plt.title("Overall Survival Rate")plt.xticks([0, 1], ["Died", "Survived"])plt.show()

overall survival rate

Roughly 38% survived, reflecting historical reality.






Survival by gender

The famous “women and children first” rule should be visible:

sns.countplot(data=titanic, x="sex", hue="survived")plt.title("Survival by Sex")plt.show()

gender survival rate

Women clearly survived at a far higher rate than men.






Survival by class

sns.countplot(data=titanic, x="pclass", hue="survived")plt.title("Survival by Passenger Class")plt.show()

class survival rate

First class passengers enjoyed significantly higher survival chances, reflecting social and physical advantages (cabin location, priority access to lifeboats, etc.).






Age distribution

sns.kdeplot(data=titanic, x="age", hue="survived", common_norm=False)plt.title("Age Distribution by Survival")plt.show()

age distribution

Children appear to have somewhat different survival patterns.


We can create an explicit child flag:

titanic["is_child"] = titanic["age"] < 16sns.countplot(data=titanic, x="is_child", hue="survived")plt.title("Children vs Adult Survival")plt.show()

children vs adults
© 2025 SimpleSteps.guide
AboutFAQPoliciesContact
End-to-End Machine Learning: Titanic Survival Prediction | Exploratory Data Analysis (EDA) | SimpleSteps.guide