fix: LinearSVC results now reproducible (#1376)

Co-authored-by: Daniel Grindrod <Daniel.Grindrod@evotec.com>
This commit is contained in:
Daniel Grindrod
2024-10-31 06:02:16 +00:00
committed by GitHub
parent 72881d3a2b
commit a316f84fe1
2 changed files with 7 additions and 0 deletions

View File

@@ -2185,6 +2185,11 @@ class SVCEstimator(SKLearnEstimator):
def __init__(self, task="binary", **config):
super().__init__(task, **config)
self.params.update(
{
"random_state": config.get("random_seed", 10242048),
}
)
assert self._task.is_classification(), "LinearSVC for classification task only"
self.estimator_class = LinearSVC

View File

@@ -435,6 +435,7 @@ class TestClassification(unittest.TestCase):
# "lrl1",
"lrl2",
"rf",
"svc",
"xgboost",
"xgb_limitdepth",
],
@@ -495,6 +496,7 @@ def test_reproducibility_of_classification_models(estimator: str):
# "lgbm",
# "lrl1",
"lrl2",
"svc",
"rf",
"xgboost",
"xgb_limitdepth",