Ejemplo n.º 1
0
def test_distance_logdet_implementation(get_covmats):
    n_matrices, n_channels = 2, 6
    covmats = get_covmats(n_matrices, n_channels)
    A, B = covmats[0], covmats[1]
    dist = np.sqrt(
        np.log(np.linalg.det((A + B) / 2.0)) -
        0.5 * np.log(np.linalg.det(A) * np.linalg.det(B)))
    assert distance_logdet(A, B) == approx(dist)
Ejemplo n.º 2
0
def test_distance_generic_logdet():
    """Test logdet distance for generic function"""
    A = 2*np.eye(3)
    B = 2*np.eye(3)
    assert_equal(distance(A, B, metric='logdet'), distance_logdet(A, B))
Ejemplo n.º 3
0
def test_distance_logdet():
    """Test logdet distance"""
    A = 2*np.eye(3)
    B = 2*np.eye(3)
    assert_equal(distance_logdet(A, B), 0)
Ejemplo n.º 4
0
def test_distance_generic_logdet():
    """Test logdet distance for generic function"""
    A = 2 * np.eye(3)
    B = 2 * np.eye(3)
    assert_equal(distance(A, B, metric='logdet'), distance_logdet(A, B))
Ejemplo n.º 5
0
def test_distance_logdet():
    """Test logdet distance"""
    A = 2 * np.eye(3)
    B = 2 * np.eye(3)
    assert_equal(distance_logdet(A, B), 0)
Ejemplo n.º 6
0
def test_distance_logdet():
    """Test logdet distance"""
    A = 2 * np.eye(3)
    B = 2 * np.eye(3)
    assert distance_logdet(A, B) == 0