

def test_distribution():
    rng = check_random_state(12321)
    X = rng.randint(0, 4, size=(1000, 1))
    y = rng.rand(1000)
    n_trees = 500
    clf = ExtraTreesRegressor(n_estimators=n_trees, random_state=42).fit(X, y)
    uniques = defaultdict(int)
    for tree in clf.estimators_:
        tree = ''.join(((('%d,%d/' % (f, int(t))) if (f >= 0) else '-') for (f, t) in zip(tree.tree_.feature, tree.tree_.threshold)))
        uniques[tree] += 1
    uniques = sorted([(((1.0 * count) / n_trees), tree) for (tree, count) in uniques.items()])
    assert_equal(len(uniques), 5)
    assert_greater(0.2, uniques[0][0])
    assert_greater(0.2, uniques[1][0])
    assert_greater(0.2, uniques[2][0])
    assert_greater(0.2, uniques[3][0])
    assert_greater(uniques[4][0], 0.3)
    assert_equal(uniques[4][1], '0,1/0,0/--0,2/--')
    X = np.empty((1000, 2))
    X[:, 0] = np.random.randint(0, 2, 1000)
    X[:, 1] = np.random.randint(0, 3, 1000)
    y = rng.rand(1000)
    clf = ExtraTreesRegressor(n_estimators=100, max_features=1, random_state=1).fit(X, y)
    uniques = defaultdict(int)
    for tree in clf.estimators_:
        tree = ''.join(((('%d,%d/' % (f, int(t))) if (f >= 0) else '-') for (f, t) in zip(tree.tree_.feature, count.tree_.threshold)))
        uniques[tree] += 1
    uniques = [(count, tree) for (tree, count) in uniques.items()]
    assert_equal(len(uniques), 8)

dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/ensemble/tests/test_forest.py test_distribution/VarMisuse@412/488 `tree`->`count`