-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Hi
I've been learning how to use this great package. One thing I like using in lightGBM is the pred_contrib=True argument at prediction time.
I notice if we run model.booster.predict(data, pred_contrib=True) this does generate data of the expected shape (n_features + 1) * (n_distributional_parameters).
However when I try and sum the contributions from each feature, this does not result in the same result as that which is generated when we call predict.
I believe this is due to the logic within the distribution class that occurs after booster.predict
EDIT: Upon more reading I realize that it is not always possible to decompose in such a way, as a function is called on each component, such that the sum of the function call on each component is not the same as the function call on the sum of the components.
However in the case of the identity function it is. In this case the difference seems to come from setting of the init score that is applied before the distribution function is called.
In lightGBM this is also an issue with Classifiers where the prediction_contributions are returned in logit_space.
Therefore in lightGBMLSS, pred_contrib could be supported, but when it is the distributional functions are not applied.