def test_recursion_with_nan():
col = 'mean area'
data = cancer_df[col].values
rand_idx = np.linspace(1, 500, 23).astype(int)
data[rand_idx] = np.NaN
cib = ConditionalInferenceBinner('test_dim_{}'.format(col), alpha=0.95)
cib.fit(data, cancer_target)
np.testing.assert_equal(cib.splits, [471.29998779296875, 555.0999755859375, 693.7000122070312, 880.2000122070312, np.PINF, np.NaN])
np.testing.assert_equal(cib.values,
[[0.030769230769230771, 0.96923076923076923],
[0.13414634146341464, 0.86585365853658536],
[0.31730769230769229, 0.68269230769230771],
[0.83333333333333337, 0.16666666666666666],
[0.99145299145299148, 0.0085470085470085479],
[0.2608695652173913, 0.73913043478260865]])
test_conditional_inference_binner.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录