MAPIE icon indicating copy to clipboard operation
MAPIE copied to clipboard

The base model does not seem to be accepted by MapieQuantileRegressor

Open masakljun opened this issue 2 years ago • 2 comments

Describe the bug I am trying to use my XGBoost model in combination with MapieQuantileRegressor. However, the error below comes up when I try to set estimator = my_xgboost_model

To Reproduce Steps to reproduce the behavior:

  1. After the code I use (see screenshot below), this is the error that comes up.
  2. ValueError: The base model does not seem to be accepted by MapieQuantileRegressor. Give a base model among: quantile_estimator_params.keys()Or, add your base model to quantile_estimator_params.

Expected behavior I see from the error that I should somehow add my model to the quantile_estimator_params, but I don't know how to do that.

Screenshots The relevant part of the code: image

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • MAPIE Version: 0.4.1

Thanks for the help!

masakljun avatar Jul 11 '22 06:07 masakljun

Hey @masakljun! It's important that for MapieQuantileRegressor you provide an estimator that can perform quantile regression. As such, I would suggest using LGBMRegressor(objective='quantile', alpha=0.5) or GradientBoostingRegressor(loss="quantile).

If you need to use XGBRegressor, you need to implement a quantile method as suggested in this article. Note that you would need to fit a wrapper on this method and add it to the MapieQuantileRegressor().quantile_estimator_params by defining the loss_name and alpha_name for that estimator.

LacombeLouis avatar Jul 11 '22 12:07 LacombeLouis

Ok, thanks for the clarification and help!

masakljun avatar Jul 12 '22 06:07 masakljun