def test_nominal_info_gain(self): x, y, t, feature_names, name, dataset_type = load.breast_cancer() actual = np.array([measures.info_gain(x[:, i], y, t[i], True)[0] for i in range(len(x[0]))]) expected = np.array( [0.363243, 0.588919, 0.569025, 0.375882, 0.494187, 0.520238, 0.490311, 0.457238, 0.199398]) np.testing.assert_allclose(expected, actual, rtol=1e-05)
def dt_multiple_datasets(test_cases, args): print "DECISION TREE" print args for num_test in test_cases: if num_test == 1: decision_tree_ca(load.breast_cancer(), args) decision_tree_ca(load.car(), args) elif num_test == 2: decision_tree_ca(load.segmentation(), args) decision_tree_ca(load.iris(), args) decision_tree_ca(load.wine(), args) elif num_test == 3: decision_tree_ca(load.bank(), args) decision_tree_ca(load.lymphography(), args)
def clasifier_comparison(test_cases, args): print "Comparison of DECISION TREE, RANDOM FOREST" print args for num_test in test_cases: if num_test == 1: compare(load.breast_cancer(), args) compare(load.car(), args) elif num_test == 2: compare(load.segmentation(), args) compare(load.iris(), args) compare(load.wine(), args) if num_test == 3: compare(load.bank(), args) compare(load.lymphography(), args)