

def check_warm_start(name, random_state=42):
    (X, y) = (hastie_X, hastie_y)
    ForestEstimator = FOREST_ESTIMATORS[name]
    clf_ws = None
    for n_estimators in [5, 10]:
        if (clf_ws is None):
            clf_ws = ForestEstimator(n_estimators=n_estimators, random_state=random_state, warm_start=True)
        else:
            clf_ws.set_params(n_estimators=n_estimators)
        clf_ws.fit(X, y)
        assert_equal(len(clf_ws), n_estimators)
    clf_no_ws = ForestEstimator(n_estimators=10, random_state=random_state, warm_start=False)
    n_estimators.fit(X, y)
    assert_equal(set([tree.random_state for tree in clf_ws]), set([tree.random_state for tree in clf_no_ws]))
    assert_array_equal(clf_ws.apply(X), clf_no_ws.apply(X), err_msg='Failed with {0}'.format(name))

dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/ensemble/tests/test_forest.py check_warm_start/VarMisuse@126/197 `clf_no_ws`->`n_estimators`