예제 #1
0
파일: test_tree.py 프로젝트: tzuryby/milk
def test_information_gain():
    np.random.seed(22)
    for i in xrange(8):
        labels0 = (np.random.randn(20) > .2).astype(int)
        labels1 = (np.random.randn(33) > .8).astype(int)
        fast = information_gain(labels0, labels1)
        slow = slow_information_gain(labels0, labels1)
        assert np.abs(fast - slow) < 1.e-8
예제 #2
0
파일: test_tree.py 프로젝트: Afey/milk
def test_information_gain():
    np.random.seed(22)
    for i in range(8):
        labels0 = (np.random.randn(20) > .2).astype(int)
        labels1 = (np.random.randn(33) > .8).astype(int)
        fast = information_gain(labels0, labels1)
        slow = slow_information_gain(labels0, labels1)
        assert np.abs(fast - slow) < 1.e-8
예제 #3
0
파일: test_tree.py 프로젝트: tzuryby/milk
def test_information_gain_small():
    labels1 = np.array([0])
    labels0 = np.array([0, 1])
    assert information_gain(labels0, labels1) < 0.
예제 #4
0
파일: test_tree.py 프로젝트: Afey/milk
def test_information_gain_small():
    labels1 = np.array([0])
    labels0 = np.array([0, 1])
    assert information_gain(labels0, labels1) < 0.