From abf012da7ef07bee95c84bccca3514942eadcd07 Mon Sep 17 00:00:00 2001 From: Simon Blanke Date: Mon, 29 Apr 2024 20:25:05 +0200 Subject: [PATCH] add explicit class init-arguments --- src/surfaces/test_functions/_base_test_function.py | 2 +- .../machine_learning/tabular_classifiers.py | 9 +++++++-- .../mathematical/_base_objective_function.py | 5 ++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/surfaces/test_functions/_base_test_function.py b/src/surfaces/test_functions/_base_test_function.py index a1c2429..3cd1054 100644 --- a/src/surfaces/test_functions/_base_test_function.py +++ b/src/surfaces/test_functions/_base_test_function.py @@ -20,7 +20,7 @@ class BaseTestFunction: objective_function: callable pure_objective_function: callable - def __init__(self, metric, sleep=0, evaluate_from_data=False): + def __init__(self, metric, sleep, evaluate_from_data): self.sleep = sleep self.metric = metric diff --git a/src/surfaces/test_functions/machine_learning/tabular_classifiers.py b/src/surfaces/test_functions/machine_learning/tabular_classifiers.py index cd459d0..afec37b 100644 --- a/src/surfaces/test_functions/machine_learning/tabular_classifiers.py +++ b/src/surfaces/test_functions/machine_learning/tabular_classifiers.py @@ -20,8 +20,13 @@ class KNeighborsClassifierFunction(MachineLearningFunction): cv_default = [2, 3, 4, 5, 8, 10] dataset_default = [digits_data, wine_data, iris_data] - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) + def __init__( + self, + metric="loss", + sleep=0, + evaluate_from_data=False, + ): + super().__init__(metric, sleep, evaluate_from_data) def search_space( self, diff --git a/src/surfaces/test_functions/mathematical/_base_objective_function.py b/src/surfaces/test_functions/mathematical/_base_objective_function.py index 2d1de25..c8f069a 100644 --- a/src/surfaces/test_functions/mathematical/_base_objective_function.py +++ b/src/surfaces/test_functions/mathematical/_base_objective_function.py @@ -17,13 +17,12 @@ class MathematicalFunction(BaseTestFunction): def __init__( self, - *args, metric="loss", input_type="dictionary", sleep=0, - **kwargs, + evaluate_from_data=False, ): - super().__init__(*args, metric, **kwargs) + super().__init__(metric, sleep, evaluate_from_data) self.metric = metric self.input_type = input_type