From 4fd46f811f680f81efc858b788b0335427dbf26e Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Thu, 14 May 2015 11:23:27 +0800 Subject: c --- model/ranksvm.cpp | 2 ++ model/ranksvm.h | 2 ++ model/ranksvmtn.cpp | 1 - train.cpp | 7 ++++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/model/ranksvm.cpp b/model/ranksvm.cpp index 7ee72ac..bb50126 100644 --- a/model/ranksvm.cpp +++ b/model/ranksvm.cpp @@ -8,6 +8,8 @@ using namespace Eigen; using namespace std; +double C=1e-4;// Compensating & scaling + int RSVM::saveModel(const string fname){ std::ofstream fout(fname.c_str()); diff --git a/model/ranksvm.h b/model/ranksvm.h index 58cd7f0..9051343 100644 --- a/model/ranksvm.h +++ b/model/ranksvm.h @@ -37,4 +37,6 @@ public: int setModel(const SVMModel &model); }; +extern double C;// Compensating & scaling + #endif \ No newline at end of file diff --git a/model/ranksvmtn.cpp b/model/ranksvmtn.cpp index 3136426..3d0db5f 100644 --- a/model/ranksvmtn.cpp +++ b/model/ranksvmtn.cpp @@ -6,7 +6,6 @@ using namespace std; using namespace Eigen; -const double C=1e-4; // Compensating & scaling // Main terminating criteria const int maxiter = 60; // max iteration count const double prec=1e-10; // precision diff --git a/train.cpp b/train.cpp index 05787c9..0d84e24 100644 --- a/train.cpp +++ b/train.cpp @@ -27,6 +27,7 @@ int train(DataProvider &dp) { LOG(INFO)<<"Training started"; dp.getAllDataSet(D); LOG(INFO)<<"Read "<train(D); LOG(INFO)<<"Training finished,saving model"; @@ -109,7 +110,8 @@ int main(int argc, char **argv) { ("debug,d", "show debug messages") ("model,m", po::value(), "set input model file") ("output,o", po::value(), "set output model/prediction file") - ("feature,i", po::value(), "set input feature file"); + ("feature,i", po::value(), "set input feature file") + ("c,c",po::value(),"trades margin size against training error"); // Parsing program options po::store(po::parse_command_line(argc, argv, desc), vm); @@ -128,6 +130,9 @@ int main(int argc, char **argv) { mainFunc mainf; if (vm.count("train")) { + if (vm.count("c")) { + C=vm["c"].as(); + } mainf = &train; } else if (vm.count("validate")||vm.count("predict")) { -- cgit v1.2.3-70-g09d2