diff options
author | Joe Zhao <ztuowen@gmail.com> | 2015-05-19 18:09:58 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2015-05-19 18:13:03 +0800 |
commit | 5297c7d0358f01193f9057fa0fcae82d55a2872b (patch) | |
tree | f65a58d68dfed8e7df28d438565c8a8ad55accdb /tools | |
parent | 23dc7c9c344ecfa8dde5a9cbbb406edd71d1ef37 (diff) | |
download | ranksvm-5297c7d0358f01193f9057fa0fcae82d55a2872b.tar.gz ranksvm-5297c7d0358f01193f9057fa0fcae82d55a2872b.tar.bz2 ranksvm-5297c7d0358f01193f9057fa0fcae82d55a2872b.zip |
added single option
Diffstat (limited to 'tools')
-rw-r--r-- | tools/dataProvider.cpp | 7 | ||||
-rw-r--r-- | tools/dataProvider.h | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tools/dataProvider.cpp b/tools/dataProvider.cpp new file mode 100644 index 0000000..deb3b78 --- /dev/null +++ b/tools/dataProvider.cpp @@ -0,0 +1,7 @@ +// +// Created by joe on 5/19/15. +// + +#include "../tools/dataProvider.h" + +bool RidList::single = false;
\ No newline at end of file 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 |