File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -593,6 +593,9 @@ def test_iterative_imputer_clip():
593
593
594
594
595
595
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
596
599
rng = np .random .RandomState (0 )
597
600
598
601
X = rng .random_sample ((5 , 5 ))
@@ -607,7 +610,7 @@ def test_iterative_imputer_normal_posterior():
607
610
# generate multiple imputations for the single missing value
608
611
imputations = np .array ([imputer .transform (X )[0 ][0 ] for _ in range (1000 )])
609
612
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' )
611
614
# we want to fail to reject null hypothesis
612
615
# null hypothesis: distributions are the same
613
616
assert ks_statistic < 0.15 or p_value > 0.1 , \
You can’t perform that action at this time.
0 commit comments