diff options
author | Joe Zhao <ztuowen@gmail.com> | 2015-03-08 17:47:33 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2015-03-08 17:47:33 +0800 |
commit | f2d01e30f459818f0589e06839d38999aecfdc06 (patch) | |
tree | 9530ac898c1d4cdecbb5194cbd76288e57f7f7b1 /tools | |
parent | 22882d7113c13cb1e00c59b54050f16ac1b7cc30 (diff) | |
download | ranksvm-f2d01e30f459818f0589e06839d38999aecfdc06.tar.gz ranksvm-f2d01e30f459818f0589e06839d38999aecfdc06.tar.bz2 ranksvm-f2d01e30f459818f0589e06839d38999aecfdc06.zip |
scaffolding
Diffstat (limited to 'tools')
-rw-r--r-- | tools/dataProvider.h | 17 | ||||
-rw-r--r-- | tools/fileDataProvider.h | 15 |
2 files changed, 23 insertions, 9 deletions
diff --git a/tools/dataProvider.h b/tools/dataProvider.h index d9440ce..0e6ed9e 100644 --- a/tools/dataProvider.h +++ b/tools/dataProvider.h @@ -3,8 +3,21 @@ #include<Eigen/Dense> #include "../tools/easylogging++.h" +#include<vector> // TODO decide how to construct training data +// One possible way for training data: +// Matrix composed of an array of feature vectors +// Labels are composed of linked list, such as +// 6,3,4,0,5,0,0 +// => 0->6 | 1->3 | 2->4->5 +// How to compensate for non exhaustive labeling? +// Use -1 to indicate not yet labeled data +// -1s will be excluded from training + +typedef Eigen::MatrixXd DataSet; + +typedef std::vector<double> Labels; class DataProvider //Virtual base class for data input { @@ -19,8 +32,8 @@ public: return attrSize; } - virtual Eigen::MatrixXd* getAttr() = 0; - virtual Eigen::VectorXd* getPref() = 0; + virtual int getDataSet(DataSet &out) = 0; + virtual int getLabel(Labels &out) = 0; virtual int open()=0; virtual bool EOFile()=0; }; diff --git a/tools/fileDataProvider.h b/tools/fileDataProvider.h index 7937866..fd8f00d 100644 --- a/tools/fileDataProvider.h +++ b/tools/fileDataProvider.h @@ -8,17 +8,18 @@ class FileDP:public DataProvider { private: std::string fname; + bool eof; public: - FileDP(){}; - FileDP(std::string fn):fname(fn){}; - virtual Eigen::MatrixXd* getAttr(){ - return new Eigen::MatrixXd(3,3); + FileDP(std::string fn=""):fname(fn),eof(false){}; + void setFname(std::string fn){fname=fn;}; + virtual int getDataSet(DataSet &out){ + return 0; } - virtual Eigen::VectorXd* getPref(){ - return new Eigen::VectorXd(3); + virtual int getLabel(Labels &out){ + return 0; }; virtual int open(){return 0;}; - virtual bool EOFile(){return true;}; + virtual bool EOFile(){return eof;}; }; #endif
\ No newline at end of file |