summaryrefslogtreecommitdiff
path: root/tools/dataProvider.h
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2015-05-19 18:09:58 +0800
committerJoe Zhao <ztuowen@gmail.com>2015-05-19 18:13:03 +0800
commit5297c7d0358f01193f9057fa0fcae82d55a2872b (patch)
treef65a58d68dfed8e7df28d438565c8a8ad55accdb /tools/dataProvider.h
parent23dc7c9c344ecfa8dde5a9cbbb406edd71d1ef37 (diff)
downloadranksvm-5297c7d0358f01193f9057fa0fcae82d55a2872b.tar.gz
ranksvm-5297c7d0358f01193f9057fa0fcae82d55a2872b.tar.bz2
ranksvm-5297c7d0358f01193f9057fa0fcae82d55a2872b.zip
added single option
Diffstat (limited to 'tools/dataProvider.h')
-rw-r--r--tools/dataProvider.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/dataProvider.h b/tools/dataProvider.h
index bf47856..348d15c 100644
--- a/tools/dataProvider.h
+++ b/tools/dataProvider.h
@@ -61,6 +61,7 @@ private:
std::vector<DataEntry*> uniq;
std::vector<DataEntry*> other;
public:
+ static bool single;
void clear(){
uniq.clear();
other.clear();
@@ -98,6 +99,8 @@ public:
}
inline int getqSize()
{
+ if (single)
+ return (int)other.size();
return (int)(uniq.size()+other.size()-1);
}
inline int getuSize()
@@ -113,6 +116,8 @@ public:
a=x/n;
b=x%n;
Eigen::VectorXd vec;
+ if (single)
+ return (uniq[a]->feature-other[b]->feature).cwiseAbs();
if (b<a)
vec=uniq[a]->feature-uniq[b]->feature;
else
@@ -126,6 +131,12 @@ public:
int a,b,n=getqSize();
a=x/n;
b=x%n;
+ if (single)
+ {
+ if (std::fabs(other[b]->rank - a) < 1e-5)
+ return 1;
+ return -1;
+ }
if (b<uniq.size()-1)
return -1;
else