Пример #1
0
    def write_results_to_file(self, fittest_chromosome, test_set, filename):
        weights, biases = fittest_chromosome
        new_nn = BackPropModel(self.nn.args)
        new_nn.weights = list(weights)
        new_nn.biases = list(biases)

        new_nn.write_result_to_file(test_set, filename)
Пример #2
0
    def fitness(self, nn_chromosome, train_dataset):
        weights, biases = nn_chromosome
        new_nn = BackPropModel(self.nn.args)
        new_nn.weights = list(weights)
        new_nn.biases = list(biases)

        loss, success = new_nn.calculate_loss_and_success(train_dataset)

        fitness = loss

        return nn_chromosome, loss, success, fitness