Get Probability From Xgb.train()
I am new to Python and Machine learning. I have searched internet regarding my question and tried the solution people have suggested, but still not get it. Would really appreciate
Solution 1:
So based on my understanding, you are trying to obtain the probability for each class in the prediction phase. Two options.
It seems that you are using the XGBoost native api. Then just select the
'objective':'multi:softprob'
as the parameter, and use thebst_constr.predict
instead ofbst_constr.predict_proba
.XGBoost also provides the scikit-learn api. But then you should initiate the model with
bst_constr = xgb.XGBClassifier(**params_constr)
, and usebst_constr.fit()
for training. Then you can call thebst_constr.predict_proba
to obtain what you want. You can refer here for more details Scikit-Learn API in XGBoost.
Post a Comment for "Get Probability From Xgb.train()"