def test_densmap_fit_params(): # x and y are required to be the same length u = DENSMAP() x = np.random.uniform(0, 1, (256, 10)) y = np.random.randint(10, size=(257, )) assert_raises(ValueError, u.fit, x, y) u = DENSMAP() x = np.random.uniform(0, 1, (256, 10)) y = np.random.randint(10, size=(255, )) assert_raises(ValueError, u.fit, x, y) u = DENSMAP() x = np.random.uniform(0, 1, (256, 10)) assert_raises(ValueError, u.fit, x, []) u = DENSMAP() x = np.random.uniform(0, 1, (256, 10)) y = np.random.randint(10, size=(256, )) res = u.fit(x, y) assert isinstance(res, DENSMAP) u = DENSMAP() x = np.random.uniform(0, 1, (256, 10)) res = u.fit(x) assert isinstance(res, DENSMAP)
def test_too_many_neighbors_warns(): u = DENSMAP(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)