test_mondrian.py 文件源码

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

项目:scikit-garden 作者: scikit-garden 项目源码 文件源码
def test_tau():
    """
    Test time of split for the root.
    """
    X, y = make_regression(random_state=0, n_features=10)
    y = np.round(y)
    rate = np.sum(np.max(X, axis=0) - np.min(X, axis=0))

    for est in estimators:
        est = est.set_params(max_depth=1)
        taus = []
        for random_state in np.arange(100):
            est.set_params(random_state=random_state).fit(X, y)
            taus.append(est.tree_.tau[0])
        assert_almost_equal(np.mean(taus), 1.0 / rate, 2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号