您好,我正在解决一个由13个特征和550068行组成的回归problem.My数据集。我尝试了不同的不同模型,发现boosting算法(即xgboost,catboost,lightgbm)在大数据set.here上执行得很好
import lightgbm as lgb
gbm = lgb.LGBMRegressor(objective='regression',num_leaves=100,learning_rate=0.2,n_estimators=1500)
gbm.fit(x_train, y_train,
eval_set=[(x_test, y_test)],
eval_metric='l2_root',
early_stopping_rounds=10)
y_pred = gbm.predict(x_test, num_iteration=gbm.best_iteration_)
accuracy = round(gbm.score(x_train, y_train)*100,2)
mse = mean_squared_error(y_test,y_pred)
rmse = np.sqrt(mse)
import xgboost as xgb
boost_params = {'eval_metric': 'rmse'}
xgb0 = xgb.XGBRegressor(
max_depth=8,
learning_rate=0.1,
n_estimators=1500,
objective='reg:linear',
gamma=0,
min_child_weight=1,
subsample=1,
colsample_bytree=1,
scale_pos_weight=1,
seed=27,
**boost_params)
xgb0.fit(x_train,y_train)
accuracyxgboost = round(xgb0.score(x_train, y_train)*100,2)
predict_xgboost = xgb0.predict(x_test)
msexgboost = mean_squared_error(y_test,predict_xgboost)
rmsexgboost= np.sqrt(msexgboost)
from catboost import Pool, CatBoostRegressor
train_pool = Pool(x_train, y_train)
cbm0 = CatBoostRegressor(rsm=0.8, depth=7, learning_rate=0.1,
eval_metric='RMSE')
cbm0.fit(train_pool)
test_pool = Pool(x_test)
predict_cat = cbm0.predict(test_pool)
acc_cat = round(cbm0.score(x_train, y_train)*100,2)
msecat = mean_squared_error(y_test,predict_cat)
rmsecat = np.sqrt(msecat)通过使用上面的模型,我得到了大约2850的RMSE值。现在,我想通过降低均方根error.How来提高模型性能,我可以提高模型性能吗?由于我刚接触boosting算法,哪些参数会影响模型?我如何对这些算法(xgboost,catboost,lightgbm)进行超参数调整?我使用的是Windows10 os和英特尔i5 7代。
发布于 2018-06-05 17:28:44
在你尝试过的3个工具中,CatBoost在分类特征处理方面提供了优势(它也可以更快,但我没有看到一个基准测试来证明它,而且它似乎没有在kaggle上占据主导地位,所以它很可能没有LightGBM那么快,但我的假设可能是错误的)。所以,如果我的样本中有很多这样的东西,我就会使用它。另外两个(LightGBM和XGBoost)提供了非常相似的功能,我建议选择其中一个,并将其放在最上面。目前,在CPU上,LightGBM在训练时间上似乎优于XGBoost,提供了非常可比的预测精度。例如,请参阅GBM-perf beachmark on github或this in-depth analysis。如果你有可用的图形处理器,那么实际上,根据上面的优点判断,XGBoost似乎更可取。
通常,您可以通过以下几种方式提高模型性能:
提前停止训练时间更长(如果没有触发提前停止,这意味着仍然有推广的空间;如果是,那么您不能通过使用所选的hyper-parameters)
由于我们缩小到2个选项,我不能建议catboost超参数优化,因为我还没有实践经验。但是对于lightgbm调优,你可以阅读其中一个问题中的this官方lightgbm文档和these说明。针对LightGBM的超参数调优有很多很好的例子。我可以在kaggle上快速挖掘出我的内核:see here。我并不认为它是完美的,但这是我很容易找到的:)
发布于 2018-06-05 16:49:44
你可以使用套索或脊线,这些方法可以提高性能。
对于超参数调优,可以使用循环。迭代值并检查您从何处获得最低RMSE值。
您也可以尝试堆叠集成技术。
如果你使用R,使用h20.ai包,它会得到很好的结果。
https://stackoverflow.com/questions/50695215
复制相似问题