def return_function(self, name): dataset = dir_path.split('/')[1] self.label = name + '-OCR-noisy' if recordsExists(self.file, dataset, self.label, self.severity, self.noise_type): return status, score = getattr(self, 'if_' + name)() compute_time = time() - self.start bag = (self.file, dataset, self.label, self.severity, self.noise_type, status, score, compute_time, self.actual_str, self.detected_str) writeToDB(bag)
testing_activations = ['tanh', 'relu', 'selu'] for optimizer in testing_optimizers: for activation in testing_activations: if recordsExists((architecture, label, optimizer, activation)): print( "Continuing for Optimizer = {} and Activation = {}".format( optimizer, activation)) continue loss, accuracy, mae, mse = {}, {}, {}, {} train_loss_dict, train_accuracy_dict, train_mae_dict, train_mse_dict = {}, {}, {}, {} if optimizer == 'RAdam': score_returned, history = diff_optimizer(RAdam(lr=0.05), activation, label='RAdam') else: score_returned, history = diff_optimizer(optimizer, activation) bg = (score_returned[0], score_returned[1], score_returned[2], score_returned[3], history.get('loss'),\ history.get('accuracy'), history.get('mae'), history.get('mae')) #Delete Existing Primary Keys and then write to DB deleteExistingPrimaryKeyDB(optimizer, activation, architecture, label, keywords) writeToDB(optimizer, activation, architecture, bg, label, keywords) print("Completed Execution for architecture={}".format(architecture))