コード例 #1
0
def test_calculate_entropy_2_order():
    text = 'abcdd'
    tree = __build_tree(text, 2)
    got = __calculate_entropy(tree, len(text))
    expected = 0.2
    assert_equal(expected, got)
コード例 #2
0
def test_calculate_entropy_1_order():
    text = 'abcdd'
    tree = __build_tree(text, 1)
    got = __calculate_entropy(tree, len(text))
    expected = 1.9219280948873623
    assert_equal(expected, got)