| Total Complexity | 2 |
| Total Lines | 54 |
| Duplicated Lines | 79.63 % |
| Changes | 0 | ||
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | # Author: Simon Blanke |
||
| 2 | # Email: [email protected] |
||
| 3 | # License: MIT License |
||
| 4 | |||
| 5 | from ..candidate import CandidateNoMem |
||
| 6 | from .search_process_base import SearchProcess |
||
| 7 | from ..results_manager import ResultsManager |
||
| 8 | |||
| 9 | |||
| 10 | class SearchProcessNoMem(SearchProcess): |
||
| 11 | View Code Duplication | def __init__( |
|
|
|
|||
| 12 | self, |
||
| 13 | nth_process, |
||
| 14 | p_bar, |
||
| 15 | model, |
||
| 16 | search_space, |
||
| 17 | search_name, |
||
| 18 | n_iter, |
||
| 19 | training_data, |
||
| 20 | optimizer, |
||
| 21 | n_jobs, |
||
| 22 | init_para, |
||
| 23 | memory, |
||
| 24 | random_state, |
||
| 25 | ): |
||
| 26 | super().__init__( |
||
| 27 | nth_process, |
||
| 28 | p_bar, |
||
| 29 | model, |
||
| 30 | search_space, |
||
| 31 | search_name, |
||
| 32 | n_iter, |
||
| 33 | training_data, |
||
| 34 | optimizer, |
||
| 35 | n_jobs, |
||
| 36 | init_para, |
||
| 37 | memory, |
||
| 38 | random_state, |
||
| 39 | ) |
||
| 40 | |||
| 41 | self.cand = CandidateNoMem( |
||
| 42 | self.model, |
||
| 43 | self.training_data, |
||
| 44 | self.search_space, |
||
| 45 | self.init_para, |
||
| 46 | self.memory, |
||
| 47 | p_bar, |
||
| 48 | ) |
||
| 49 | |||
| 50 | if not isinstance(search_name, str): |
||
| 51 | search_name = str(nth_process) |
||
| 52 | |||
| 53 | self.res = ResultsManager(search_name, model, search_space, training_data) |
||
| 54 |