interpretml / interpret

Fit interpretable models. Explain blackbox machine learning.
https://interpret.ml/docs
MIT License
6.15k stars 725 forks source link

Question: Adding offset variable during training #558

Closed HoShilo closed 23 hours ago

HoShilo commented 2 weeks ago

While training an EBM regressor/classifier, is it possible to integrate an offset variable as in GLM/GAM? By offset, I mean a fixed effect variable that is added to the additive formula. For instance, in XGBOOST, this is implemented with the base_marginargument.

I looked into the init_scoreof the fitmethod, but I don't think it serves the same purpose. From my understanding, it doesn't pass through the link function. It is easy to bypass this with identity or log link functions (just subtract or divide y before the fit by offset or exp(offset) respectively), but with classifiers (logit link), it is less straightforward how to approach this.

paulbkoch commented 2 weeks ago

Hi @HoShilo --

init_score is the right approach, and it gets added to the additive scores from the other features before applying the inverse link during prediction. If you had a more complicated model, then you would need to use the init_score on the predict function during prediction in addition to using it during fitting. For adding a constant basemargin though, I would just add that value to the intercept attribute on the EBM after fitting, which will have the same effect, but is simpler.