def test_ncr_n_neighbors(data):
    """Check the effect of the NN on the cleaning of the second phase."""
    X, y = data

    enn = EditedNearestNeighbours()
    ncr = NeighbourhoodCleaningRule(edited_nearest_neighbours=enn, n_neighbors=3)

    ncr.fit_resample(X, y)
    sample_indices_3_nn = ncr.sample_indices_

    ncr.set_params(n_neighbors=10).fit_resample(X, y)
    sample_indices_10_nn = ncr.sample_indices_

    # we should have a more aggressive cleaning with n_neighbors is larger
    assert len(sample_indices_3_nn) > len(sample_indices_10_nn)
Check the effect of the NN on the cleaning of the second phase.
imblearn/under_sampling/_prototype_selection/tests/test_neighbourhood_cleaning_rule.py