The AI Alpha Geek: It starts with EDA! - Part D
Tags: datascience, datavisualization, eventdriven, machinelearning
Published: 2020-11-30 19:14:18

---
title: The AI Alpha Geek: It starts with EDA! - Part D
published: true
description: 
tags: #datascience #datavisualization #eda #machinelearning
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/ivgxhnina509pp8cy05d.jpg
---

| [The AI Alpha Geek: It starts with EDA! - Part A](https://dev.to/joyadauche/the-ai-alpha-geek-it-starts-with-eda-part-a-2l1i)      |    
| :------------- | 
| **[The AI Alpha Geek: It starts with EDA! - Part B](https://dev.to/joyadauche/the-ai-alpha-geek-it-starts-with-eda-part-b-8l3)**       |
| **[The AI Alpha Geek: It starts with EDA! - Part C](https://dev.to/joyadauche/the-ai-alpha-geek-it-starts-with-eda-part-c-2nle)**       |

Now, let's see feature relationships i.e exploring 2 or more features together. Let's look at the code example below - 

{% gist https://gist.github.com/joyadauche/97fe09d38a4ced41225b201b1a948a61 file=eda_part_d.py %}

Let's take a look at the **Pclass** and **Survived** features below produced from Line 1:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mr72bctabj2ufs35ykgc.png)

From the count plot output above, which is produced from *Line 1*, it seems:
- a lot more people in the lower class, i.e class 3, didn't survive.
- more people in the upper class, i.e class 1, survived.

To know the why's behind the insights above, you can ask questions like:
- could it be that passengers in the upper class had the opportunity to escape because they were situated on the upper deck of the titanic? 
- probably when the ship hit the iceberg, the lower deck flooded and some passengers drowned?
- perhaps those at the upper deck were given preferential treatment?

Now you must also be wondering what gender had a higher survival rate? Look below:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/akm8asx4u1e8z7tyc8t9.png)

From above, remember in [Part B](https://dev.to/joyadauche/the-ai-alpha-geek-it-starts-with-eda-part-b-8l3) that the total number of people who survived is **549** -  So, we can see that a lot more males didn't survive. 
The above insight brings more questions comes to mind:
- could it be that women and children were saved first before adult males?
- could it be more males gave their lives for their loved ones?



Now, let's see how more than 3 features relate below:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/profrvx5wubfbka3bh9f.png)

From the bar plot output above, produced from Lines 7, it seems that: 
- for each class, passengers with a younger average age survived.

Then, looking at features **Age**, **Sex** and **Survived** below:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/v35z6vn49916ytv9a6a2.png)

From the above, it is visually obvious that males and females with an average age of 27.28 and 28.86 respectively survived.

Let's visually explore the **Fare** feature output for Lines 13 and 14 below:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/aj4u9wkk4hd2a3nwio17.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/l08c5fir5fd2cdwngm4k.png)

From the above, it seems that:
- males who survived paid an average fare of 40.82,
- while females paid an average fare of 51.94.
- those who did not survive had a much lower average fare for both males and females.

When you run other lines of code for other features that include **Embarked**, **Parch**, and **SibSp**, you will draw much more valuable insights from the data.

We sure got more insights which improves how much we understand our data. So, always try to understand or ask about the **why** behind insights discovered. Stay tuned for the next part where we collate all insights and valuable patterns and dive into **Feature Engineering** still using the titanic dataset. Have an amazing December! :wink: