Пример #1
0
def test_nmi_random_3d():
    random1, random2 = np.random.random((2, 10, 100, 100))
    assert_almost_equal(
        normalized_mutual_information(random1, random2, bins=10),
        1,
        decimal=2,
    )
Пример #2
0
def test_nmi_random(dtype):
    rng = np.random.default_rng()
    random1 = rng.random((100, 100)).astype(dtype)
    random2 = rng.random((100, 100)).astype(dtype)
    nmi = normalized_mutual_information(random1, random2, bins=10)
    assert nmi.dtype == np.float64
    assert_almost_equal(nmi, 1, decimal=2)
Пример #3
0
def test_nmi_different_sizes():
    assert normalized_mutual_information(cam[:, :400], cam[:400, :]) > 1
Пример #4
0
def test_nmi():
    assert_almost_equal(normalized_mutual_information(cam, cam), 2)
    assert (normalized_mutual_information(cam, cam_noisy) <
            normalized_mutual_information(cam, cam))