text_plain_output_1.png
from sklearn.ensemble import RandomForestRegressor

from sklearn.metrics import roc_auc_score

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from subprocess import check_output
train = pd.read_csv('../input/train.csv')
test = pd.read_csv('../input/test.csv')

train['Age'].fillna(train.Age.mean(), inplace=True)

df = pd.DataFrame(train, index=['PassengerId', 'Survived', 'Pclass', 'Name', 'Sex', 'Age', 'SibSp', 'Parch', 'Ticket', 'Fare', 'Cabin', 'Embarked'])
y_train, X_train = (train['Survived'], train.drop(['Survived', 'Name', 'Ticket', 'Cabin', 'PassengerId'], axis=1))
X_train

tonumeric = ['Sex', 'Embarked']
for variable in tonumeric:
    X_train[variable].fillna('Missing', inplace=True)
    dummies = pd.get_dummies(X_train[variable], prefix=variable)
    X_train = pd.concat([X_train, dummies], axis=1)
    X_train.drop([variable], axis=1, inplace=True)

model = RandomForestRegressor(n_estimators=100, oob_score=True, random_state=50)
model.fit(X_train, y_train)

from sklearn.metrics import roc_auc_score
roc_auc_score(y_train, model.oob_prediction_)