コード例 #1
0
def test_eps_isomap():
    """
    Test of the esp_isomap procedure
    this one sometimes fails...not sure why
    """
    X = randn(10,3)
    M = eps_Isomap(X, rdim=1)
    u = M.train(eps = 2.)
    x = X[:2,:]
    a = M.test(x)
    eps = 1.e12
    test = np.sum((a-u[:2])**2)<eps
    print np.sum((a-u[:2])**2), a-u[:2]
    assert test
コード例 #2
0
ファイル: test_dr.py プロジェクト: Garyfallidis/nipy
def test_eps_isomap():
    """
    Test of the esp_isomap procedure
    this one fails if the graph as more than one connected component
    to avoid this we use a non-random example
    """
    prng = np.random.RandomState(seed=2)
    X = prng.randn(10,3)
    M = eps_Isomap(X, rdim=2)
    u = M.train(eps = 2.)
    x = X[:2,:]
    a = M.test(x)
    eps = 1.e-12
    test = np.sum((a-u[:2])**2)<eps
    assert test