5 Adventure Destinations You Can Visit Around Bangalore in Low Budget

The state of Karnataka is a haven for adventure lovers because of the number of well-known as well as hidden gems it has for adventure activities . Bangalore acts as the central point for you to…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Predicting who survived on Titanic using Machine Learning

Today i will show you simple method on how to do classification on Titanic dataset using machine learning with Python.

Then we need to import some libraries:

Pandas will be used to load our data, numpy for mathematical computations and mathplotlib for plotting our graph at the end.

Next we will set our random seed so random numbers are same after every run.

Now it’s time to load data that we previously downloaded from Kaggle:

We will use Pandas to convert data so we can actually use it:

Let’s look at the data we have:

Train data

Now we need to create separate dataset in which we will say if passenger survived or not.

This is how it look like:

False mean passenger didn’t survived

If you look back at our training data you can see that some columns are certainly not important for question of did passenger survived.

So we will remove unimportant ones:

I removed survived column because we already made separate dataset for this.

There are certain columns who are not usable until we replace their values. Those columns are “Sex” and “Embarked”. Now we will replace male and female with 0 and 1 and Q, S, R with 1, 2, 3:

There are also some null values in “Age” column. We will fix that by computing median value of entire column and replacing every null value with that:

Result that we got is:

This means 70% accuracy. Not bad. We can also try Random Forest to see if we can have better score.

Result is:

That is 10% better! Now we have model that can classify whether certain person survived on Titanic with 80% accuracy.

Last thing we can do is plot a graph to see differences between SVM and Random Forest.

Add a comment

Related posts:

Digital Twin Technology Building and Use

One stat I recently read claimed over five billion people use a cell phone. On top of the massive influx of data collected by apps and general usage, we also have the information collected from the…

How I Quickstart ReasonML Apps

The official ReasonReact template comes with a lot of unnecessary things I always delete and it doesn’t have much set up in terms of testing and building for production. So I decided to create an…

8 Types Of Empathy

Being an empathy means a lot more than feeling the emotions of others and that’s because there are not one, but eight kinds of empathy. Psychiatrist Judith Orloff knows all about empaths and…