diff --git a/flaml/automl/model.py b/flaml/automl/model.py index c5276e1572..7f11502c6d 100644 --- a/flaml/automl/model.py +++ b/flaml/automl/model.py @@ -1970,8 +1970,6 @@ def config2params(self, config: dict) -> dict: params["max_leaf_nodes"] = params.get("max_leaf_nodes", params.pop("max_leaves")) if not self._task.is_classification() and "criterion" in params: params.pop("criterion") - if "random_state" not in params: - params["random_state"] = 12032022 return params def __init__( @@ -1981,6 +1979,9 @@ def __init__( ): super().__init__(task, **params) self.params["verbose"] = 0 + random_seed = self.params.pop("random_seed", params.get("random_seed", 12032022)) + if "random_state" not in self.params: + self.params["random_state"] = random_seed if self._task.is_classification(): self.estimator_class = RandomForestClassifier