def train(self, dataset): """Train the network and record the accuracy. Args: dataset (str): Name of dataset to use. """ if self.accuracy == 0.: self.accuracy = train_and_score(self.network, dataset)
def train(self, valid, i): """Train the network and record the accuracy. """ if self.accuracy == 0.: self.avg_accuracy, self.accuracy = train_and_score( self.network, self.B, valid, i)
def train(self, config, x_train=None, y_train=None, x_test=None, y_test=None): """Train the network and record the accuracy. Args: config (str): instance of Config. """ self.model_type = config.model_type if self.accuracy == 0.: score, _ = train_and_score(config, self, x_train=x_train, y_train=y_train, x_test=x_test, y_test=y_test) self.accuracy = score[1] print('\n\nACC: %.4f\n\n' % score[1]) if config.verbose == 1: self.log(score) elif config.verbose == 2 and config.min_acc <= score[1]: self.log(score) if config.min_acc <= score[1]: network_to_json(self)
def train(self): """Train the network and record the mse. Args: dataset (str): Name of dataset to use. """ if self.score == 0.: self.score = train_and_score(self.network)
def apply_crossval(x, y, Y, model, n_folds=10): skf = StratifiedKFold(n_splits=n_folds, shuffle=True, random_state=1) c = 0 log_dir = config.tb_log_dir scores = [] for train, test in skf.split(x, Y): print("Running Fold", c + 1, "/", n_folds) if log_dir: config.tb_log_dir = os.path.join(log_dir, 'fold%d' % (c)) keras_model = utils.json_to_model(model, config) score, _ = train_and_score(config, model=keras_model, x_train=x[test], y_train=y[test], x_test=x[train], y_test=y[train]) K.clear_session() # clear model print('Acc: %.2f%% \nLoss: %.2f' % (score[1] * 100, score[0])) scores.append(score[1] * 100) logging.info('*' * 60) logging.info(score) logging.info('*' * 60) c += 1 mean = np.mean(scores) std = np.std(scores) logging.info('Mean %f' % mean) logging.info('Std %f' % std) print('Acc: %.2f%% \t Std: %.2f' % (mean, std))
def train(self, dataset, nepochs): """Train the network and record the accuracy.` """ if self.accuracy == 0.: acc, a_e = train_and_score(self.network, dataset, nepochs) self.accuracy = acc self.acc_epoch = a_e
def train(self): """ Train the network and record the accuracy. :return: """ if self.accuracy == 0.: self.accuracy = train_and_score(self.network)
def train(self, trainingset): """Train the genome and record the accuracy. Args: trainingset (str): Name of dataset to use. """ if self.accuracy == 0.0: #don't bother retraining ones we already trained self.accuracy = train_and_score(self, trainingset)
def train(self, trainingset): """Train the genome and record the accuracy. Args: trainingset (str): Name of dataset to use. """ if self.r == -1.0: self.r = train_and_score(self.geneparam, trainingset)
def train(self, x_train, y_train, x_val, y_val, x_test, y_test, batch_size): """Train the network and record the accuracy. Args: dataset (str): Name of dataset to use. """ if self.loss == 0.: self.loss = train_and_score(self.network, x_train, y_train, x_val, y_val, x_test, y_test, batch_size)
def train(config, path, x_train=None, y_train=None, x_test=None, y_test=None): model = json_to_model(path, config) score, h = train_and_score(config, model=model, x_train=x_train, y_train=y_train, x_test=x_test, y_test=y_test) return score, h
def train(self, dataset): """Realiza o treinamento da rede e retorna a acurĂ¡cia da mesma. Args: dataset (str): path do dataset (conjunto de teste) """ print(dataset) if self.accuracy == 0.: self.accuracy = train_and_score(self.network, dataset)
def train(self, dataset, skip_real_train=False): """Train the network and record the accuracy. Args: dataset (str): Name of dataset to use. """ if self.accuracy == 0.: if (skip_real_train == False): self.accuracy = train_and_score(self.network, dataset) else: self.accuracy = random.randrange(0, 100) / 100 print("Test condition of each network : {0}".format(self.network)) print("Test result of each network : {0}".format(self.accuracy))
def train(self, dataset, count, total): """Train the network and record the accuracy. Args: dataset (str): Name of dataset to use. """ if self.accuracy == 0.: print('Training Network (%2d/%2d) %s' % (count, total, self.print())) self.loss, self.accuracy, self.model = train_and_score(self.network, dataset) self.fit = 1 / self.loss if self.loss != 0 else sys.maxint else: print(' Using Network (%2d/%2d) %s - accuracy: %.2f%%, - loss: %.4f' % (count, total, self.print(), self.accuracy * 100, self.loss))
def train(self, dataset, count, total): """Train the network and record the accuracy. Args: dataset (str): Name of dataset to use. """ if self.accuracy == 0.: print('Training Network (%2d/%2d) %s' % (count, total, self.print())) self.loss, self.accuracy, self.model = train_and_score( self.network, dataset) self.fit = 1 / self.loss if self.loss != 0 else sys.maxint else: print( ' Using Network (%2d/%2d) %s - accuracy: %.2f%%, - loss: %.4f' % (count, total, self.print(), self.accuracy * 100, self.loss))
def train(self, x_train, y_train, x_test, y_test): self.accuracy = train_and_score(self.network, x_train, y_train, x_test, y_test)
def train(self, nb_classes, x, y): if self.accuracy == 0.: self.accuracy = train_and_score(self.network, nb_classes, x, y)
def train(self, dataset): if self.accuracy == 0.: self.accuracy = train_and_score(self.network, dataset)
def train(self, X, Y, generation): self.accuracy = train_and_score(self.network, X, Y)
def train(self, data): """Train the network and record the loss.""" if self.loss == 10.: self.loss = train_and_score(self.network, data)
def train(self, path, output): self.loss = train_and_score(self.network, path, output) name = path[-11:-3] self.name = name