Passed
Push — master ( 4bb259...06915f )
by Simon
04:09
created

SearchProcessLongMem.__init__()   B

Complexity

Conditions 2

Size

Total Lines 42
Code Lines 37

Duplication

Lines 42
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
eloc 37
nop 13
dl 42
loc 42
rs 8.9919
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
6
import numpy as np
7
import pandas as pd
8
9
from ..candidate import CandidateShortMem
10
from .search_process_shortMem import SearchProcessShortMem
11
12
from ..results_manager import ResultsManagerMemory
13
14
15
class SearchProcessLongMem(SearchProcessShortMem):
16 View Code Duplication
    def __init__(
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
17
        self,
18
        nth_process,
19
        p_bar,
20
        model,
21
        search_space,
22
        search_name,
23
        n_iter,
24
        training_data,
25
        optimizer,
26
        n_jobs,
27
        init_para,
28
        memory,
29
        random_state,
30
    ):
31
        super().__init__(
32
            nth_process,
33
            p_bar,
34
            model,
35
            search_space,
36
            search_name,
37
            n_iter,
38
            training_data,
39
            optimizer,
40
            n_jobs,
41
            init_para,
42
            memory,
43
            random_state,
44
        )
45
46
        if not isinstance(search_name, str):
47
            search_name = str(nth_process)
48
49
        self.res = ResultsManagerMemory(search_name, model, search_space, training_data)
50
51
        self.cand = CandidateShortMem(
52
            self.model,
53
            self.training_data,
54
            self.search_space,
55
            self.init_para,
56
            self.memory,
57
            p_bar,
58
        )
59
60