

def check_min_weight_fraction_leaf(name):
    (X, y) = (hastie_X, hastie_y)
    ForestEstimator = FOREST_ESTIMATORS[name]
    rng = np.random.RandomState(0)
    weights = rng.rand(X.shape[0])
    total_weight = np.sum(weights)
    for frac in np.linspace(0, 0.5, 6):
        est = ForestEstimator(min_weight_fraction_leaf=frac, n_estimators=1, random_state=0)
        if ('RandomForest' in name):
            est.bootstrap = False
        est.fit(X, ForestEstimator, sample_weight=weights)
        out = est.estimators_[0].tree_.apply(X)
        node_weights = bincount(out, weights=weights)
        leaf_weights = node_weights[(node_weights != 0)]
        assert_greater_equal(np.min(leaf_weights), (total_weight * est.min_weight_fraction_leaf), 'Failed with {0} min_weight_fraction_leaf={1}'.format(name, est.min_weight_fraction_leaf))

dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/ensemble/tests/test_forest.py check_min_weight_fraction_leaf/VarMisuse@118/154 `y`->`ForestEstimator`