application_vnd.jupyter.stderr_output_27.png application_vnd.jupyter.stderr_output_35.png application_vnd.jupyter.stderr_output_24.png application_vnd.jupyter.stderr_output_16.png application_vnd.jupyter.stderr_output_9.png application_vnd.jupyter.stderr_output_52.png application_vnd.jupyter.stderr_output_53.png application_vnd.jupyter.stderr_output_32.png application_vnd.jupyter.stderr_output_48.png application_vnd.jupyter.stderr_output_2.png application_vnd.jupyter.stderr_output_7.png application_vnd.jupyter.stderr_output_11.png application_vnd.jupyter.stderr_output_18.png application_vnd.jupyter.stderr_output_38.png application_vnd.jupyter.stderr_output_4.png application_vnd.jupyter.stderr_output_26.png application_vnd.jupyter.stderr_output_6.png application_vnd.jupyter.stderr_output_31.png application_vnd.jupyter.stderr_output_33.png application_vnd.jupyter.stderr_output_25.png application_vnd.jupyter.stderr_output_12.png application_vnd.jupyter.stderr_output_8.png application_vnd.jupyter.stderr_output_10.png application_vnd.jupyter.stderr_output_23.png application_vnd.jupyter.stderr_output_34.png application_vnd.jupyter.stderr_output_19.png application_vnd.jupyter.stderr_output_44.png application_vnd.jupyter.stderr_output_13.png application_vnd.jupyter.stderr_output_3.png application_vnd.jupyter.stderr_output_42.png application_vnd.jupyter.stderr_output_5.png application_vnd.jupyter.stderr_output_30.png application_vnd.jupyter.stderr_output_15.png application_vnd.jupyter.stderr_output_17.png application_vnd.jupyter.stderr_output_28.png application_vnd.jupyter.stderr_output_46.png application_vnd.jupyter.stderr_output_41.png application_vnd.jupyter.stderr_output_20.png application_vnd.jupyter.stderr_output_49.png application_vnd.jupyter.stderr_output_47.png application_vnd.jupyter.stderr_output_36.png application_vnd.jupyter.stderr_output_57.png application_vnd.jupyter.stderr_output_22.png application_vnd.jupyter.stderr_output_56.png application_vnd.jupyter.stderr_output_50.png application_vnd.jupyter.stderr_output_29.png application_vnd.jupyter.stderr_output_1.png application_vnd.jupyter.stderr_output_51.png application_vnd.jupyter.stderr_output_45.png application_vnd.jupyter.stderr_output_14.png application_vnd.jupyter.stderr_output_39.png application_vnd.jupyter.stderr_output_21.png application_vnd.jupyter.stderr_output_43.png application_vnd.jupyter.stderr_output_54.png application_vnd.jupyter.stderr_output_55.png application_vnd.jupyter.stderr_output_40.png application_vnd.jupyter.stderr_output_37.png
from sklearn.naive_bayes import GaussianNB

import numpy as np

import numpy as np # linear algebra

import pandas as pd

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

train_df = pd.read_csv('../input/train.csv', dtype={'Age': np.float64})
test_df = pd.read_csv('../input/test.csv', dtype={'Age': np.float64})

"""
Takeaways
Age is null for some rows
Cabin is almost always null
Embarked is null for only 2 rows
"""

"""
Takeaways
Fare is null for one row
Cabin null for most
Age null for some
"""

X_train = train_df[['Pclass', 'Sex', 'Age', 'Parch', 'Fare', 'Embarked', 'Child', 'Family', 'CabinStartsWith']].values
Y_train = train_df[['Survived']].values
X_test = test_df[['Pclass', 'Sex', 'Age', 'Parch', 'Fare', 'Embarked', 'Child', 'Family', 'CabinStartsWith']].values

gaussian = GaussianNB()
gaussian.fit(X_train, Y_train)
Y_pred_nb = gaussian.predict(X_test)
gaussian.score(X_train, Y_train)