Passed
Pull Request — master (#101)
by Simon
01:37
created

tests.test_setup.experiment   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A SphereFunction.objective_function() 0 2 1
A SphereFunction.setup() 0 2 1
1
import numpy as np
2
3
from hyperactive.experiment import BaseExperiment
4
5
6
class SphereFunction(BaseExperiment):
7
    def setup(self, n_dim=2):
8
        self.n_dim = n_dim
9
10
    def objective_function(self, params):
11
        return np.sum(params["x0"] ** 2 + params["x1"] ** 2)
12