grid_search   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A sphere_function() 0 5 1
1
import numpy as np
2
3
from hyperactive import Hyperactive
4
from hyperactive.optimizers import GridSearchOptimizer
5
6
7
def sphere_function(para):
8
    x = para["x"]
9
    y = para["y"]
10
11
    return -(x * x + y * y)
12
13
14
search_space = {
15
    "x": list(np.arange(-10, 10, 0.1)),
16
    "y": list(np.arange(-10, 10, 0.1)),
17
}
18
19
opt = GridSearchOptimizer(
20
    step_size=3,
21
)
22
23
24
hyper = Hyperactive()
25
hyper.add_search(sphere_function, search_space, n_iter=1500, optimizer=opt)
26
hyper.run()
27