| Total Complexity | 4 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # Author: Simon Blanke |
||
| 2 | # Email: [email protected] |
||
| 3 | # License: MIT License |
||
| 4 | |||
| 5 | |||
| 6 | import os |
||
| 7 | |||
| 8 | from hypermemory import Hypermemory |
||
| 9 | |||
| 10 | |||
| 11 | def meta_data_path(): |
||
| 12 | current_path = os.path.realpath(__file__) |
||
| 13 | return current_path.rsplit("/", 1)[0] + "/meta_data/" |
||
| 14 | |||
| 15 | |||
| 16 | class HyperactiveMemory(Hypermemory): |
||
| 17 | def __init__(self, X, y, model, search_space): |
||
| 18 | super().__init__(X, y, search_space) |
||
| 19 | self.meta_data_path = meta_data_path() |
||
| 20 | |||
| 21 | def load(self): |
||
| 22 | df = self.read_csv() |
||
| 23 | df = self.hash2objects(df) |
||
| 24 | df = self.df_para2pos(df) |
||
| 25 | memory = self.df2dict(df) |
||
| 26 | |||
| 27 | return memory |
||
| 28 | |||
| 29 | def dump(self, memory): |
||
| 30 | df = self.dict2df(memory) |
||
| 31 | df = self.df_pos2para(df) |
||
| 32 | df = self.objects2hash(df) |
||
| 33 | self.save_to_csv(df) |
||
| 34 |