Skip to content

Support pred_contrib argument at predict #38

@Fish-Soup

Description

@Fish-Soup

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions