def model_extra_trees_regression(Xtrain,Xtest,ytrain):
X_train = Xtrain
y_train = ytrain
etr = ExtraTreesRegressor(n_jobs=1, random_state=0)
param_grid = {}#'n_estimators': [500], 'max_features': [10,15,20]}
model = GridSearchCV(estimator=etr, param_grid=param_grid, n_jobs=1, cv=10, scoring=RMSE)
model.fit(X_train, y_train)
print('Extra trees regression...')
print('Best Params:')
print(model.best_params_)
print('Best CV Score:')
print(-model.best_score_)
y_pred = model.predict(Xtest)
return y_pred, -model.best_score_
# read data, build model and do prediction
# read train data
RandomForest.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录