#make featuredefgetres1(row):returnlen([x for x in row.values iftype(x)==intand x<0])defgetres2(row):returnlen([x for x in row.values iftype(x)==intand x==-8])defgetres3(row):returnlen([x for x in row.values iftype(x)==intand x==-1])defgetres4(row):returnlen([x for x in row.values iftype(x)==intand x==-2])defgetres5(row):returnlen([x for x in row.values iftype(x)==intand x==-3])#调查问卷有效程度
data['neg1']= data[data.columns].apply(lambda row:getres1(row),axis=1)
data.loc[data['neg1']>20,'neg1']=20#平滑处理print(data)
fold n°1
[LightGBM] [Warning] min_data_in_leaf is set=40, min_child_samples=30 will be ignored. Current value: min_data_in_leaf=40
Training until validation scores don't improve for 200 rounds
[200] training's l2: 0.0178584 valid_1's l2: 0.440415
Early stopping, best iteration is:
[53] training's l2: 0.17148 valid_1's l2: 0.42822
fold n°2
[LightGBM] [Warning] min_data_in_leaf is set=40, min_child_samples=30 will be ignored. Current value: min_data_in_leaf=40
Training until validation scores don't improve for 200 rounds
[200] training's l2: 0.0172029 valid_1's l2: 0.471802
Early stopping, best iteration is:
[78] training's l2: 0.112334 valid_1's l2: 0.465844
fold n°3
[LightGBM] [Warning] min_data_in_leaf is set=40, min_child_samples=30 will be ignored. Current value: min_data_in_leaf=40
Training until validation scores don't improve for 200 rounds
[200] training's l2: 0.0174407 valid_1's l2: 0.524768
Early stopping, best iteration is:
[48] training's l2: 0.184526 valid_1's l2: 0.513957
fold n°4
[LightGBM] [Warning] min_data_in_leaf is set=40, min_child_samples=30 will be ignored. Current value: min_data_in_leaf=40
Training until validation scores don't improve for 200 rounds
[200] training's l2: 0.016992 valid_1's l2: 0.509479
Early stopping, best iteration is:
[32] training's l2: 0.247561 valid_1's l2: 0.496666
fold n°5
[LightGBM] [Warning] min_data_in_leaf is set=40, min_child_samples=30 will be ignored. Current value: min_data_in_leaf=40
Training until validation scores don't improve for 200 rounds
[200] training's l2: 0.017454 valid_1's l2: 0.453909
Early stopping, best iteration is:
[44] training's l2: 0.200869 valid_1's l2: 0.441661
fold n°6
[LightGBM] [Warning] min_data_in_leaf is set=40, min_child_samples=30 will be ignored. Current value: min_data_in_leaf=40
Training until validation scores don't improve for 200 rounds
[200] training's l2: 0.0171639 valid_1's l2: 0.468323
Early stopping, best iteration is:
[60] training's l2: 0.149475 valid_1's l2: 0.462298
fold n°7
[LightGBM] [Warning] min_data_in_leaf is set=40, min_child_samples=30 will be ignored. Current value: min_data_in_leaf=40
Training until validation scores don't improve for 200 rounds
[200] training's l2: 0.0172571 valid_1's l2: 0.455683
Early stopping, best iteration is:
[39] training's l2: 0.219661 valid_1's l2: 0.447699
fold n°8
[LightGBM] [Warning] min_data_in_leaf is set=40, min_child_samples=30 will be ignored. Current value: min_data_in_leaf=40
Training until validation scores don't improve for 200 rounds
[200] training's l2: 0.0172798 valid_1's l2: 0.528483
Early stopping, best iteration is:
[32] training's l2: 0.249316 valid_1's l2: 0.507831
fold n°9
[LightGBM] [Warning] min_data_in_leaf is set=40, min_child_samples=30 will be ignored. Current value: min_data_in_leaf=40
Training until validation scores don't improve for 200 rounds
[200] training's l2: 0.0174847 valid_1's l2: 0.469453
Early stopping, best iteration is:
[47] training's l2: 0.191068 valid_1's l2: 0.450083
fold n°10
[LightGBM] [Warning] min_data_in_leaf is set=40, min_child_samples=30 will be ignored. Current value: min_data_in_leaf=40
Training until validation scores don't improve for 200 rounds
[200] training's l2: 0.0172514 valid_1's l2: 0.46314
Early stopping, best iteration is:
[74] training's l2: 0.119155 valid_1's l2: 0.456972
CV score: 0.46712643
fold n°1
[15:02:42] WARNING: C:/Users/Administrator/workspace/xgboost-win64_release_1.3.0/src/objective/regression_obj.cu:170: reg:linear is now deprecated in favor of reg:squarederror.
[15:02:42] WARNING: C:/Users/Administrator/workspace/xgboost-win64_release_1.3.0/src/learner.cc:541:
Parameters: { silent } might not be used.
This may not be accurate due to some parameters are only used in language bindings but
passed down to XGBoost core. Or some parameters are not used but slip through this
verification. Please open an issue if you find above cases.
[0] train-rmse:3.30166 valid_data-rmse:3.29464
[100] train-rmse:0.21953 valid_data-rmse:0.68739
[200] train-rmse:0.08475 valid_data-rmse:0.68507
[300] train-rmse:0.03203 valid_data-rmse:0.68482
[400] train-rmse:0.01128 valid_data-rmse:0.68479
[500] train-rmse:0.00393 valid_data-rmse:0.68485
[530] train-rmse:0.00284 valid_data-rmse:0.68485
fold n°2
[15:03:27] WARNING: C:/Users/Administrator/workspace/xgboost-win64_release_1.3.0/src/objective/regression_obj.cu:170: reg:linear is now deprecated in favor of reg:squarederror.
[15:03:27] WARNING: C:/Users/Administrator/workspace/xgboost-win64_release_1.3.0/src/learner.cc:541:
Parameters: { silent } might not be used.
This may not be accurate due to some parameters are only used in language bindings but
passed down to XGBoost core. Or some parameters are not used but slip through this
verification. Please open an issue if you find above cases.
[0] train-rmse:3.29521 valid_data-rmse:3.32372
[100] train-rmse:0.22777 valid_data-rmse:0.67676
[200] train-rmse:0.09615 valid_data-rmse:0.67418
[300] train-rmse:0.03693 valid_data-rmse:0.67489
[400] train-rmse:0.01397 valid_data-rmse:0.67483
[418] train-rmse:0.01185 valid_data-rmse:0.67480
fold n°3
[15:03:55] WARNING: C:/Users/Administrator/workspace/xgboost-win64_release_1.3.0/src/objective/regression_obj.cu:170: reg:linear is now deprecated in favor of reg:squarederror.
[15:03:55] WARNING: C:/Users/Administrator/workspace/xgboost-win64_release_1.3.0/src/learner.cc:541:
Parameters: { silent } might not be used.
This may not be accurate due to some parameters are only used in language bindings but
passed down to XGBoost core. Or some parameters are not used but slip through this
verification. Please open an issue if you find above cases.
[0] train-rmse:3.30791 valid_data-rmse:3.26841
[100] train-rmse:0.22667 valid_data-rmse:0.69967
[200] train-rmse:0.09633 valid_data-rmse:0.69768
[300] train-rmse:0.03619 valid_data-rmse:0.69823
[376] train-rmse:0.01673 valid_data-rmse:0.69829
fold n°4
[15:04:19] WARNING: C:/Users/Administrator/workspace/xgboost-win64_release_1.3.0/src/objective/regression_obj.cu:170: reg:linear is now deprecated in favor of reg:squarederror.
[15:04:19] WARNING: C:/Users/Administrator/workspace/xgboost-win64_release_1.3.0/src/learner.cc:541:
Parameters: { silent } might not be used.
This may not be accurate due to some parameters are only used in language bindings but
passed down to XGBoost core. Or some parameters are not used but slip through this
verification. Please open an issue if you find above cases.
[0] train-rmse:3.29880 valid_data-rmse:3.30782
[100] train-rmse:0.22282 valid_data-rmse:0.69518
[200] train-rmse:0.09137 valid_data-rmse:0.69019
[300] train-rmse:0.03626 valid_data-rmse:0.69060
[393] train-rmse:0.01535 valid_data-rmse:0.69049
fold n°5
[15:04:47] WARNING: C:/Users/Administrator/workspace/xgboost-win64_release_1.3.0/src/objective/regression_obj.cu:170: reg:linear is now deprecated in favor of reg:squarederror.
[15:04:47] WARNING: C:/Users/Administrator/workspace/xgboost-win64_release_1.3.0/src/learner.cc:541:
Parameters: { silent } might not be used.
This may not be accurate due to some parameters are only used in language bindings but
passed down to XGBoost core. Or some parameters are not used but slip through this
verification. Please open an issue if you find above cases.
[0] train-rmse:3.29689 valid_data-rmse:3.31607
[100] train-rmse:0.22293 valid_data-rmse:0.71063
[200] train-rmse:0.08727 valid_data-rmse:0.71013
[300] train-rmse:0.03349 valid_data-rmse:0.71038
[338] train-rmse:0.02331 valid_data-rmse:0.71032
CV score: 0.47779700