summaryrefslogtreecommitdiff
path: root/model/ranksvm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'model/ranksvm.cpp')
-rw-r--r--model/ranksvm.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/model/ranksvm.cpp b/model/ranksvm.cpp
index 628ef37..dc2ad9f 100644
--- a/model/ranksvm.cpp
+++ b/model/ranksvm.cpp
@@ -13,7 +13,8 @@ int RSVM::saveModel(const string fname){
std::ofstream fout(fname.c_str());
fout<<this->getName()<<endl;
fout<<this->fsize<<endl;
- Eigen::write_stream(fout, this->model);
+ Eigen::write_stream(fout, this->model.weight);
+ fout<<this->model.beta<<endl;
return 0;
}
@@ -30,16 +31,18 @@ RSVM* RSVM::loadModel(const string fname){
rsvm = new RSVMTN();
rsvm->fsize=fsize;
- VectorXd model;
- Eigen::read_stream(fin, model);
+ SVMModel model;
+ Eigen::read_stream(fin, model.weight);
+ fin>>model.beta;
rsvm->setModel(model);
return rsvm;
}
-int RSVM::setModel(const Labels &model) {
- if (model.rows()!=fsize)
- LOG(FATAL) << "Feature size mismatch: "<<fsize<<" "<<model.cols();
- this->model=model;
+int RSVM::setModel(const SVMModel &model) {
+ if (model.weight.cols()!=fsize)
+ LOG(FATAL) << "Feature size mismatch: "<<fsize<<" "<<model.weight.cols();
+ this->model.weight=model.weight;
+ this->model.beta=model.beta;
return 0;
} \ No newline at end of file