fix: best_model_for_estimator returns inconsistent feature_importances_ compared to automl.model (#1429)

* mrl-issue1422-0513

* fix version dependency

* fix datasets version

* test completion

---------

Co-authored-by: Runlin Mu (FESCO Adecco Human Resources) <v-runlinmu@microsoft.com>
Co-authored-by: Li Jiang <bnujli@gmail.com>
This commit is contained in:
murunlin
2025-05-15 09:37:34 +08:00
committed by GitHub
parent 5107c506b4
commit 0f9420590d

View File

@@ -424,6 +424,8 @@ class AutoML(BaseEstimator):
If `model_history` was set to True, then the returned model is trained.
"""
state = self._search_states.get(estimator_name)
if state and estimator_name == self._best_estimator:
return self.model
return state and getattr(state, "trained_estimator", None)
@property