scikit-learn-contrib / MAPIE

A scikit-learn-compatible module to estimate prediction intervals and control risks based on conformal predictions.
https://mapie.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
1.2k stars 99 forks source link

MapieQuantileRegressor with prefit model from Keras/Tensorflow #448

Open dani-vu opened 1 month ago

dani-vu commented 1 month ago

I want to apply CQR with a customized LSTM model created with Tensorflow. However, it does not support Tensorflow models. Is there a workaround or am I missing something?

Thanks!

LacombeLouis commented 1 month ago

Hey @dani-vu, Thank you for the issue. I believe that if you use the cv="prefit" you should be able to use MapieQuantileRegressor by simply packaging your models as in the issue #340. Note that you need to fit all three models and provide them as follows:

    estimators_: List[RegressorMixin]
        - [0]: Estimator with quantile value of alpha/2
        - [1]: Estimator with quantile value of 1 - alpha/2
        - [2]: Estimator with quantile value of 0.5

Don't hesitate if you have any other question!