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

ENH: V1 CQR docstrings #577

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions mapie_v1/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,43 +834,43 @@ def predict(

class ConformalizedQuantileRegressor:
"""
A conformal quantile regression model that generates prediction intervals
using quantile regression as the base estimator.
A model that combines quantile regression with conformal prediction to
generate reliable prediction intervals with specified coverage levels.

This approach provides prediction intervals by leveraging
quantile predictions and applying conformal adjustments to ensure coverage.
The `ConformalizedQuantileRegressor` leverages quantile regression as its
base estimator to predict conditional quantiles of the target variable,
and applies conformal adjustments to ensure prediction intervals achieve
the desired confidence levels. This approach is particularly useful in
uncertainty quantification for regression tasks.

Parameters
----------
estimator : RegressorMixin, default=QuantileRegressor()
The base quantile regression estimator used to generate point and
interval predictions.

confidence_level : Union[float, List[float]], default=0.9
estimator : Union[RegressorMixin, Pipeline,
List[Union[RegressorMixin, Pipeline]]]
The base quantile regression model(s) used to estimate the target
quantiles.
- In `fit` mode (`prefit=False`), this should be a single quantile
regression estimator (e.g., `QuantileRegressor`) or a pipeline
combining preprocessing and regression.
- In `prefit` mode (`prefit=True`), this must be a list of three
jawadhussein462 marked this conversation as resolved.
Show resolved Hide resolved
fitted quantile regression estimators, corresponding to the lower,
upper, and median quantiles. These models are expected to be
pre-trained and aligned with the target quantiles.

confidence_level : float default=0.9
The confidence level(s) for the prediction intervals, indicating the
desired coverage probability of the prediction intervals. If a float
is provided, it represents a single confidence level. If a list,
multiple prediction intervals for each specified confidence level
are returned.

conformity_score : Union[str, BaseRegressionScore], default="absolute"
The conformity score method used to calculate the conformity error.
Valid options: TODO : reference here the valid options, once the list
has been be created during the implementation.
See: TODO : reference conformity score classes or documentation

A custom score function inheriting from BaseRegressionScore may also
be provided.
desired coverage probability of the prediction intervals.

random_state : Optional[Union[int, np.random.RandomState]], default=None
A seed or random state instance to ensure reproducibility in any random
operations within the regressor.
prefit : bool, default=False
If `True`, assumes the base estimators are already fitted.
When set to `True`, the `fit` method cannot be called and the
provided estimators should be pre-trained.

Methods
-------
fit(X_train, y_train, fit_params=None) -> Self
Fits the base estimator to the training data and initializes internal
parameters required for conformal prediction.
Trains the base quantile regression estimator on the provided data.
Not applicable if `prefit=True`.

conformalize(X_conf, y_conf, predict_params=None) -> Self
Calibrates the model on provided data, adjusting the prediction
Expand Down Expand Up @@ -987,7 +987,7 @@ def conformalize(
"""
Calibrates the model on the provided data, adjusting the prediction
intervals based on quantile predictions and specified confidence
levels. This step analyzes the conformity scores and refines the
level. This step analyzes the conformity scores and refines the
intervals to ensure desired coverage.

Parameters
Expand Down
Loading