#ifndef RANKSVM_H #define RANKSVM_H #include #include #include #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(RidList &D)=0; virtual int predict(RidList &D,std::vector &res)=0; 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); }; extern double C;// Compensating & scaling // Main terminating criteria extern int maxiter; // max iteration count extern double prec; // precision // conjugate gradient extern double cg_prec; // precision extern int cg_maxiter; // not worth having a large number extern int ls_maxiter; // line search extern double ls_prec; // precision extern double ls_turb; // perturbation #endif