Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CSVFile f_feats_train("@SHOGUN_DATA@/classifier_4class_2d_linear_features_train.dat")
- CSVFile f_feats_test("@SHOGUN_DATA@/classifier_4class_2d_linear_features_test.dat")
- CSVFile f_labels_train("@SHOGUN_DATA@/classifier_4class_2d_linear_labels_train.dat")
- CSVFile f_labels_test("@SHOGUN_DATA@/classifier_4class_2d_linear_labels_test.dat")
- #![create_features]
- Features features_train = features(f_feats_train)
- Features features_test = features(f_feats_test)
- Labels labels_train = labels(f_labels_train)
- Labels labels_test = labels(f_labels_test)
- #![create_features]
- #![create_kernel]
- Kernel kernel_gaussian = kernel("GaussianKernel")
- kernel_gaussian.put("log_width", 2.1)
- #![create_kernel]
- #![choose_strategy]
- MulticlassStrategy one_vs_rest=multiclass_strategy("MulticlassOneVsRestStrategy")
- #![choose_strategy]
- #![create_classifier]
- Machine classifier = machine("LibSVM")
- classifier.put("epsilon",1e-5)
- #![create_classifier]
- #![create_machine]
- Machine mc_class = machine("KernelMulticlassMachine",one_vs_rest,kernel_gaussian,classifier,labels_train)
- #![create_machine]
- #![train_and_apply]
- mc_class.train(features_train)
- Labels labels_predict = mc_class.apply_multiclass(features_test)
- #![train_and_apply]
- # integration testing variables
- RealVector output = labels_predict.get_labels()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement