def test():
iris = load_iris()
xgb_model = xgb.XGBRegressor(n_estimators=300000, max_depth=2)
xgb_model.fit(iris.data[:120],iris.target[:120])
predict = xgb_model.predict(iris.data[:120])
print mean_squared_error(iris.target[:120], predict)
pred = xgb_model.predict(iris.data[120:])
print mean_squared_error(iris.target[120:], pred)
评论列表
文章目录