#泰坦尼克号生存预测
# 1.导入依赖包
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier, plot_tree
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, roc_auc_score, classification_report
import matplotlib.pyplot as plt
# 2.读取数据及预处理
# 2.1 读取数据
data = pd.read_csv('./data/train.csv')
# data.info()
# print(data.head())
# 2.2 数据处理
x = data[['Age', 'Pclass', 'Sex']]
y = data.Survived
# 2.3 缺失值处理
x.Age.fillna(x['Age'].mean(), inplace=True)
print(x.Age)
x = pd.get_dummies(x)
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=21, random_state=21)
# 3.模型训练
model = DecisionTreeClassi