Completed
Push — master ( d45822...88a105 )
by Simon
01:43
created

hyperactive.memory.memory_io.MemoryIO._read_dill()   A

Complexity

Conditions 3

Size

Total Lines 9
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 8
nop 2
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
# Author: Simon Blanke
2
# Email: [email protected]
3
# License: MIT License
4
5
import os
6
7
from .util import get_model_id, _hash2obj
8
from .paths import (
9
    get_meta_path,
10
    get_model_path,
11
    get_date_path,
12
    get_datetime,
13
    get_meta_data_name,
14
)
15
16
17
class MemoryIO:
18
    def __init__(self, _space_, _main_args_, _cand_):
19
        self._space_ = _space_
20
        self._main_args_ = _main_args_
21
22
        self.meta_data_name = get_meta_data_name(_main_args_.X, _main_args_.y)
23
        self.score_col_name = "_score_"
24
25
        model_id = get_model_id(_cand_.func_)
26
        self.datetime = get_datetime()
27
28
        self.meta_path = get_meta_path()
29
        self.model_path = self.meta_path + get_model_path(model_id)
30
        self.date_path = self.model_path + get_date_path(self.datetime)
31
32
        self.dataset_info_path = self.model_path + "dataset_info/"
33
34
        if not os.path.exists(self.date_path):
35
            os.makedirs(self.date_path, exist_ok=True)
36
37
        self.hash2obj = _hash2obj(_space_.search_space, self.model_path)
38