Exemplo n.º 1
0
def test_decision_tree_3():
    """Ensure that the TPOT decision tree method outputs the same as the sklearn decision tree when min_weight>0.5"""

    tpot_obj = TPOT()
    result = tpot_obj._decision_tree(training_testing_data, 0.6)
    result = result[result['group'] == 'testing']

    dtc = DecisionTreeClassifier(min_weight_fraction_leaf=0.5, random_state=42)
    dtc.fit(training_features, training_classes)

    assert np.array_equal(result['guess'].values, dtc.predict(testing_features))
Exemplo n.º 2
0
def test_decision_tree_3():
    """Ensure that the TPOT decision tree method outputs the same as the sklearn decision tree when min_weight>0.5"""

    tpot_obj = TPOT()
    result = tpot_obj._decision_tree(training_testing_data, 0.6)
    result = result[result['group'] == 'testing']

    dtc = DecisionTreeClassifier(min_weight_fraction_leaf=0.5, random_state=42)
    dtc.fit(training_features, training_classes)

    assert np.array_equal(result['guess'].values, dtc.predict(testing_features))
Exemplo n.º 3
0
def test_decision_tree():
    """Ensure that the TPOT decision tree method outputs the same as the sklearn decision tree"""

    tpot_obj = TPOT()
    result = tpot_obj._decision_tree(training_testing_data, 0, 0)
    result = result[result['group'] == 'testing']

    dtc = DecisionTreeClassifier(max_features='auto', max_depth=None, random_state=42)
    dtc.fit(training_features, training_classes)

    assert np.array_equal(result['guess'].values, dtc.predict(testing_features))
Exemplo n.º 4
0
def test_decision_tree_3():
    """Ensure that the TPOT decision tree method outputs the same as the sklearn decision tree when max_features>no. of features"""

    tpot_obj = TPOT()
    result = tpot_obj._decision_tree(training_testing_data, 100, 0)
    result = result[result['group'] == 'testing']

    dtc = DecisionTreeClassifier(max_features=64, max_depth=None, random_state=42)
    dtc.fit(training_features, training_classes)

    assert np.array_equal(result['guess'].values, dtc.predict(testing_features))