import pandas as pd
plt.title('Line Roc of X_train by estimator KNN', size=20)
plt.show()
---------------------------------结果-----------------------------------------------
训练模型的roc曲线如下:
训练模型的召回率和精准率和roc曲线积分值如下:
测试模型的roc曲线如下:
训练模型的召回率和精准率和roc曲线积分值如下:
用来测试的survived如下:
训练模型得到的预测结果如下:
计算预测与实际的准确率:
k=0
# 有417个样本待预测
for i in range(417):
if y_test[i] == y_pred[i]:
k=k+1
print(k/417)
得到结果:
准确率有大约84.65%。