Esempio n. 1
0
    def test_set_error_output_layer(self):
        neuron = Neuron(0, 0, [0.05, 0.05], [1, 1])
        neuron.output = 0.518979
        neuron.is_output_layer = True
        neuron.set_output_layer_error(0)

        self.assertEquals(-0.12955, round_to(neuron.delta_val, 5))
Esempio n. 2
0
    def _create_neurons(self, neuron_count_vec, weight_counts):
        neuron_count_vec_length = len(neuron_count_vec)
        for i in range(0, neuron_count_vec_length):
            self.neurons.append([])
            for j in range(0, neuron_count_vec[i]):

                weights = Network.get_initial_neuron_weights(weight_counts[i]+1)

                inputs = [0] * (len(weights)-1)
                inputs.append(1)

                neuron = Neuron(i, j, weights, inputs)
                if i == neuron_count_vec_length-1:
                    neuron.is_output_layer = True

                self.neurons[i].append(neuron)