summaryrefslogtreecommitdiff
path: root/tools/dataProvider.h
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2015-04-10 20:39:00 +0800
committerJoe Zhao <ztuowen@gmail.com>2015-04-10 20:39:00 +0800
commit705f3731f4c49a75e2824d16622ff853634335c7 (patch)
tree8c6a171615f27d0cb25484f72ccf1f84391eb9c3 /tools/dataProvider.h
parent01b523c7ce4eb5e692b0dcbec63efac0e8d1e2c7 (diff)
downloadranksvm-705f3731f4c49a75e2824d16622ff853634335c7.tar.gz
ranksvm-705f3731f4c49a75e2824d16622ff853634335c7.tar.bz2
ranksvm-705f3731f4c49a75e2824d16622ff853634335c7.zip
structuring input
Diffstat (limited to 'tools/dataProvider.h')
-rw-r--r--tools/dataProvider.h27
1 files changed, 13 insertions, 14 deletions
diff --git a/tools/dataProvider.h b/tools/dataProvider.h
index bff1f44..fbf554b 100644
--- a/tools/dataProvider.h
+++ b/tools/dataProvider.h
@@ -16,10 +16,6 @@
// Use -1 to indicate not yet labeled data
// -1s will be excluded from training
-typedef Eigen::MatrixXd DataSet;
-
-typedef Eigen::VectorXd Labels;
-
typedef struct DataEntry{
int qid;
double rank;
@@ -29,28 +25,31 @@ typedef struct DataEntry{
class DataList{
private:
int n;
- std::list<DataEntry> data;
+ std::list<DataEntry*> data;
public:
int getSize(){return data.size();}
- void addEntry(DataEntry d){data.push_front(d);}
+ void addEntry(DataEntry* d){data.push_front(d);}
void setfSize(int fsize){n=fsize;}
int getfSize(){return n;}
+ int clear(){
+ for (std::list<DataEntry*>::iterator i=data.begin(),end=data.end();i!=end;++i)
+ delete *i;
+ data.clear();
+ }
+ std::list<DataEntry*> getData(){
+ return data;
+ }
+ ~DataList(){
+ clear();
+ }
};
class DataProvider //Virtual base class for data input
{
protected:
- int size;
- int attrSize;
bool eof;
public:
DataProvider():eof(false){};
- int getSize(){
- return size;
- }
- int getAttrSize(){
- return attrSize;
- }
bool EOFile(){return eof;}