CalibratedClassifierCV gives a NotFittedError when accessing the underlying XGBoostClassifier feature_importances property

### Describe the bug

I am using CalibratedClassifierCV and XGBoost in a Pipeline and was able to train the model and use it to make predictions, etc. But I cannot access the underlying property of the XGBoost model. 


### Steps/Code to Reproduce

```
from sklearn.pipeline import Pipeline
import xgboost as xgb
from sklearn.calibration import CalibratedClassifierCV
from sklearn.datasets import make_classification

X, y = make_classification(n_features=2, n_redundant=0, n_informative=2, random_state=1, n_clusters_per_class=1)

xgb_model = xgb.XGBClassifier(n_jobs = -1,
                              objective = "binary:logistic", 
                              eval_metric = 'auc')

calibrated_xgb = CalibratedClassifierCV(base_estimator=xgb_model, cv=5, method='isotonic')

calibrated_xgb_pipeline = Pipeline(steps=[('model', calibrated_xgb)])

calibrated_xgb_pipeline.fit(X, y)

calibrated_xgb_pipeline.named_steps["model"].base_estimator.feature_importances_
```

### Expected Results

Feature importance should be returned

### Actual Results

```
---------------------------------------------------------------------------
NotFittedError                            Traceback (most recent call last)
Cell In[206], line 21
     17 calibrated_xgb_pipeline = Pipeline(steps=[('model', calibrated_xgb)])
     19 calibrated_xgb_pipeline.fit(X, y)
---> 21 calibrated_xgb_pipeline.named_steps["model"].base_estimator.feature_importances_

File ~/anaconda3/envs/python3/lib/python3.10/site-packages/xgboost/sklearn.py:1278, in XGBModel.feature_importances_(self)
   1263 @property
   1264 def feature_importances_(self) -> np.ndarray:
   1265     """Feature importances property, return depends on `importance_type`
   1266     parameter. When model trained with multi-class/multi-label/multi-target dataset,
   1267     the feature importance is "averaged" over all targets. The "average" is defined
   (...)
   1276 
   1277     """
-> 1278     b: Booster = self.get_booster()
   1280     def dft() -> str:
   1281         return "weight" if self.booster == "gblinear" else "gain"

File ~/anaconda3/envs/python3/lib/python3.10/site-packages/xgboost/sklearn.py:649, in XGBModel.get_booster(self)
    646 if not self.__sklearn_is_fitted__():
    647     from sklearn.exceptions import NotFittedError
--> 649     raise NotFittedError("need to call fit or load_model beforehand")
    650 return self._Booster

NotFittedError: need to call fit or load_model beforehand
```

### Versions

```shell
I am using sklearn 1.3.2 and xgboost 1.7.6.
```

COMMENT:
This is expected estimators passed into a meta-estimator (`CalibratedClassifierCV` in your case) are left unfitted.

You may access the fitted estimators for each split with code like this:
```py
model = calibrated_xgb_pipeline.named_steps["model"]
# calibrated classifiers on each train-test split
model.calibrated_classifiers_
# feature importances for one split
model.calibrated_classifiers_[0].estimator.feature_importances_
```

For more details you can look at https://scikit-learn.org/dev/modules/calibration.html#usage
 and https://scikit-learn.org/dev/auto_examples/calibration/plot_calibration_multiclass.html which uses the `calibrated_classifiers_` attribute.

I am going to close but feel free to reopen if you feel I haven't answered your question.

Labels: Bug, Needs Triage