diff --git a/python/naiveautoml/algorithm_selection/_sklearn_factory.py b/python/naiveautoml/algorithm_selection/_sklearn_factory.py index b01a5cf..afac376 100644 --- a/python/naiveautoml/algorithm_selection/_sklearn_factory.py +++ b/python/naiveautoml/algorithm_selection/_sklearn_factory.py @@ -662,6 +662,10 @@ def score_func(X, y): if clazz == sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis: return sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis(**params) + if clazz == sklearn.linear_model.LogisticRegression: + params["dual"] = check_for_bool(params["dual"]) + return sklearn.linear_model.LogisticRegression(**params) + if clazz == sklearn.neural_network.MLPClassifier: max_iter = 512 # hard coded in auto-sklearn hidden_layer_depth = int(params["hidden_layer_depth"]) diff --git a/python/naiveautoml/searchspace-classification.json b/python/naiveautoml/searchspace-classification.json index bcced3b..88364c7 100644 --- a/python/naiveautoml/searchspace-classification.json +++ b/python/naiveautoml/searchspace-classification.json @@ -1300,6 +1300,43 @@ "json_format_version": 0.2 } }, + { + "class": "sklearn.linear_model.LogisticRegression", + "params": { + "hyperparameters": [ + { + "name": "penalty", + "type": "categorical", + "choices": [ + "l1", + "l2", + "elasticnet", + "None" + ], + "default": "l2" + }, + { + "name": "dual", + "type": "categorical", + "choices": [ + "True", + "False" + ], + "default": "False" + }, + { + "name": "C", + "type": "uniform_float", + "log": true, + "lower": 0.03125, + "upper": 32768.0, + "default": 1.0 + } + ], + "conditions": [], + "forbiddens": [] + } + }, { "class": "sklearn.neural_network._multilayer_perceptron.MLPClassifier", "params": { diff --git a/python/naiveautoml/searchspace-regression.json b/python/naiveautoml/searchspace-regression.json index db648be..9f29b7b 100644 --- a/python/naiveautoml/searchspace-regression.json +++ b/python/naiveautoml/searchspace-regression.json @@ -941,7 +941,7 @@ "name": "alpha", "type": "uniform_float", "log": true, - "lower": 1e-14, + "lower": 1e-10, "upper": 1.0, "default": 1e-08 }, diff --git a/python/requirements.txt b/python/requirements.txt index 5c6b274..232ce09 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -1,7 +1,7 @@ numpy<2.0.0 pandas scikit-learn>=1.3 -configspace<0.7.1 +configspace==1.2 scipy pynisher psutil diff --git a/python/test/test_naiveautoml.py b/python/test/test_naiveautoml.py index 197e3a2..50306e6 100644 --- a/python/test/test_naiveautoml.py +++ b/python/test/test_naiveautoml.py @@ -298,7 +298,7 @@ def test_constant_algorithms_in_hpo_phase(self): field = f"{step}_class" class_in_phase1 = best_solution_in_phase_1[field] class_in_phase2 = pd.unique(history[field])[0] - self.assertEquals( + self.assertEqual( class_in_phase1, class_in_phase2, f"Choice for {step} should conicide but is {class_in_phase1} in AS phase and {class_in_phase2} in HPO."