From 85a4962556b67d1cc0668ecb2fbb03b3b4dd6e7e Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Sat, 11 Apr 2015 17:46:19 +0800 Subject: completed & tested, train & predict --- main.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 1cb18b9..e89cfe1 100644 --- a/main.cpp +++ b/main.cpp @@ -6,6 +6,7 @@ #include "model/ranksvmtn.h" #include "tools/fileDataProvider.h" #include "tools/matrixIO.h" +#include INITIALIZE_EASYLOGGINGPP @@ -25,6 +26,7 @@ int train() { LOG(INFO)<<"Training started"; dp.getDataSet(D); + LOG(INFO)<<"Read "<train(D); LOG(INFO)<<"Training finished,saving model"; @@ -39,15 +41,27 @@ int predict() { RSVM *rsvm; rsvm = RSVM::loadModel(vm["model"].as().c_str()); FileDP dp(vm["feature"].as().c_str()); + + dp.open(); DataList D; - std::list L; + std::vector L; + LOG(INFO)<<"Prediction started"; + while (!dp.EOFile()) { dp.getDataSet(D); + LOG(INFO)<<"Read "<predict(D,L); } - // TODO output Eigen::write_stream(std::cout, L); + LOG(INFO)<<"Training finished,saving prediction"; + std::ofstream fout(vm["output"].as().c_str()); + + for (int i=0; i(), "set input model file") - ("output,o", po::value(), "set output model file") + ("output,o", po::value(), "set output model/prediction file") ("feature,i", po::value(), "set input feature file"); // Parsing program options -- cgit v1.2.3-70-g09d2