Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2edb84c

Browse files
author
Ben Lawson
committed
add description to test and fix whitespace for code style
1 parent bf0e49f commit 2edb84c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sklearn/tests/test_impute.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,9 @@ def test_iterative_imputer_clip():
593593

594594

595595
def test_iterative_imputer_normal_posterior():
596+
# test that the values that are imputed using `sample_posterior=True`
597+
# with boundaries (`min_value` and `max_value` are not None) are drawn
598+
# from a distribution that looks gaussian via the Kolmogorov–Smirnov test
596599
rng = np.random.RandomState(0)
597600

598601
X = rng.random_sample((5, 5))
@@ -607,7 +610,7 @@ def test_iterative_imputer_normal_posterior():
607610
# generate multiple imputations for the single missing value
608611
imputations = np.array([imputer.transform(X)[0][0] for _ in range(1000)])
609612
mu, sigma = imputations.mean(), imputations.std()
610-
ks_statistic, p_value = kstest((imputations-mu)/sigma, 'norm')
613+
ks_statistic, p_value = kstest((imputations - mu) / sigma, 'norm')
611614
# we want to fail to reject null hypothesis
612615
# null hypothesis: distributions are the same
613616
assert ks_statistic < 0.15 or p_value > 0.1, \

0 commit comments

Comments
 (0)