Пример #1
0
    def test_generate_gaussian_integers_len(self):
        num_1 = ng.generate_gaussian_integers(mu=3,
                                              sigma=1,
                                              lower_limit=1,
                                              upper_limit=5,
                                              size=1)
        self.assertEqual(len(num_1), 1)
        self.assertEqual(num_1[0], int(num_1[0]))

        vec_1 = ng.generate_gaussian_integers(mu=3,
                                              sigma=1,
                                              lower_limit=1,
                                              upper_limit=5,
                                              size=10)
        self.assertEqual(len(vec_1), 10)
Пример #2
0
 def test_generate_gaussian_integers_zero_sigma(self):
     num_1 = ng.generate_gaussian_integers(mu=3,
                                           sigma=0,
                                           lower_limit=1,
                                           upper_limit=5,
                                           size=1)
     self.assertEqual(num_1, 3)
Пример #3
0
 def test_generate_gaussian_integers_values_limit(self):
     vec_1 = ng.generate_gaussian_integers(mu=3,
                                           sigma=1,
                                           lower_limit=1,
                                           upper_limit=5,
                                           size=100)
     self.assertEqual(len(vec_1[vec_1 < 1]), 0)
     self.assertEqual(len(vec_1[vec_1 > 5]), 0)
Пример #4
0
 def setup_functions(self):
     self.dict[
         constants.
         DNA_SIZE_STR] = lambda list_input: ng.generate_gaussian_integers(
             list_input[0], list_input[1], list_input[2], list_input[3],
             list_input[4])
     self.dict[
         constants.
         DNA_ACTIONS_STR] = lambda list_input: ng.generate_n_uniform_random_integers(
             list_input[0], list_input[1], list_input[2])
     self.dict[
         constants.
         DNA_FEATURES_STR] = lambda list_input: ng.generate_n_uniform_random_integers(
             list_input[0], list_input[1], list_input[2])
     self.dict[
         constants.
         DNA_WEIGHTS_STR] = lambda list_input: ng.generate_n_uniform_random_values(
             list_input[0])
     self.dict[
         constants.
         DNA_PARENTHESES_STR] = lambda list_input: ng.generate_n_uniform_random_integers(
             list_input[0], list_input[1], list_input[2])
     self.dict[
         constants.DNA_WL_SCALAR] = lambda list_input: ng.generate_gaussian(
             list_input[0], list_input[1], list_input[2])
     self.dict[
         constants.DNA_WL_POWER] = lambda list_input: ng.generate_gaussian(
             list_input[0], list_input[1], list_input[2])
     self.dict[
         constants.
         DNA_PARENTHESES_BIAS] = lambda list_input: ng.generate_gaussian(
             list_input[0], list_input[1], list_input[2])
     self.dict[
         constants.
         DNA_WL_ACTIVATION] = lambda list_input: ng.generate_non_uniform_integers(
             list_input[0], list_input[1], list_input[2])
     self.dict[
         constants.
         DNA_PARENTHESES_ACTIVATION] = lambda list_input: ng.generate_non_uniform_integers(
             list_input[0], list_input[1], list_input[2])
     self.dict[
         constants.DNA_WL_BIAS] = lambda list_input: ng.generate_gaussian(
             list_input[0], list_input[1], list_input[2])
     self.dict[
         constants.
         DNA_PARENTHESES_POWER] = lambda list_input: ng.generate_gaussian(
             list_input[0], list_input[1], list_input[2])
def create_size_feature(mu=3, sigma=1, lower_limit=1, upper_limit=5):
    return ng.generate_gaussian_integers(mu=mu,
                                         sigma=sigma,
                                         lower_limit=lower_limit,
                                         upper_limit=upper_limit)[0]
def sample_size(mu):
    return ng.generate_gaussian_integers(
        mu=mu,
        sigma=1,
        lower_limit=1,
        upper_limit=constants.MAX_SIZE_INDIVIDUAL)[0]