def test_random_forest_2(): """Ensure that the TPOT random forest method outputs the same as the sklearn random forest when min_weight>0.5""" tpot_obj = TPOT() result = tpot_obj._random_forest(training_testing_data, 0.6) result = result[result['group'] == 'testing'] rfc = RandomForestClassifier(n_estimators=500, min_weight_fraction_leaf=0.5, random_state=42, n_jobs=-1) rfc.fit(training_features, training_classes) assert np.array_equal(result['guess'].values, rfc.predict(testing_features))
def test_random_forest_2(): """Ensure that the TPOT random forest method outputs the same as the sklearn random forest when min_weight>0.5""" tpot_obj = TPOT() result = tpot_obj._random_forest(training_testing_data, 0.6) result = result[result['group'] == 'testing'] rfc = RandomForestClassifier(n_estimators=500, min_weight_fraction_leaf=0.5, random_state=42, n_jobs=-1) rfc.fit(training_features, training_classes) assert np.array_equal(result['guess'].values, rfc.predict(testing_features))
def test_random_forest(): """Ensure that the TPOT random forest method outputs the same as the sklearn random forest""" tpot_obj = TPOT() result = tpot_obj._random_forest(training_testing_data, 100, 0) result = result[result['group'] == 'testing'] rfc = RandomForestClassifier(n_estimators=100, max_features='auto', random_state=42, n_jobs=-1) rfc.fit(training_features, training_classes) assert np.array_equal(result['guess'].values, rfc.predict(testing_features))
def test_random_forest_3(): """Ensure that the TPOT random forest method outputs the same as the sklearn random forest when max_features>no. of features""" tpot_obj = TPOT() result = tpot_obj._random_forest(training_testing_data, 100) result = result[result['group'] == 'testing'] rfc = RandomForestClassifier(n_estimators=500, max_features=64, random_state=42, n_jobs=-1) rfc.fit(training_features, training_classes) assert np.array_equal(result['guess'].values, rfc.predict(testing_features))