test_conditional_inference_binner.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:dstk 作者: jotterbach 项目源码 文件源码
def test_adding_bin():
    col = 'mean radius'
    data = cancer_df[col].values
    cib = ConditionalInferenceBinner('test_dim_{}'.format(col), alpha=0.95)
    cib.fit(data, cancer_target)

    cib.add_bin(-1.0, [0.1, 0.9])

    np.testing.assert_equal(cib.splits, [-1.0, 11.75, 13.079999923706055, 15.039999961853027, 16.84000015258789, np.PINF, np.NaN])
    np.testing.assert_equal(cib.values,
                            [[0.1, 0.9],
                             [0.02, 0.97999999999999998],
                             [0.086956521739130432, 0.91304347826086951],
                             [0.2878787878787879, 0.71212121212121215],
                             [0.81481481481481477, 0.18518518518518517],
                             [0.99152542372881358, 0.0084745762711864406],
                             [0.37258347978910367, 0.62741652021089633]])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号