Posts

Showing posts from October, 2017

Using scikit-learn to tackle the Titanic Kaggle Competition

Image
Motivation This page contains walkthrough information written in python for the Titanic: Machine Learning from Disaster Titanic Code In [1]: import pandas as pd import numpy as np import matplotlib.pyplot as plt from pandas.tools.plotting import scatter_matrix In [2]: # deterministic random data np . random . seed ( 42 ) In [3]: #Loading the training data train = pd . read_csv ( "train.csv" , index_col = "PassengerId" ) In [4]: train . info () #Some info are missing (age:714, cabin:204, embarked:889) <class 'pandas.core.frame.DataFrame'> Int64Index: 891 entries, 1 to 891 Data columns (total 11 columns): Survived 891 non-null int64 Pclass 891 non-null int64 Name 891 non-null object Sex 891 non-null object Age 714 non-null float64 SibSp 891 non-null int64 Parch