Ejemplo n.º 1
0
def test_entropy_knn2(mean, std):
    """
    Test entropy of normal samples.
    """
    n = 100000
    data = np.random.normal(mean, std, n).reshape(n, 1)
    h = differential_entropy_knn(data, [0])
    assert h == pytest.approx(np.log2(2 * np.pi * np.e * std**2) / 2, abs=1e-1)
Ejemplo n.º 2
0
def test_entropy_knn2(mean, std):
    """
    Test entropy of normal samples.
    """
    n = 100000
    data = np.random.normal(mean, std, n).reshape(n, 1)
    h = differential_entropy_knn(data, [0])
    assert h == pytest.approx(np.log2(2*np.pi*np.e*std**2)/2, abs=1e-1)