def test_nm2_fit_sample_half():
 ratio = 0.7
 nm2 = NearMiss(ratio=ratio, random_state=RND_SEED, version=VERSION_NEARMISS)
 (X_resampled, y_resampled) = nm2.fit_sample(X, Y)
 X_gt = np.array([[0.91464286, 1.61369212], [(-0.80809175), (-1.09917302)], [(-0.20497017), (-0.26630228)], [(-0.05903827), 0.10947647], [0.03142011, 0.12323596], [(-0.60413357), 0.24628718], [1.17737838, (-0.2002118)], [0.50701028, (-0.17636928)], [0.4960075, 0.86130762], [0.45713638, 1.31069295], [0.99272351, (-0.11631728)]])
 y_gt = np.array([0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2])
 assert_array_equal(X_resampled, X_gt)
 assert_array_equal(y_resampled, y_gt)

def test_nm2_fit_sample_half ( ) : ratio = 0.7 nm2 = NearMiss ( ratio = ratio , random_state = RND_SEED , version = VERSION_NEARMISS ) ( X_resampled , y_resampled ) = nm2 . fit_sample ( X , Y ) X_gt = np . array ( [ [ 0.91464286 , 1.61369212 ] , [ ( - 0.80809175 ) , ( - 1.09917302 ) ] , [ ( - 0.20497017 ) , ( - 0.26630228 ) ] , [ ( - 0.05903827 ) , 0.10947647 ] , [ 0.03142011 , 0.12323596 ] , [ ( - 0.60413357 ) , 0.24628718 ] , [ 1.17737838 , ( - 0.2002118 ) ] , [ 0.50701028 , ( - 0.17636928 ) ] , [ 0.4960075 , 0.86130762 ] , [ 0.45713638 , 1.31069295 ] , [ 0.99272351 , ( - 0.11631728 ) ] ] ) y_gt = np . array ( [ 0 , 0 , 0 , 1 , 1 , 1 , 1 , 2 , 2 , 2 , 2 ] ) assert_array_equal ( X_resampled , X_gt ) assert_array_equal ( y_resampled , y_gt )
test fit and sample routines with .