Passed
Push — master ( 193da7...4bb259 )
by Simon
01:36 queued 11s
created

HyperactiveMemory.dump()   A

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 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