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

search_space_optional   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 13
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A SearchSpace.__call__() 0 2 1
A SearchSpace.__init__() 0 6 2
1
import numpy as np
2
from hyperactive import BaseSearchSpace
3
4
5
"""
6
Optional:
7
8
It might make sense to use a class instead of a dictionary for the search-space.
9
The search-space can have specifc properties, that can be computed from the params (previously called search-space-dictionary).
10
The search-space can have a certain size, has n dimensions, some of which are numeric, some of which are categorical.
11
"""
12
13
14
class SearchSpace:
15
    search_space: dict = None
16
17
    def __init__(self, **params):
18
        super().__init__()
19
20
        for key, value in params.items():
21
            setattr(self, key, value)
22
            self.search_space[key] = value
23
24
    def __call__(self):
25
        return self.search_space
26