<reponame>Shubbair/machine-learning
"""
  *** <NAME> ***
  _________Shubbair__________

TODO Decision Tree

"""

import pandas as pd
from sklearn import tree
from sklearn.model_selection import train_test_split

data = pd.read_csv('input.csv')

target = data.Survived

data.drop(['PassengerId', 'Survived', 'Name', 'SibSp', 'Parch', 'Ticket', 'Cabin', 'Embarked'], axis='columns', inplace=True)

# make the string number with map() function
data.Sex = data.Sex.map({'male': 1, 'female': 2})

data.Age = data.Age.fillna(data.Age.mean())

X_train, X_test, y_train, y_test = train_test_split(data, target, test_size=0.2)

model = tree.DecisionTreeClassifier()
model.fit(X_train, y_train)

print(model.score(X_test, y_test))

print(model.predict(X_test[0]))








"""
  *** <NAME> ***
  _________Shubbair__________

TODO Decision Tree

"""

import pandas as pd
from sklearn import tree
from sklearn.model_selection import train_test_split

data = pd.read_csv('input.csv')

target = data.Survived

data.drop(['PassengerId', 'Survived', 'Name', 'SibSp', 'Parch', 'Ticket', 'Cabin', 'Embarked'], axis='columns', inplace=True)

# make the string number with map() function
data.Sex = data.Sex.map({'male': 1, 'female': 2})

data.Age = data.Age.fillna(data.Age.mean())

X_train, X_test, y_train, y_test = train_test_split(data, target, test_size=0.2)

model = tree.DecisionTreeClassifier()
model.fit(X_train, y_train)

print(model.score(X_test, y_test))

print(model.predict(X_test[0]))
*** <NAME> ***   _________Shubbair__________  TODO Decision Tree # make the string number with map() function