Leaf Values to Probability Conversion


I created a binary classification tree in python with XGboost and converted sum of leaf values to probability using logistic function.

The values are matching with XGboost predict proba function results when the base_score is 0.5.

When I change the base_score to any other value the my calculation doesn’t match with the result from predict proba function.

I have gone through other questions and found that we have to manually add the base_score value to the sum of the leaf values but still the result doesn’t match. Could you explain why ?


I solved this problem myself temporarily. The values are not matching because of float-32 conversion. Once I make everything to float 32 the values are matching. No need to add base_score to the sum of leaf values after sufficient number of iterations.

Question to the authors: when my features are rounded to 4 digit precision, why _Booster.dump_model is giving nodes(splits) with 6 decimal places?