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

Method load_dataset_and_train

src/test/test_nusvr.cpp:20–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18 vector<float_type> predict_y;
19
20 float
21 load_dataset_and_train(string train_filename, string test_filename, float_type C, float_type gamma, float_type nu) {
22 train_dataset.load_from_file(train_filename);
23 test_dataset.load_from_file(test_filename);
24 param.gamma = gamma;
25 param.C = C;
26 param.nu = nu;
27 param.kernel_type = SvmParam::RBF;
28 std::shared_ptr<SvmModel> model;
29 model.reset(new NuSVR());
30 model->train(train_dataset, param);
31 std::shared_ptr<Metric> metric;
32 metric.reset(new MSE());
33 predict_y = model->predict(test_dataset.instances(), 100);
34 return metric->score(predict_y, test_dataset.y());
35 }
36};
37
38TEST_F(NuSVRTest, 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