Skip to content

Commit 7e049cb

Browse files
committed
[MNT] fix formatting
1 parent 547bd56 commit 7e049cb

37 files changed

Lines changed: 168 additions & 142 deletions

docs/source/_snippets/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@pytest.fixture
1212
def simple_search_space():
13-
"""Simple search space for basic examples."""
13+
"""Provide simple search space for basic examples."""
1414
return {
1515
"x": np.arange(-5, 5, 0.1),
1616
"y": np.arange(-5, 5, 0.1),
@@ -19,7 +19,7 @@ def simple_search_space():
1919

2020
@pytest.fixture
2121
def simple_objective():
22-
"""Simple objective function for basic examples."""
22+
"""Provide simple objective function for basic examples."""
2323

2424
def objective(params):
2525
x = params["x"]

docs/source/_snippets/examples/advanced_examples.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
advanced functionality like warm starting and optimizer comparison.
55
"""
66

7-
import numpy as np
87
from sklearn.datasets import load_wine
98
from sklearn.ensemble import RandomForestClassifier
9+
1010
from hyperactive.experiment.integrations import SklearnCvExperiment
1111
from hyperactive.opt.gfo import HillClimbing
1212

1313
# Setup common fixtures for examples
1414
X, y = load_wine(return_X_y=True)
1515
experiment = SklearnCvExperiment(
1616
estimator=RandomForestClassifier(random_state=42),
17-
X=X, y=y, cv=3,
17+
X=X,
18+
y=y,
19+
cv=3,
1820
)
1921
search_space = {
2022
"n_estimators": list(range(10, 101, 10)),
@@ -24,7 +26,6 @@
2426

2527

2628
# [start:warm_starting]
27-
from hyperactive.opt.gfo import HillClimbing
2829

2930
# Previous best parameters
3031
warm_start_points = [
@@ -43,10 +44,10 @@
4344

4445
# [start:comparing_optimizers]
4546
from hyperactive.opt.gfo import (
46-
HillClimbing,
47-
RandomSearch,
4847
BayesianOptimizer,
48+
HillClimbing,
4949
ParticleSwarmOptimizer,
50+
RandomSearch,
5051
)
5152

5253
optimizers = {

docs/source/_snippets/examples/basic_examples.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import numpy as np
88

99
# [start:custom_function]
10-
import numpy as np
1110
from hyperactive.opt.gfo import HillClimbing
1211

1312

@@ -35,6 +34,7 @@ def objective(params):
3534
# [start:sklearn_tuning]
3635
from sklearn.datasets import load_wine
3736
from sklearn.ensemble import RandomForestClassifier
37+
3838
from hyperactive.experiment.integrations import SklearnCvExperiment
3939
from hyperactive.opt.gfo import HillClimbing
4040

@@ -44,7 +44,9 @@ def objective(params):
4444
# Create experiment
4545
experiment = SklearnCvExperiment(
4646
estimator=RandomForestClassifier(random_state=42),
47-
X=X, y=y, cv=3,
47+
X=X,
48+
y=y,
49+
cv=3,
4850
)
4951

5052
# Define search space

docs/source/_snippets/getting_started/bayesian_optimizer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
"""
66

77
# [start:full_example]
8-
from hyperactive.opt.gfo import BayesianOptimizer
98
# [end:full_example]
10-
119
# Need to define experiment and search_space for standalone execution
1210
import numpy as np
1311

12+
from hyperactive.opt.gfo import BayesianOptimizer
13+
1414

1515
def experiment(params):
16-
"""Simple objective function."""
16+
"""Compute simple objective function."""
1717
x = params["x"]
1818
y = params["y"]
1919
return -(x**2 + y**2)

docs/source/_snippets/getting_started/index_bayesian.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
# [start:full_example]
88
import numpy as np
9+
910
from hyperactive.opt.gfo import BayesianOptimizer
1011

1112

docs/source/_snippets/getting_started/index_custom_function.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
# [start:full_example]
88
import numpy as np
9+
910
from hyperactive.opt.gfo import HillClimbing
1011

1112

docs/source/_snippets/getting_started/index_sklearn_tuning.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
"""
66

77
# [start:full_example]
8-
from sklearn.svm import SVC
98
from sklearn.datasets import load_iris
109
from sklearn.model_selection import train_test_split
10+
from sklearn.svm import SVC
11+
1112
from hyperactive.integrations.sklearn import OptCV
1213
from hyperactive.opt.gfo import HillClimbing
1314

docs/source/_snippets/getting_started/quick_start.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
# [start:full_example]
88
import numpy as np
9+
910
from hyperactive.opt.gfo import HillClimbing
1011

1112

docs/source/_snippets/getting_started/sklearn_optcv.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
"""
66

77
# [start:full_example]
8-
from sklearn.svm import SVC
98
from sklearn.datasets import load_iris
109
from sklearn.model_selection import train_test_split
10+
from sklearn.svm import SVC
11+
1112
from hyperactive.integrations.sklearn import OptCV
1213
from hyperactive.opt.gfo import HillClimbing
1314

docs/source/_snippets/getting_started/sklearn_random_forest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# [start:full_example]
88
from sklearn.datasets import load_iris
99
from sklearn.ensemble import RandomForestClassifier
10+
1011
from hyperactive.experiment.integrations import SklearnCvExperiment
1112
from hyperactive.opt.gfo import HillClimbing
1213

0 commit comments

Comments
 (0)