Reset_index可提高模型的准确性

时间:2019-05-06 09:34:13

标签: python scikit-learn lightgbm

请你能帮我吗?我已经对线性数据进行了预处理和标准化。我将LightGBM用作数据的线性回归模型。我必须预测具有其他功能的连续值“ Montant”。当我预测样本“ Montant”时,我的准确性为58%。但是,当我在“ X_train”和“ X_test”上使用“ reset_index()”方法时,在训练和预测阶段,模型的准确性提高到80%。指数真的重要吗?我应该使用它来提高准确性吗?

这是我用于训练和预测阶段的代码:

params = {
'boosting_type': 'gbdt', 'objective': 'tweedie', 'nthread': -1, 'verbose': 0,'num_iterations':276,
'num_leaves': 95, 'learning_rate': 0.036, 'max_depth': -1,
'subsample': 0.678, 'subsample_freq': -100, 'colsample_bytree': 0.524, 
'reg_alpha': 1.201, 'reg_lambda': 0.00001, 'metric': 'rmse',
'min_split_gain': 0.5, 'min_child_weight': 1, 'min_child_samples': 35, 'scale_pos_weight': 1}

#kf = KFold(n_splits=5, shuffle=True, random_state=seed_val)
pred_test_y = np.zeros(X_test.shape[0])

train_set = lgbm.Dataset(X_train.reset_index(), y_train, silent=True)

lgbm1 = lgbm.train(params, train_set=train_set, num_boost_round=180)
pred_test_y = lgbm1.predict(X_test.reset_index(), num_iteration = lgbm1.best_iteration)

0 个答案:

没有答案