示例#1
0
def test8():
    """Same as test1, but now comparing different autograd methods."""
    T, n = projective_mds.circleRPn()
    D = projective_mds.graph_distance_matrix(T, k=5)
    Y = projective_mds.initial_guess(T, 2)
    costs, times = do_autograd_tests(Y, D)
    return costs, times
示例#2
0
def test10(solve_prog='autograd'):
    """Test using the bezier curve on RP^4 (which gets tangled by PPCA)."""
    B = np.load('bez_test.npy')
    D = projective_mds.graph_distance_matrix(B, k=5)
    Y = projective_mds.initial_guess(B, 2)
    out = do_autograd_tests(Y, D, solve_prog=solve_prog)
    return out
示例#3
0
def test4():
    Ws = np.load('workspace.npz')
    T = Ws['BB']
    Y = Ws['Y']
    D = projective_mds.graph_distance_matrix(T, k=8)
    out = do_tests(Y, D)
    return out
示例#4
0
def test9():
    """Same as test4, but with autograd methods."""
    Ws = np.load('workspace.npz')
    T = Ws['BB']
    Y = Ws['Y']
    D = projective_mds.graph_distance_matrix(T, k=8)
    costs, times = do_autograd_tests(Y, D)
    return costs, times
示例#5
0
def test12(pmo_solve='cg'):
    """Same as test4, but with autograd methods."""
    Ws = np.load('workspace.npz')
    T = Ws['BB']
    Y = Ws['Y']
    D = projective_mds.graph_distance_matrix(T, k=8)
    out = compare_gradients(Y, D, pmo_solve=pmo_solve)
    return out
示例#6
0
def test5():
    T, _ = projective_mds.circleRPn(noise=True, segment_points=60)
    D = projective_mds.graph_distance_matrix(T, k=8)
    Y, _ = projective_mds.circleRPn(dim=2,
                                    segment_points=100,
                                    num_segments=2,
                                    noise=True,
                                    v=0.1)
    out = do_tests(Y, D)
    return out
示例#7
0
def test7():
    """Test applying PMDS before PPCA, with the tangled curve."""
    B = np.load('bez_test.npy')
    D = projective_mds.graph_distance_matrix(B, k=5)
    X, C = do_tests(B, D, plot=False)
    Y1 = projective_mds.initial_guess(X[0], 2)
    Y2 = projective_mds.initial_guess(X[1], 2)
    Y3 = projective_mds.initial_guess(X[2], 2)
    Y4 = projective_mds.initial_guess(X[3], 2)
    Y5 = projective_mds.initial_guess(X[4], 2)
    out = (Y1, Y2, Y3, Y4, Y5)
    return out
示例#8
0
def test1():
    T, n = projective_mds.circleRPn()
    D = projective_mds.graph_distance_matrix(T, k=5)
    Y = projective_mds.initial_guess(T, 2)
    out = do_tests(Y, D)
    return out
示例#9
0
def test11(pmo_solve='cg'):
    B = np.load('bez_test.npy')
    D = projective_mds.graph_distance_matrix(B, k=5)
    Y = projective_mds.initial_guess(B, 2)
    out = compare_gradients(Y, D, pmo_solve=pmo_solve)
    return out