Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, path):
# base info
self.path = os.path.abspath(path)
self.logic = Logic(self.path)
# model related data
self.model = None
self.accu = None
self.model_path = os.path.join(self.path, 'model.yml')
self.weights_path = os.path.join(self.path, 'model.h5')
self.fdeep_path = os.path.join(self.path, 'model.fdeep')
# training related data
self.dataset = Dataset(self.path)
self.txt_stats_path = os.path.join(self.path, 'stats.txt')
self.json_stats_path = os.path.join(self.path, 'stats.json')
self.history_path = os.path.join(self.path, 'history.json')
self.classes_path = os.path.join(self.path, 'classes.json')
self.history = None
self.classes = None
self.what = {
'train' : "Training --------------------------------------------\n",
'val' : "Validation ------------------------------------------\n",
'test' : "Test ------------------------------------------------\n"
}
def _set_xys(self, for_training = True):
if for_training:
self.X_train, self.Y_train = Dataset.split_row(self.train, self.n_labels, self.is_flat)
self.X_test, self.Y_test = Dataset.split_row(self.test, self.n_labels, self.is_flat)
self.X_val, self.Y_val = Dataset.split_row(self.validation, self.n_labels, self.is_flat)
else:
self.X, self.Y = Dataset.split_row(self.train, self.n_labels, self.is_flat)