Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Adding offset variable during training #558

Open
HoShilo opened this issue Jul 2, 2024 · 1 comment
Open

Question: Adding offset variable during training #558

HoShilo opened this issue Jul 2, 2024 · 1 comment

Comments

@HoShilo
Copy link

HoShilo commented Jul 2, 2024

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_margin argument.

I looked into the init_score of the fit method, 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
Copy link
Collaborator

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 base_margin 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants