-
-
Save karlnapf/6cf4186dc77861681ceba938f397f2c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CSVFile f_feats_train("../../data/classifier_4class_2d_linear_features_train.dat") | |
CSVFile f_feats_test("../../data/classifier_4class_2d_linear_features_test.dat") | |
CSVFile f_labels_train("../../data/classifier_4class_2d_linear_labels_train.dat") | |
CSVFile f_labels_test("../../data/classifier_4class_2d_linear_labels_test.dat") | |
#![create_features] | |
RealFeatures features_train(f_feats_train) | |
RealFeatures features_test(f_feats_test) | |
MulticlassLabels labels_train(f_labels_train) | |
MulticlassLabels labels_test(f_labels_test) | |
#![create_features] | |
#![set_attribute_types] | |
BoolVector ft(2) | |
ft[0] = False | |
ft[1] = False | |
#![set_attribute_types] | |
#![create_instance] | |
CARTree classifier(ft,enum EProblemType.PT_MULTICLASS, 5, True) | |
classifier.set_labels(labels_train) | |
#![create_instance] | |
#![train_and_apply] | |
classifier.train(features_train) | |
MulticlassLabels labels_predict = classifier.apply_multiclass(features_test) | |
#![train_and_apply] | |
#![evaluate_accuracy] | |
MulticlassAccuracy eval() | |
real accuracy = eval.evaluate(labels_predict, labels_test) | |
#![evaluate_accuracy] | |
# integration testing variables | |
RealVector output = labels_predict.get_labels() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment