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)
评论列表
文章目录