Skip to content

Commit

Permalink
modify kbins test using kmeans due to unstable local minimum (#12450)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiedbb authored and jnothman committed Nov 14, 2018
1 parent a57ef83 commit fa0e3f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sklearn/preprocessing/tests/test_discretization.py
Expand Up @@ -189,10 +189,10 @@ def test_invalid_strategy_option():
@pytest.mark.parametrize(
'strategy, expected_2bins, expected_3bins',
[('uniform', [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 2, 2]),
('kmeans', [0, 0, 0, 0, 1, 1], [0, 1, 1, 1, 2, 2]),
('kmeans', [0, 0, 0, 0, 1, 1], [0, 0, 1, 1, 2, 2]),
('quantile', [0, 0, 0, 1, 1, 1], [0, 0, 1, 1, 2, 2])])
def test_nonuniform_strategies(strategy, expected_2bins, expected_3bins):
X = np.array([0, 1, 2, 3, 9, 10]).reshape(-1, 1)
X = np.array([0, 0.5, 2, 3, 9, 10]).reshape(-1, 1)

# with 2 bins
est = KBinsDiscretizer(n_bins=2, strategy=strategy, encode='ordinal')
Expand Down

0 comments on commit fa0e3f2

Please sign in to comment.