MAPIE icon indicating copy to clipboard operation
MAPIE copied to clipboard

Support for LGBM Booster models

Open caeduft opened this issue 1 year ago • 1 comments

Conformal prediction in MAPIE using existing models (e.g. https://mapie.readthedocs.io/en/latest/examples_regression/1-quickstart/plot_prefit.html#sphx-glr-examples-regression-1-quickstart-plot-prefit-py) supports models which have fit and predict attributes only. However, LGBM Regression models saved to disk, either using Booster method or pickle, don't have a "fit" attribute but a "refit" attribute (https://lightgbm.readthedocs.io/en/latest/pythonapi/lightgbm.Booster.html#lightgbm.Booster.refit). Unfortunately, MAPIE seems unable to use the refit method. Therefore, at this point, an LGBM Booster instance seems to be incompatible with MAPIE.

Enabling compatibility between LGBM Booster and MAPIE could be very useful for instances where a model is reused multiple times for prediction in the future and fitting a model from scratch is not possible.

caeduft avatar Jan 19 '24 16:01 caeduft

Hey @caeduft, thank you for your message. So indeed, this is something that could be fixed using a wrapper and naming the refit method fit. Please checkout issue #340 where we give an example of this. Note that you will only be able to use a split setting.

This is indeed something we want to fix more generally by giving more examples of this in the documentation, so do not hesitate to share your code afterwards!

LacombeLouis avatar Jan 26 '24 10:01 LacombeLouis