Completed
Push — master ( 1d68af...e525d3 )
by Simon
01:31
created

hyperactive.hyperactive_api.Hyperactive.__init__()   A

Complexity

Conditions 1

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 11
nop 8
dl 0
loc 13
rs 9.85
c 0
b 0
f 0

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
# Author: Simon Blanke
2
# Email: [email protected]
3
# License: MIT License
4
5
from .main_args import MainArgs
6
from .hyperactive_core import HyperactiveCore
7
8
9
class Hyperactive:
10
    def __init__(
11
        self,
12
        X,
13
        y,
14
        memory="long",
15
        random_state=False,
16
        verbosity=3,
17
        warnings=False,
18
        ext_warnings=False,
19
    ):
20
21
        self._main_args_ = MainArgs(
22
            X, y, memory, random_state, verbosity, warnings, ext_warnings
23
        )
24
25
    def search(
26
        self,
27
        search_config,
28
        n_iter=10,
29
        max_time=None,
30
        optimizer="RandomSearch",
31
        n_jobs=1,
32
        scheduler=None,
33
        init_config=None,
34
    ):
35
        self._main_args_.search_args(
36
            search_config, max_time, n_iter, optimizer, n_jobs, scheduler, init_config
37
        )
38
39
        core = HyperactiveCore(self._main_args_)
40
        core.run()
41
42
        self.results = core.results
43
        self.pos_list = core.pos_list
44
        # self.para_list = None
45
        self.score_list = core.score_list
46
47
        self.eval_times = core.eval_times
48
        self.iter_times = core.iter_times
49
        self.best_scores = core.best_scores
50