diff --git a/examples/hyperactive_intro.ipynb b/examples/hyperactive_intro.ipynb index 7ccb6025..222d5e30 100644 --- a/examples/hyperactive_intro.ipynb +++ b/examples/hyperactive_intro.ipynb @@ -48,15 +48,11 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "59dd4715", "metadata": {}, "outputs": [], - "source": [ - "from hyperactive.experiment.toy import Parabola\n", - "\n", - "parabola = Parabola(42, 3, 4)" - ] + "source": "from hyperactive.experiment.bench import Parabola\n\nparabola = Parabola(42, 3, 4)" }, { "cell_type": "markdown", diff --git a/examples/optimization_techniques/grid_search_sk.py b/examples/optimization_techniques/grid_search_sk.py index 9a2d74a6..ccb084c6 100644 --- a/examples/optimization_techniques/grid_search_sk.py +++ b/examples/optimization_techniques/grid_search_sk.py @@ -7,9 +7,9 @@ import numpy as np from hyperactive.opt import GridSearchSk -from hyperactive.experiment.toy import Sphere +from hyperactive.experiment.bench import Sphere -# Define the optimization problem using a toy sphere function +# Define the optimization problem using a benchmark sphere function # The sphere function f(x,y) = x² + y² has its minimum at (0,0) sphere_experiment = Sphere(n_dim=2) @@ -29,5 +29,5 @@ experiment=sphere_experiment, ) -best_params = grid_search.run() +best_params = grid_search.solve() print(f"Best params: {best_params}, Score: {grid_search.best_score_:.6f}") diff --git a/src/hyperactive/experiment/bench/__init__.py b/src/hyperactive/experiment/bench/__init__.py new file mode 100644 index 00000000..3081e5a1 --- /dev/null +++ b/src/hyperactive/experiment/bench/__init__.py @@ -0,0 +1,11 @@ +"""Benchmark experiments.""" + +from hyperactive.experiment.bench._ackley import Ackley +from hyperactive.experiment.bench._parabola import Parabola +from hyperactive.experiment.bench._sphere import Sphere + +__all__ = [ + "Ackley", + "Parabola", + "Sphere", +] diff --git a/src/hyperactive/experiment/toy/_ackley.py b/src/hyperactive/experiment/bench/_ackley.py similarity index 98% rename from src/hyperactive/experiment/toy/_ackley.py rename to src/hyperactive/experiment/bench/_ackley.py index deb246f2..04a693b3 100644 --- a/src/hyperactive/experiment/toy/_ackley.py +++ b/src/hyperactive/experiment/bench/_ackley.py @@ -38,7 +38,7 @@ class Ackley(BaseExperiment): Example ------- - >>> from hyperactive.experiment.toy import Ackley + >>> from hyperactive.experiment.bench import Ackley >>> ackley = Ackley(a=20) >>> params = {"x0": 1, "x1": 2} >>> score, add_info = ackley.score(params) diff --git a/src/hyperactive/experiment/toy/_parabola.py b/src/hyperactive/experiment/bench/_parabola.py similarity index 97% rename from src/hyperactive/experiment/toy/_parabola.py rename to src/hyperactive/experiment/bench/_parabola.py index 0880dcf3..dbdf4728 100644 --- a/src/hyperactive/experiment/toy/_parabola.py +++ b/src/hyperactive/experiment/bench/_parabola.py @@ -32,7 +32,7 @@ class Parabola(BaseExperiment): Example ------- - >>> from hyperactive.experiment.toy import Parabola + >>> from hyperactive.experiment.bench import Parabola >>> parabola = Parabola(a=1.0, b=0.0, c=0.0) >>> params = {"x": 1, "y": 2} >>> score, add_info = parabola.score(params) diff --git a/src/hyperactive/experiment/toy/_sphere.py b/src/hyperactive/experiment/bench/_sphere.py similarity index 98% rename from src/hyperactive/experiment/toy/_sphere.py rename to src/hyperactive/experiment/bench/_sphere.py index 9f415e1a..5df7990f 100644 --- a/src/hyperactive/experiment/toy/_sphere.py +++ b/src/hyperactive/experiment/bench/_sphere.py @@ -35,7 +35,7 @@ class Sphere(BaseExperiment): Example ------- - >>> from hyperactive.experiment.toy import Sphere + >>> from hyperactive.experiment.bench import Sphere >>> sphere = Sphere(const=0, n_dim=3) >>> params = {"x0": 1, "x1": 2, "x2": 3} >>> score, add_info = sphere.score(params) diff --git a/src/hyperactive/experiment/toy/__init__.py b/src/hyperactive/experiment/toy/__init__.py deleted file mode 100644 index 0835e62c..00000000 --- a/src/hyperactive/experiment/toy/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Toy experiments.""" - -from hyperactive.experiment.toy._ackley import Ackley -from hyperactive.experiment.toy._parabola import Parabola -from hyperactive.experiment.toy._sphere import Sphere - -__all__ = [ - "Ackley", - "Parabola", - "Sphere", -] diff --git a/src/hyperactive/opt/_adapters/_gfo.py b/src/hyperactive/opt/_adapters/_gfo.py index 9d0ca8f1..5edd81c9 100644 --- a/src/hyperactive/opt/_adapters/_gfo.py +++ b/src/hyperactive/opt/_adapters/_gfo.py @@ -189,7 +189,7 @@ def get_test_params(cls, parameter_set="default"): "n_iter": 100, } - from hyperactive.experiment.toy import Ackley + from hyperactive.experiment.bench import Ackley ackley_exp = Ackley.create_test_instance() params_ackley = { diff --git a/src/hyperactive/opt/gridsearch/_sk.py b/src/hyperactive/opt/gridsearch/_sk.py index 39c6e9b1..8c0cd51c 100644 --- a/src/hyperactive/opt/gridsearch/_sk.py +++ b/src/hyperactive/opt/gridsearch/_sk.py @@ -214,7 +214,7 @@ def get_test_params(cls, parameter_set="default"): "param_grid": param_grid, } - from hyperactive.experiment.toy import Ackley + from hyperactive.experiment.bench import Ackley ackley_exp = Ackley.create_test_instance() param_grid = { diff --git a/src/hyperactive/opt/random_search.py b/src/hyperactive/opt/random_search.py index 4d29c24b..e6b1d40c 100644 --- a/src/hyperactive/opt/random_search.py +++ b/src/hyperactive/opt/random_search.py @@ -202,9 +202,9 @@ def _solve( @classmethod def get_test_params(cls, parameter_set: str = "default"): - """Provide deterministic toy configurations for unit tests.""" + """Provide deterministic benchmark configurations for unit tests.""" + from hyperactive.experiment.bench import Ackley from hyperactive.experiment.integrations import SklearnCvExperiment - from hyperactive.experiment.toy import Ackley # 1) ML example (Iris + SVC) sklearn_exp = SklearnCvExperiment.create_test_instance()