输出结果
设计思路
核心代码
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))