Skip to content

Commit 4dc2de8

Browse files
authored
fix: LRL1 results now reproducible (#1546)
1 parent 1959d2f commit 4dc2de8

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

flaml/automl/model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,6 +2032,9 @@ def config2params(self, config: dict) -> dict:
20322032

20332033
def __init__(self, task="binary", **config):
20342034
super().__init__(task, **config)
2035+
random_seed = self.params.pop("random_seed", config.get("random_seed", 10242048))
2036+
if "random_state" not in self.params:
2037+
self.params["random_state"] = random_seed
20352038
assert self._task.is_classification(), "LogisticRegression for classification task only"
20362039
self.estimator_class = LogisticRegression
20372040

test/automl/test_classification.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def test_sparse_matrix_lr(self):
432432
"histgb",
433433
"kneighbor",
434434
"lgbm",
435-
# "lrl1",
435+
"lrl1",
436436
"lrl2",
437437
"rf",
438438
"sgd",
@@ -495,7 +495,7 @@ def test_reproducibility_of_classification_models(estimator: str):
495495
"histgb",
496496
"kneighbor",
497497
"lgbm",
498-
# "lrl1",
498+
"lrl1",
499499
"lrl2",
500500
"svc",
501501
"rf",

0 commit comments

Comments
 (0)