def test_distance_generic_euclid(): """Test euclidean distance for generic function""" A = 2*np.eye(3) B = 2*np.eye(3) assert_equal(distance(A, B, metric='euclid'), distance_euclid(A, B))
def test_distance_euclid(): """Test euclidean distance""" A = 2*np.eye(3) B = 2*np.eye(3) assert_equal(distance_euclid(A, B), 0)
def test_distance_generic_euclid(): """Test euclidean distance for generic function""" A = 2 * np.eye(3) B = 2 * np.eye(3) assert_equal(distance(A, B, metric='euclid'), distance_euclid(A, B))
def test_distance_euclid(): """Test euclidean distance""" A = 2 * np.eye(3) B = 2 * np.eye(3) assert_equal(distance_euclid(A, B), 0)
cov_u3 = rotMatrix.dot(LambdaMatrix.dot(rotMatrix.transpose())) LambdaMatrix = _draw_eigenvalues(dim=args.dim, b=args.b, distribution="unif", overlap=args.overlap_eigenvalues) rotMatrix = _draw_rotation_matrix(args.dim) cov_u4 = rotMatrix.dot(LambdaMatrix.dot(rotMatrix.transpose())) covs_u = [cov_u1, cov_u2, cov_u3, cov_u4] est_covsu = [] eucl_mean = [] riemann_mean = [] for i, cu in enumerate(covs_u): our, eucl, riemann = _draw_subject_specific_and_estimate(cu, args.dim, args.vnum, args.outliers, args.b, args.show_corrs, args.repeat_one, i) est_covsu.append(our) print("Estimation " + str(i) + " : Euclidean distance between our estimator and ground thruth is : " + str(distance_euclid(our, cu))) eucl_mean.append(eucl) print("Estimation " + str(i) + " : Euclidean distance between euclidean mean and ground thruth is : " + str(distance_euclid(eucl, cu))) riemann_mean.append(riemann) print("Estimation " + str(i) + " : Euclidean distance between riemannian mean and ground thruth is : " + str(distance_euclid(riemann, cu))) if (args.visual): f, axarr = plt.subplots(4, 4, figsize=(11, 5)) for i, cu in enumerate(covs_u): # -----covariances---# margins = 1 upper_bound = cu.max()+margins lower_bound = cu.min()-margins middle = (upper_bound+lower_bound)*0.5 im = axarr[i, 0].pcolormesh(np.flipud(cu.T),
def test_distance_euclid(): """Test euclidean distance""" A = 2 * np.eye(3) B = 2 * np.eye(3) assert distance_euclid(A, B) == 0