Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
3 changes: 3 additions & 0 deletions flaml/automl/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2450,6 +2450,9 @@ def config2params(self, config: dict) -> dict:

def __init__(self, task="binary", **config):
super().__init__(task, **config)
random_seed = self.params.pop("random_seed", config.get("random_seed", 10242048))
if "random_state" not in self.params:
self.params["random_state"] = random_seed
if self._task.is_classification():
self.estimator_class = SGDClassifier
elif self._task.is_regression():
Expand Down
4 changes: 4 additions & 0 deletions test/automl/test_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ def test_sparse_matrix_lr(self):
# "lrl1",
"lrl2",
"rf",
"sgd",
"svc",
"xgboost",
"xgb_limitdepth",
Expand Down Expand Up @@ -498,6 +499,9 @@ def test_reproducibility_of_classification_models(estimator: str):
"lrl2",
"svc",
"rf",
# "sgd" omitted: SGDEstimator wraps the sklearn model with a Normalizer
# preprocessing step that this test's helper does not replicate, so the
# bare underlying model cannot match the FLAML wrapper's CV result.
Comment thread
thinkall marked this conversation as resolved.
Outdated
Comment thread
thinkall marked this conversation as resolved.
Outdated
Comment thread
immu4989 marked this conversation as resolved.
Outdated
"xgboost",
"xgb_limitdepth",
],
Expand Down
4 changes: 4 additions & 0 deletions test/automl/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ def test_multioutput():
"kneighbor",
"lgbm",
"rf",
"sgd",
"xgboost",
"xgb_limitdepth",
],
Expand Down Expand Up @@ -407,6 +408,9 @@ def test_reproducibility_of_lgbm_regression_model():
"kneighbor",
"lgbm",
"rf",
# "sgd" omitted: SGDEstimator wraps the sklearn model with a Normalizer
# preprocessing step that this test's helper does not replicate, so the
# bare underlying model cannot match the FLAML wrapper's CV result.
Comment thread
thinkall marked this conversation as resolved.
Outdated
Comment thread
thinkall marked this conversation as resolved.
Outdated
Comment thread
immu4989 marked this conversation as resolved.
Outdated
"xgboost",
"xgb_limitdepth",
],
Expand Down
Loading