Exemplo n.º 1
0
def test_vmap_fit_params():
    # x and y are required to be the same length
    u = VMAP()
    x = np.random.uniform(0, 1, (256, 10))
    y = np.random.randint(10, size=(257, ))
    assert_raises(ValueError, u.fit, x, y)

    u = VMAP()
    x = np.random.uniform(0, 1, (256, 10))
    y = np.random.randint(10, size=(255, ))
    assert_raises(ValueError, u.fit, x, y)

    u = VMAP()
    x = np.random.uniform(0, 1, (256, 10))
    assert_raises(ValueError, u.fit, x, [])

    u = VMAP()
    x = np.random.uniform(0, 1, (256, 10))
    y = np.random.randint(10, size=(256, ))
    res = u.fit(x, y)
    assert isinstance(res, VMAP)

    u = VMAP()
    x = np.random.uniform(0, 1, (256, 10))
    res = u.fit(x)
    assert isinstance(res, VMAP)
Exemplo n.º 2
0
def test_too_many_neighbors_warns():
    u = VMAP(a=1.2, b=1.75, n_neighbors=2000, n_epochs=11, init="random")
    u.fit(nn_data[:100, ])
    assert_equal(u._a, 1.2)
    assert_equal(u._b, 1.75)