diff options
| author | Joe Zhao <ztuowen@gmail.com> | 2015-05-25 12:48:14 +0800 | 
|---|---|---|
| committer | Joe Zhao <ztuowen@gmail.com> | 2015-05-25 12:48:14 +0800 | 
| commit | 52b6b61d62b717b35af0c576733c7a305265c7d7 (patch) | |
| tree | ac6d04d30002e2c1722477a6a462dc3956f78320 | |
| parent | 6877bbb4a9d162d0d4336bca8f74c35ca062a347 (diff) | |
| download | ranksvm-52b6b61d62b717b35af0c576733c7a305265c7d7.tar.gz ranksvm-52b6b61d62b717b35af0c576733c7a305265c7d7.tar.bz2 ranksvm-52b6b61d62b717b35af0c576733c7a305265c7d7.zip  | |
full pairs cont.
| -rw-r--r-- | model/ranksvmtn.cpp | 2 | ||||
| -rw-r--r-- | tools/dataProvider.h | 30 | 
2 files changed, 21 insertions, 11 deletions
diff --git a/model/ranksvmtn.cpp b/model/ranksvmtn.cpp index 5916170..9beed65 100644 --- a/model/ranksvmtn.cpp +++ b/model/ranksvmtn.cpp @@ -212,7 +212,7 @@ int train_orig(int fsize, RidList &Data,const VectorXd &corr,VectorXd &weight){      int iter = 0;      long n=Data.getSize(); -    LOG(INFO) << "training with feature size:" << fsize << " Data size:" << n << " Query size:" << Data.getqSize(); +    LOG(INFO) << "training with feature size:" << fsize << " Data size:" << Data.getSize() << " Query size:" << Data.getqSize();      VectorXd grad(fsize);      VectorXd step(fsize);      vector<int> rank(n); diff --git a/tools/dataProvider.h b/tools/dataProvider.h index 390432e..07f1989 100644 --- a/tools/dataProvider.h +++ b/tools/dataProvider.h @@ -144,13 +144,18 @@ public:          b=x%q;          double res = 0;          Eigen::VectorXd *id,*oth; -        id = &(uniq[a]->feature);          if (single) +        { +            id = &(uniq[a]->feature);              oth = &(other[b]->feature); -        else if (b<a) -            oth = &(all[b]->feature); -        else -            oth = &(all[b+1]->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 += fabs((*id)[i] - (*oth)[i])*w[i];          return res; @@ -161,13 +166,18 @@ public:          a=x/q;          b=x%q;          Eigen::VectorXd *id,*oth; -        id = &(uniq[a]->feature);          if (single) +        { +            id = &(uniq[a]->feature);              oth = &(other[b]->feature); -        else if (b<a) -            oth = &(all[b]->feature); -        else -            oth = &(all[b+1]->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)              X[i] += fabs((*id)[i] - (*oth)[i])*w;      }  | 
