summaryrefslogtreecommitdiff
path: root/tools/dataProvider.h
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2015-05-31 23:47:10 +0800
committerJoe Zhao <ztuowen@gmail.com>2015-05-31 23:47:10 +0800
commit17be62773adb99fc3fac11c13b3f7cd8bf5f2258 (patch)
treeed696a0da8617df487fcbd2d2baae1cd92abdf92 /tools/dataProvider.h
parentf77a4937a5f09d1f49a114ada70b9e11be44b1d6 (diff)
downloadranksvm-17be62773adb99fc3fac11c13b3f7cd8bf5f2258.tar.gz
ranksvm-17be62773adb99fc3fac11c13b3f7cd8bf5f2258.tar.bz2
ranksvm-17be62773adb99fc3fac11c13b3f7cd8bf5f2258.zip
misc
Diffstat (limited to 'tools/dataProvider.h')
-rw-r--r--tools/dataProvider.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/dataProvider.h b/tools/dataProvider.h
index 47946c8..65a6b63 100644
--- a/tools/dataProvider.h
+++ b/tools/dataProvider.h
@@ -128,6 +128,28 @@ public:
{
return getuSize()*getqSize();
}
+ inline double getBha(int x){
+ int a,b,q=getqSize();
+ a=x/q;
+ b=x%q;
+ double res = 0;
+ Eigen::VectorXd *id,*oth;
+ if (single)
+ {
+ id = &(uniq[a]->feature);
+ oth = &(other[b]->feature);
+ }
+ else {
+ id = &(all[a]->feature);
+ if (b<a)
+ oth = &(all[b]->feature);
+ else
+ oth = &(all[b+1]->feature);
+ }
+ for (int i=0;i<n;++i)
+ res += sqrt((*id)[i] * (*oth)[i]);
+ return -log(res);
+ }
inline Eigen::VectorXd getVec(int x){
int a,b,q=getqSize();
a=x/q;