e2f021a5e4444befdb9e5926b96bc96c408faa85,examples/acp_classification_tree.py,,,#,26

Before Change


// Define models
// -----------------------------------------------------------------------------

models = {  "ACP-RandomSubSampler"  : AggregatedCp(
                                        IcpClassifier(
                                            ProbEstClassifierNc(
                                                DecisionTreeClassifier())),
                                        RandomSubSampler()),
            "ACP-CrossSampler"      : AggregatedCp(
                                        IcpClassifier(
                                            ProbEstClassifierNc(
                                                DecisionTreeClassifier())),
                                        CrossSampler()),
            "ACP-BootstrapSampler"  : AggregatedCp(
                                        IcpClassifier(
                                            ProbEstClassifierNc(
                                                DecisionTreeClassifier())),
                                        BootstrapSampler()),
            "CCP"                   : CrossConformalClassifier(
                                        IcpClassifier(
                                            ProbEstClassifierNc(
                                                DecisionTreeClassifier()))),
            "BCP"                   : BootstrapConformalClassifier(
                                        IcpClassifier(
                                            ProbEstClassifierNc(
                                                DecisionTreeClassifier())))
          }

// -----------------------------------------------------------------------------
// Train, predict and evaluate
// -----------------------------------------------------------------------------
for name, model in models.iteritems():
    model.fit(data.data[train, :], data.target[train])
    prediction = model.predict(data.data[test, :], significance=significance)
    table = np.hstack((prediction, truth))
    df = pd.DataFrame(table, columns=columns)
    print("\n{}".format(name))
    print("Error rate: {}".format(class_mean_errors(prediction,
                                                    truth,

After Change


// Define models
// -----------------------------------------------------------------------------

models = {  "ACP-RandomSubSampler"  : AggregatedCp(
                                        IcpClassifier(
                                            ClassifierNc(
                                                ClassifierAdapter(DecisionTreeClassifier()))),
                                        RandomSubSampler()),
            "ACP-CrossSampler"      : AggregatedCp(
                                        IcpClassifier(
                                            ClassifierNc(
                                                ClassifierAdapter(DecisionTreeClassifier()))),
                                        CrossSampler()),
            "ACP-BootstrapSampler"  : AggregatedCp(
                                        IcpClassifier(
                                            ClassifierNc(
                                                ClassifierAdapter(DecisionTreeClassifier()))),
                                        BootstrapSampler()),
            "CCP"                   : CrossConformalClassifier(
                                        IcpClassifier(
                                            ClassifierNc(
                                                ClassifierAdapter(DecisionTreeClassifier())))),
            "BCP"                   : BootstrapConformalClassifier(
                                        IcpClassifier(
                                            ClassifierNc(
                                                ClassifierAdapter(DecisionTreeClassifier()))))
          }

// -----------------------------------------------------------------------------
// Train, predict and evaluate
// -----------------------------------------------------------------------------
for name, model in models.iteritems():
    model.fit(data.data[train, :], data.target[train])
    prediction = model.predict(data.data[test, :], significance=significance)
    table = np.hstack((prediction, truth))
    df = pd.DataFrame(table, columns=columns)
    print("\n{}".format(name))
    print("Error rate: {}".format(class_mean_errors(prediction,
                                                    truth,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 3

Instances


Project Name: donlnz/nonconformist
Commit Name: e2f021a5e4444befdb9e5926b96bc96c408faa85
Time: 2016-09-09
Author: henrik.linusson@gmail.com
File Name: examples/acp_classification_tree.py
Class Name:
Method Name: