def test_fit_sample_object():
 ratio = 'auto'
 cluster = KMeans(random_state=RND_SEED)
 cc = ClusterCentroids(ratio=ratio, random_state=RND_SEED, estimator=cluster)
 (X_resampled, y_resampled) = cc.fit_sample(X, Y)
 X_gt = np.array([[0.92923648, 0.76103773], [0.47104475, 0.44386323], [0.13347175, 0.12167502], [0.06738818, (-0.529627)], [0.17901516, 0.69860992], [0.094035, (-2.55298982)]])
 y_gt = np.array([0, 0, 0, 1, 1, 1])
 assert_allclose(X_resampled, X_gt, rtol=R_TOL)
 assert_array_equal(y_resampled, y_gt)

def test_fit_sample_object ( ) : ratio = 'auto' cluster = KMeans ( random_state = RND_SEED ) cc = ClusterCentroids ( ratio = ratio , random_state = RND_SEED , estimator = cluster ) ( X_resampled , y_resampled ) = cc . fit_sample ( X , Y ) X_gt = np . array ( [ [ 0.92923648 , 0.76103773 ] , [ 0.47104475 , 0.44386323 ] , [ 0.13347175 , 0.12167502 ] , [ 0.06738818 , ( - 0.529627 ) ] , [ 0.17901516 , 0.69860992 ] , [ 0.094035 , ( - 2.55298982 ) ] ] ) y_gt = np . array ( [ 0 , 0 , 0 , 1 , 1 , 1 ] ) assert_allclose ( X_resampled , X_gt , rtol = R_TOL ) assert_array_equal ( y_resampled , y_gt )
test fit and sample using a kmeans object .