示例#1
0
 def test_get_entropy_random(self):
     random_freqs = np.random.randint(10, 100, size=(200,))
     random_int = np.random.randint(2, 10)
     entropy_1 = get_entropy(random_freqs)
     entropy_2 = get_entropy(random_freqs * random_int)
     assert_approx_equal(entropy_1, entropy_2)
示例#2
0
    def test_get_entropy_value(self):
        freqs = np.ones((2,))
        assert_approx_equal(get_entropy(freqs), 0.6931, 4)

        freqs = np.array([2, 1, 2])
        assert_approx_equal(get_entropy(freqs), 1.0549, 4)