4 different ways to predict survival on Titanic – part 1

Posted Leave a commentPosted in Data Analysis Resources, Kaggle

These are my notes from various blogs to find different ways to predict survival on Titanic using Python-stack. I am interested to compare how different people have attempted the kaggle competition. I am going to compare and contrast different analysis to find similarity and difference in approaches to predict survival on Titanic. This Notebook will […]

4 different ways to predict survival on Titanic - part 4

4 different ways to predict survival on Titanic – part 2

Posted Leave a commentPosted in Data Analysis Resources, Kaggle, Predictive Analysis

continued from part 1 Classification KNeighborsClassifier In [16]: from sklearn.neighbors import KNeighborsClassifi alg_ngbh = KNeighborsClassifier(n_neighbors=3) scores = cross_validation.cross_val_score(alg_ngbh, train_data_scaled, train_data_munged[“Survived”], cv=cv, n_jobs=-1) print(“Accuracy (k-neighbors): {}/{}”.format(scores.mean(), scores.std())) Accuracy (k-neighbors): 0.7957351290684623/0.011110544261068086 SGDClassifier In [17]: from sklearn.linear_model.stochastic_gradient import SGDClassifier alg_sgd = SGDClassifier(random_state=1) scores = cross_validation.cross_val_score(alg_sgd, train_data_scaled, train_data_munged[“Survived”], cv=cv, n_jobs=-1) print(“Accuracy (sgd): {}/{}”.format(scores.mean(), scores.std())) Accuracy (sgd): 0.7239057239057239/0.015306601231185043 SVC In [18]: from sklearn.svm […]

EDA

Exploratory Data Analysis with pandas – 2

Posted Leave a commentPosted in Data Analysis Resources

continued from part 1 In [10]: densityplot = iris_df.plot(kind=’density’) In [11]: single_distribution = iris_df[‘petal width (cm)’].plot(kind=’hist’, alpha=0.5) Scatterplots Scatterplots can be used to effectively understand whether the variables are in a nonlinear relationship, and you can get an idea about their best possible transformations to achieve linearization In [12]: colors_palette = {0: ‘red’, 1: ‘yellow’, 2:’blue’} colors = […]