Recipe to achieve top 8% feat over Kaggle leaderboard
By: Vinay Vikram
Tags: Machine Learning, Data Visualization, Data Science, Kaggle

And many other relevant rational features are explained in the notebook.

(4) Statistical Overview

Using some statistical aspects we find the relationship between different features and the target variable.

Correlation

Heatmap

Heatmap

Positive Correlation Features:

Fare and Survived: 0.26

Negative Correlation Features:

Fare and P-class: -0.55

Gender and Survived: -0.54

P-class and Survived: -0.34

So, Let’s analyze these correlations a bit. We have found some moderately strong correlations between different features.

There is a positive correlation between Fare and Survived rated.

This can be explained by saying that, the passenger who paid more money for their tickets were more likely to survive. This theory aligns with one other correlation which is the correlation between Fare and P-class(-0.55).

This relationship can be explained by saying that first-class passenger(1) paid more for fare then second class passenger(2) , similarly second class passenger paid more than the third class passenger(3) .

paid more for fare then , similarly second class passenger paid more than the . P-class correlation with our dependent variable, Survived. The correlation between P-class and Survived is -0.34.

This can also be explained by saying that the first-class passengers had a better chance of surviving than the second or the third and so on.

However, the biggest correlation with our dependent variable is the Gender variable, which basically is the info of whether the passenger was male or female. this is a negative correlation with a magnitude of -0.54 which definitely points towards some undeniable insights.

(5) Feature Engineering

Feature Engineering means creating additional features out of existing data. It requires extracting the relevant information from the data and getting it into a single table which can then be used to train a machine learning model.

For the given dataset we perform different engineering tricks like:

Feature Engineering with Name_length

Feature Engineering with Name_Length

Feature Engineering to know the family size

Feature Engineering with Family_size

Feature Engineering with Cabin and child columns

etc

(6) Pre-Modeling Tasks

Till this step, we are almost prepared with the dataset now time to perform tasks like :

Feature Scaling

Feature_scaling

Separating dependent and independent variables

Feature Separation

Splitting the training data (training and evaluation set)

Train_test_split

(7) Model Preparation

Hurry! Till here we comfortably made it…

Now it’s time to train an ML model using different algorithms. For the given dataset we will try out the following algorithms.

For each algorithm, we try out the hyperparameter tunning with Grid Search to figure out the most effective parameter for the given dataset.

Logistic Regression

Training Logistic Regression Model

K-Nearest Neighbors(KNN)

Training Knn Model

Gaussian Naive Bayes

Support Vector Machines

Decision Tree Classifier

Bagging on Decision Tree Classifier

Random Forest Classifier

Training Random_forest Model

Gradient Boosting Classifier

Voting Classifier

To check the complete process:- How these models are trained plz refer to the Notebook

(8) Model Accuracy Visualization

By the time we are done with model training and evaluation process, Here comes the next step to see which of the model did well, we create a sperate data frame for model predictions and then visualize it using matplotlib.

Accuracy Plot

From the above accuracy plot, we can see that

Random_forest

Voting_classifier

XGB_clssifier

are the best performing models.

(9) Submit test predictions

After this, we have to create a data frame to submit to the competition.

Final Prediction

Now download this submission file and upload it to Kaggle for further evaluation.

Question: But How to submit your final prediction to Kaggle and see your final score.

1. Click on the “Submit Predictions” button

Submit final prediction

2. Upload a CSV file in the submission file format. You’re able to submit 10 submissions a day.

Make Submission

Or simply drag and drop the final submission file and hit Make Submission to check your final score and standing on Kaggle Leaderboard (Your Public Score and Rank in the Leaderboard).

This submission got me the top 8% on the leaderboard: Do Check my Kaggle Profile.

Hope this post is helpful, still working for further improvement.

I will always incorporate new concepts of data science as I master them. This journey of learning is worth sharing as well as collaborating. So share your ideas and let’s make this blog best to get the start for every beginner…

If this blog helped you in any way, then do Follow and Clap👏, because your encouragement catalyzes inspiration and help to create more cool stuff like this.