| Total Complexity | 2 |
| Total Lines | 58 |
| Duplicated Lines | 72.41 % |
| 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 | |||
| 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__( |
|
|
|
|||
| 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 | ) |
||
| 60 |