def test_nm2_fit_sample_auto_indices():
 ratio = 'auto'
 nm2 = NearMiss(ratio=ratio, random_state=RND_SEED, version=VERSION_NEARMISS, return_indices=True)
 (X_resampled, y_resampled, idx_under) = 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], [0.50701028, (-0.17636928)], [0.4960075, 0.86130762], [0.45713638, 1.31069295]])
 y_gt = np.array([0, 0, 0, 1, 1, 1, 2, 2, 2])
 idx_gt = np.array([3, 10, 11, 2, 8, 5, 9, 1, 6])
 assert_array_equal(X_resampled, X_gt)
 assert_array_equal(y_resampled, y_gt)
 assert_array_equal(idx_under, idx_gt)

def test_nm2_fit_sample_auto_indices ( ) : ratio = 'auto' nm2 = NearMiss ( ratio = ratio , random_state = RND_SEED , version = VERSION_NEARMISS , return_indices = True ) ( X_resampled , y_resampled , idx_under ) = 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 ] , [ 0.50701028 , ( - 0.17636928 ) ] , [ 0.4960075 , 0.86130762 ] , [ 0.45713638 , 1.31069295 ] ] ) y_gt = np . array ( [ 0 , 0 , 0 , 1 , 1 , 1 , 2 , 2 , 2 ] ) idx_gt = np . array ( [ 3 , 10 , 11 , 2 , 8 , 5 , 9 , 1 , 6 ] ) assert_array_equal ( X_resampled , X_gt ) assert_array_equal ( y_resampled , y_gt ) assert_array_equal ( idx_under , idx_gt )
test fit and sample routines with auto ratio and indices support .