MCPcopy Create free account
hub / github.com/Xtra-Computing/thundersvm / load_dataset_and_train

Method load_dataset_and_train

src/test/test_svc.cpp:17–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 vector<float_type> predict_y;
16
17 float load_dataset_and_train(string train_filename, string test_filename, float_type C, float_type gamma) {
18 train_dataset.load_from_file(train_filename);
19 test_dataset.load_from_file(test_filename);
20 param.gamma = gamma;
21 param.C = C;
22 param.kernel_type = SvmParam::RBF;
23 std::shared_ptr<SvmModel> model;
24 model.reset(new SVC());
25 model->train(train_dataset, param);
26 std::shared_ptr<Metric> metric;
27 metric.reset(new Accuracy());
28 predict_y = model->predict(test_dataset.instances(), 100);
29 return metric->score(predict_y, test_dataset.y());
30 }
31};
32
33TEST_F(SVCTest, test_set) {

Callers

nothing calls this directly

Calls 5

instancesMethod · 0.80
scoreMethod · 0.80
load_from_fileMethod · 0.45
trainMethod · 0.45
predictMethod · 0.45

Tested by

no test coverage detected