diff options
author | Joe Zhao <ztuowen@gmail.com> | 2015-05-18 22:25:58 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2015-05-18 22:25:58 +0800 |
commit | 1f53fe7adbb14e71d1c41459a8e4b579ef43559c (patch) | |
tree | 89c81edc6b313c9c6f827ef15f7228ad533e42af | |
parent | def2bcd3f41a36e52b179aa435c5bf29c94dab5e (diff) | |
download | ranksvm-1f53fe7adbb14e71d1c41459a8e4b579ef43559c.tar.gz ranksvm-1f53fe7adbb14e71d1c41459a8e4b579ef43559c.tar.bz2 ranksvm-1f53fe7adbb14e71d1c41459a8e4b579ef43559c.zip |
revert
-rw-r--r-- | tools/dataProvider.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/dataProvider.h b/tools/dataProvider.h index 59b989a..bf47856 100644 --- a/tools/dataProvider.h +++ b/tools/dataProvider.h @@ -98,7 +98,7 @@ public: } inline int getqSize() { - return (int)other.size(); + return (int)(uniq.size()+other.size()-1); } inline int getuSize() { @@ -113,13 +113,23 @@ public: a=x/n; b=x%n; Eigen::VectorXd vec; - return (uniq[a]->feature-other[b]->feature).cwiseAbs(); + if (b<a) + vec=uniq[a]->feature-uniq[b]->feature; + else + if (b<uniq.size()-1) + vec=uniq[a]->feature-uniq[b+1]->feature; + else + vec=uniq[a]->feature-other[b-uniq.size()+1]->feature; + return vec.cwiseAbs(); }; inline double getL(int x){ int a,b,n=getqSize(); a=x/n; b=x%n; - if (std::fabs(other[b]->rank - a) < 1e-5) + if (b<uniq.size()-1) + return -1; + else + if (std::fabs(other[b-uniq.size()+1]->rank - a) < 1e-5) return 1; return -1; }; |