testing out titanic

import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.linear_model import LogisticRegression from sklearn.cross_validation import KFold from sklearn import cross_validation #Print you can execute arbitrary python code train = pd.read_csv(“../input/train.csv”, dtype={“Age”: np.float64}, ) test_sample = pd.read_csv(“../input/test.csv”, dtype={“Age”: np.float64}, ) #Print to standard output, and see the results in the “log” section below after running your script print(“nnTop of the training data:”) print(train.head()) print(“nnSummary statistics of training data”) print(train.describe()) train[“Age”]=train[“Age”].fillna(train[“Age”].median()) train.loc[train[“Sex”] == “male”, “Sex”] = 0 train.loc[train[“Sex”] == “female”, “Sex”] = 1 train[“Embarked”]=train[“Embarked”].fillna(“S”) train.loc[train[“Embarked”] == “S”, “Embarked”] = 0 train.loc[train[“Embarked”] == “C”, “Embarked”] = 1 train.loc[train[“Embarked”] == “Q”, “Embarked”] = 2 predictors = [“Pclass”, “Sex”, “Age”, “SibSp”, “Parch”, “Fare”, “Embarked”] alg = LinearRegression() kf = KFold(train.shape[0], n_folds=3, random_state=1) predictions = [] for training, test in kf: train_predictors…


Link to Full Article: testing out titanic