使用其他模型预测结果没报错但使用xgboost却报错了Invalid missing value

XGBoostError: [01:46:49] c:\users\administrator\workspace\xgboost-win64_release_1.4.0\src\c_api\c_api_utils.h:161: Invalid missing value: null
我的测试集已经进行了空值填充,使用逻辑回归和GradientBoostingRegressor时都能正常运行,使用xgboost却有以上错误,是怎么回事呀?

xlf = xgb.XGBRegressor(max_depth=10,

    learning_rate=0.1,

    n_estimators=10,

    silent=True,

    objective='reg:linear',

    nthread=-1,

    gamma=0,

    min_child_weight=1,

    max_delta_step=0,

    subsample=0.85,

    colsample_bytree=0.7,

    colsample_bylevel=1,

    reg_alpha=0,

    reg_lambda=1,

    scale_pos_weight=1,

    seed=1440,

    missing=None)

    prob3=xlf.predict(X_test2)

解决办法:xgboost最后一个参数missing删了就行

猜你喜欢

转载自blog.csdn.net/weixin_48419914/article/details/121952974