ML之xgboost:利用xgboost算法(sklearn+3Split)训练mushroom蘑菇数据集(22+1,6513+1611)来预测蘑菇是否毒性(二分类预测)
目录
输出结果
设计思路
核心代码
seed = 7
test_size = 0.33
X_train_part, X_validate, y_train_part, y_validate = train_test_split(X_train, y_train,
test_size=test_size,random_state=seed)
validare_preds = bst.predict(X_validate)
train_accuracy = accuracy_score(y_validate, validate_predictions)
print ("【max_depth=3】Validation Accuary: %.2f%%" % (train_accuracy * 100.0))