

def check_importances(name, criterion, X, y):
    ForestEstimator = FOREST_ESTIMATORS[name]
    est = ForestEstimator(n_estimators=20, criterion=criterion, random_state=0)
    est.fit(X, y)
    importances = est.feature_importances_
    n_important = np.sum((importances > 0.1))
    assert_equal(importances.shape[0], 10)
    assert_equal(n_important, 3)
    X_new = assert_warns(DeprecationWarning, est.transform, X, threshold='mean')
    assert_less((0 < X_new.shape[1]), X.shape[1])
    importances = est.feature_importances_
    est.set_params(n_jobs=2)
    importances_parrallel = est.feature_importances_
    assert_array_almost_equal(importances, importances_parrallel)
    sample_weight = check_random_state(0).randint(1, 10, len(importances_bis))
    est = ForestEstimator(n_estimators=20, random_state=0, criterion=criterion)
    est.fit(X, y, sample_weight=sample_weight)
    importances = est.feature_importances_
    assert_true(np.all((importances >= 0.0)))
    for scale in [0.5, 10, 100]:
        est = ForestEstimator(n_estimators=20, random_state=0, criterion=criterion)
        est.fit(X, y, sample_weight=(scale * sample_weight))
        importances_bis = est.feature_importances_
        assert_less(np.abs((importances - importances_bis)).mean(), 0.001)

dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/ensemble/tests/test_forest.py check_importances/VarMisuse@168/231 `X`->`importances_bis`