| DayF core 1.2.1.2 DayF (Decision at your Fingertips) is an AutoML freeware development framework that let developers works with Machine Learning models without any idea of AI, simply taking a csv dataset and the objective column

armetadata.py
1
4
5 '''
6 Copyright (C) e2its - All Rights Reserved
7 * Unauthorized copying of this file, via any medium is strictly prohibited
8 * Proprietary and confidential
9 *
10 * This file is part of gDayF project.
11 *
12 * Written by Jose L. Sanchez <e2its.es@gmail.com>, 2016-2019
13 '''
14
15 from collections import OrderedDict
16 from copy import deepcopy
17 from json import dumps
18 from gdayf.common.utils import get_model_fw
19
20
21
22 class ArMetadata (OrderedDict):
23
24
26 def __init__(self, type_='train'):
27 OrderedDict.__init__(self)
28 self['model_id'] = None
29 self['version'] = None
30 self['type'] = type_
31 self['objective_column'] = None
32 self['workflow_id'] = None
33 self['user_id'] = None
34 self['timestamp'] = None
35 self['round'] = 1
36 self['execution_seconds'] = 0
37 self['load_path'] = None
38 self['metrics'] = OrderedDict()
39 self['normalizations_set'] = None
40 self['dataset'] = None
41 self['dataset_hash_value'] = None
42 self['data_initial'] = None
43 self['data_normalized'] = None
44 self['model_parameters'] = None
45 self['ignored_parameters'] = None
46 self['full_parameters_stack'] = None
47 self['log_path'] = None
48 self['json_path'] = None
49 self['prediction_path'] = None
50 self['predecessor'] = None
51 self['status'] = -1
52
53
56 def get_json(self):
57 return dumps(self, indent=4)
58
59
63 def copy_template(self, increment=1):
64 new_model = ArMetadata()
65 new_model['model_id'] = deepcopy(self['model_id'])
66 new_model['version'] = deepcopy(self['version'])
67 new_model['workflow_id'] = deepcopy(self['workflow_id'])
68 new_model['user_id'] = deepcopy(self['user_id'])
69 new_model['type'] = deepcopy(self['type'])
70 new_model['objective_column'] = deepcopy(self['objective_column'])
71 new_model['timestamp'] = deepcopy(self['timestamp'])
72 new_model['round'] = self['round'] + increment
73 new_model['execution_seconds'] = 0.0
74 new_model['tolerance'] = 0.0
75 new_model['predecessor'] = self['model_parameters'][get_model_fw(self)]['parameters']['model_id']['value']
76 new_model['normalizations_set'] = deepcopy(self['normalizations_set'])
77 new_model['dataset'] = deepcopy(self['dataset'])
78 new_model['dataset_hash_value'] = deepcopy(self['dataset_hash_value'])
79 new_model['data_initial'] = deepcopy(self['data_initial'])
80 new_model['data_normalized'] = deepcopy(self['data_normalized'])
81 new_model['model_parameters'] = deepcopy(self['model_parameters'])
82 new_model['ignored_parameters'] = deepcopy(self['ignored_parameters'])
83 return new_model
84
85
87 def pop(self, key, default=None):
88 return 1
89
90
92 def popitem(self, last=True):
93 return 1
94
95
96
99 def deep_ordered_copy(armetadata):
100 new_model = ArMetadata()
101 for key, value in armetadata.items():
102 if key not in ['load_path', 'json_path', 'load_path', 'prediction_path']:
103 new_model[key] = deepcopy(value)
104 else:
105 if value is not None:
106 new_model[key] = list()
107 for each_storage in armetadata[key]:
108 new_model[key].append(OrderedDict(
109 {'value': each_storage['value'],
110 'type': each_storage['type'],
111 'hash_value': each_storage['hash_value'],
112 'hash_type': each_storage['hash_type']
113 }
114 ))
115 else:
116 new_model[key] = None
117 return new_model
118
119
120 '''## Main block only for testing issues
121 if __name__ == "__main__":
122 ## Varible for testinf propouses
123 m = ArMetadata()
124 print(m.get_json())'''
125
gdayf.common.armetadata.ArMetadata.get_json
def get_json(self)
Get json format string associted to class OredredDict parameters with encoding utf-8 and indent = 4...
Definition: armetadata.py:56
gdayf.common.utils
Define all objects, functions and structs related to common utilities not associated to one concrete ...
Definition: utils.py:1
gdayf.common.armetadata.ArMetadata.popitem
def popitem(self, last=True)
Anulate popitem fetures from OrderedDict parent class Stability proposals.
Definition: armetadata.py:92
gdayf.common.armetadata.deep_ordered_copy
def deep_ordered_copy(armetadata)
Package Function getting ArMetadata and make a base copy of parameters to get an ArMetadata structure...
Definition: armetadata.py:99
gdayf.common.armetadata.ArMetadata.pop
def pop(self, key, default=None)
Anulate pop fetures from OrderedDict parent class.
Definition: armetadata.py:87
gdayf.common.armetadata.ArMetadata
Class ArMetadata manage the Analysis results structs on OrderedDict format and exportable to json...
Definition: armetadata.py:22
gdayf.common.armetadata.ArMetadata.copy_template
def copy_template(self, increment=1)
Get ArMetadata and make a base copy of main parameters to get an ArMetadata structure to be analyzed...
Definition: armetadata.py:63
gdayf.common.armetadata.ArMetadata.__init__
def __init__(self, type_='train')
The constructor Generate an empty AR class with all DayF objects elements initialized to correct type...
Definition: armetadata.py:26