Skip to content

Commit

Permalink
UPD: add missing attributes + keep quantiles_ attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibault Cordier committed Jul 4, 2024
1 parent 59586a9 commit 7d053b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mapie/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,18 @@ class MapieClassifier(BaseEstimator, ClassifierMixin):
estimator_: EnsembleClassifier
Sklearn estimator that handle all that is related to the estimator.
conformity_score_function_: BaseClassificationScore
Score function that handle all that is related to conformity scores.
n_features_in_: int
Number of features passed to the fit method.
conformity_scores_: ArrayLike of shape (n_samples_train)
The conformity scores used to calibrate the prediction sets.
quantiles_: ArrayLike of shape (n_alpha)
The quantiles estimated from ``conformity_scores_`` and alpha values.
References
----------
[1] Mauricio Sadinle, Jing Lei, and Larry Wasserman.
Expand Down Expand Up @@ -741,4 +747,6 @@ def predict(
**kwargs
)

self.quantiles_ = self.conformity_score_function_.quantiles_

return y_pred, prediction_sets
3 changes: 3 additions & 0 deletions mapie/regression/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ class MapieRegressor(BaseEstimator, RegressorMixin):
estimator_: EnsembleRegressor
Sklearn estimator that handle all that is related to the estimator.
conformity_score_function_: BaseRegressionScore
Score function that handle all that is related to conformity scores.
conformity_scores_: ArrayLike of shape (n_samples_train,)
Conformity scores between ``y_train`` and ``y_pred``.
Expand Down

0 comments on commit 7d053b7

Please sign in to comment.