def test_get_weight_adjusted_input(self): neuron_1 = Neuron("TEST_1") neuron_2 = Neuron("TEST_2") neuron_2.set_output_value(2) neuron_1.attach_to_neuron_as_input(neuron_2) result = neuron_1.get_weight_adjusted_input(neuron_2) self.assertEqual(result, 1, "Should have returned the output value adjusted by weight 0.5.")
def test_calculate_sigma_of_inputs(self): neuron_1 = Neuron("TEST_1") neuron_2 = Neuron("TEST_2") neuron_2.set_output_value(2) neuron_3 = Neuron("TEST_3") neuron_3.set_output_value(4) neuron_1.attach_to_neuron_as_input(neuron_2) neuron_1.set_input_weight("TEST_2", 2) neuron_1.attach_to_neuron_as_input(neuron_3) neuron_1.set_input_weight("TEST_3", 0.5) result = neuron_1.calculate_sigma_of_inputs() self.assertEqual(result, 6, "Should have returned the sigma of 2*2, 4*0.5.")
def test_set_output_value(self): neuron = Neuron("TEST_ID") neuron.set_output_value(123456) self.assertEqual(neuron.output_value, 123456, "Should have set self.output_value.")