summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2015-05-25 16:26:52 +0800
committerJoe Zhao <ztuowen@gmail.com>2015-05-25 16:26:52 +0800
commit2df038e399a97cc80c9d57682d05f1eeaa9ced89 (patch)
tree4e3d3604fa302ac7cdc36d6502acc189d178f218
parentb86b167aae7d19bc8694d7ad21eae5b58cef81b7 (diff)
downloadranksvm-2df038e399a97cc80c9d57682d05f1eeaa9ced89.tar.gz
ranksvm-2df038e399a97cc80c9d57682d05f1eeaa9ced89.tar.bz2
ranksvm-2df038e399a97cc80c9d57682d05f1eeaa9ced89.zip
full pairs cont.
-rw-r--r--tools/dataProvider.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/dataProvider.h b/tools/dataProvider.h
index 9682649..47946c8 100644
--- a/tools/dataProvider.h
+++ b/tools/dataProvider.h
@@ -73,8 +73,11 @@ public:
inline int getfSize(){return n;}
void addEntry(DataEntry* d){
int ext=false;
- if (d->qid=="-1")
+ all.push_back(d);
+ if (d->qid=="-1") {
other.push_back(d);
+ return;
+ }
for (int i=0;i<uniq.size();++i)
if (uniq[i]->qid==d->qid)
{
@@ -84,8 +87,10 @@ public:
if (ext)
other.push_back(d);
else
+ {
uniq.push_back(d);
- all.push_back(d);
+ d->rank=uniq.size()-1;
+ }
}
inline DataEntry* getU(int x)
{
@@ -192,7 +197,7 @@ public:
b=x%q;
if (single)
{
- if (std::fabs(other[b]->rank - a) < 1e-5)
+ if (fabs(other[b]->rank - a) < 1e-5)
return 1;
return -1;
}
@@ -202,7 +207,7 @@ public:
oth = all[b]->rank;
else
oth = all[b+1]->rank;
- if (std::fabs(oth - id) < 1e-5)
+ if (fabs(oth - id) < 1e-5)
return 1;
return -1;
};