blob: b4ec7ce5f8d71b4fe5ac5da10a48b1fd63554096 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#ifndef RANKSVM_H
#define RANKSVM_H
#include<Eigen/Dense>
#include<string>
#include"../tools/dataProvider.h"
#include "../tools/easylogging++.h"
// Model File:
// Model type -> String
// Number of features (fsize) -> int
// Weight matrix size, (fsize,1) -> (int,int)
// Weight vector
// beta
typedef struct SVMModel{
Eigen::VectorXd weight;
double beta;
} SVMModel;
class RSVM //Virtual base class for all RSVM operations
{
protected:
SVMModel model;
int fsize;
public:
virtual int train(DataSet &D, Labels &label)=0;
virtual int predict(DataSet &D, Labels &res)=0;
// TODO Not sure how to construct this
// Possible solution: generate a nxn matrix each row contains the sorted list of ranker result.
int saveModel(const std::string fname);
static RSVM* loadModel(const std::string fname);
virtual std::string getName()=0;
SVMModel getModel(){
return model;};
int setModel(const SVMModel &model);
};
#endif
|