Ejemplo n.º 1
0
def test_larger_signatures_flows():
    first_signature = np.array([0.0, 1.0, 2.0])
    second_signature = np.array([5.0, 3.0, 3.0])
    distance_matrix = np.array([[0.0, 0.5],
                                [0.5, 0.0]])
    with pytest.raises(ValueError):
        emd_with_flows(first_signature, second_signature, distance_matrix)
Ejemplo n.º 2
0
def test_case_5_flows():
    first_signature = np.array([3.0, 5.0])
    second_signature = np.array([6.0, 2.0])
    distance_matrix = np.array([[0.0, 0.0],
                                [0.0, 0.0]])
    assert (emd_with_flows(first_signature, second_signature, distance_matrix)
            == (0.0, [[3.0, 0.0], [3.0, 2.0]]))
Ejemplo n.º 3
0
def test_case_1_flows():
    first_signature = np.array([0.0, 1.0])
    second_signature = np.array([5.0, 3.0])
    distance_matrix = np.array([[0.0, 0.5],
                                [0.5, 0.0]])
    assert (emd_with_flows(first_signature, second_signature, distance_matrix)
            == (3.5, [[0.0, 0.0], [0.0, 1.0]]))