Пример #1
0
    def test_equation_unconstrained_hebbian_learning_ca3_out(self):
        hpc = HPC([49, 240, 1600, 480, 49],
                  0.67, 0.25, 0.04,  # connection rates: (in_ec, ec_dg, dg_ca3)
                  0.10, 0.01, 0.04,  # firing rates: (ec, dg, ca3)
                  0.7, 1, 0.1, 0.5,  # gamma, epsilon, nu, turnover rate
                  0.10, 0.95, 0.8, 2.0)  # k_m, k_r, a_i, alpha

        empty_activation_values_l1 = np.zeros_like(hpc.ca3_values.get_value()).astype(np.float32)
        empty_activation_values_l1.put([0, 0], 1)
        hpc.set_ca3_values(empty_activation_values_l1)

        empty_activation_values_l2 = np.zeros_like(hpc.output_values.get_value()).astype(np.float32)
        empty_activation_values_l2.put([0, 0], 1)
        hpc.set_output(empty_activation_values_l2)

        current_weight_element = hpc.ca3_out_weights.get_value()[0][0]
        next_weight_element = hpc._gamma * current_weight_element + 1

        hpc.wire_ca3_out(hpc.ca3_values.get_value(return_internal_type=True),
                          hpc.output_values.get_value(return_internal_type=True),
                          hpc.ca3_out_weights.get_value(return_internal_type=True))
        self.assertAlmostEqual(hpc.ca3_out_weights.get_value()[0][0], next_weight_element, places=6,
                         msg="Weight update did not correspond to the predicted update value of the equation: "
                             "next_weight_el != w_el : "+str(next_weight_element)+" != " +
                             str(hpc.ca3_out_weights.get_value()[0][0]))