TransWikia.com

XGBoost Predictions all the same

Data Science Asked by OptimusPrime on March 22, 2021

When I evaluate the model I seem to be getting a decent RMSE score but when I try to actually see the predictions when I call the model all my values are the same.

 xdata = xgboost.DMatrix(X_train, y_train, feature_names=all_vars)
 xdata_val = xgboost.DMatrix(X_valid, y_valid, feature_names=all_vars)
 xgb_parms['seed'] = random.randint(0,1e9)
 model = xgboost.train(xgb_parms, xdata)
 model.eval(xdata_val)
 ypred = model.predict(xdata_val)

I believe the error is on my last step, what am I doing wrong?

One Answer

Make sure to pass the model an "objective" parameter and also use "rmse" for the "eval_metric" parameter.

https://github.com/dmlc/xgboost/blob/master/doc/parameter.rst

Answered by bbennett36 on March 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP