def test_ncr_sample_wrong_X(): """Test either if an error is raised when X is different at fitting and sampling""" # Create the object ncr = NeighbourhoodCleaningRule(random_state=RND_SEED) ncr.fit(X, Y) assert_raises(RuntimeError, ncr.sample, np.random.random((100, 40)), np.array([0] * 50 + [1] * 50))
def test_ncr_fit(): """Test the fitting method""" # Create the object ncr = NeighbourhoodCleaningRule(random_state=RND_SEED) # Fit the data ncr.fit(X, Y) # Check if the data information have been computed assert_equal(ncr.min_c_, 0) assert_equal(ncr.maj_c_, 1) assert_equal(ncr.stats_c_[0], 500) assert_equal(ncr.stats_c_[1], 4500)