summaryrefslogtreecommitdiff
path: root/model/ranksvmtn.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'model/ranksvmtn.cpp')
-rw-r--r--model/ranksvmtn.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/model/ranksvmtn.cpp b/model/ranksvmtn.cpp
index 7e8b882..3b60c65 100644
--- a/model/ranksvmtn.cpp
+++ b/model/ranksvmtn.cpp
@@ -181,10 +181,10 @@ int line_search(const VectorXd &w,RidList &D,const VectorXd &corr,const VectorXd
g=g+line_turb;
h = h+line_turb;
t=t-g/h;
- if (g*g/h<line_prec)
- break;
++iter;
LOG(INFO) << "line search iter "<<iter<<", prec:"<<g*g/h;
+ if (g*g/h<line_prec)
+ break;
if (iter >= ls_maxiter)
{
LOG(INFO) << "line search forced termination by maxiter";
@@ -209,13 +209,6 @@ int train_orig(int fsize, RidList &Data,const VectorXd &corr,VectorXd &weight){
VectorXd alpha,beta;
while (true)
{
- iter+=1;
- if (iter> maxiter)
- {
- LOG(INFO)<< "Maxiter reached";
- break;
- }
-
for (int i=0;i<n;++i)
dw(i) = Data.getVec(i).dot(weight);
cal_alpha_beta(dw,corr,Data,rank,yt,alpha,beta);
@@ -234,7 +227,13 @@ int train_orig(int fsize, RidList &Data,const VectorXd &corr,VectorXd &weight){
weight=weight+step*t;
// When dec is small enough
double nprec = step.dot(grad)/obj;
+ ++iter;
LOG(INFO)<<"Iter: "<<iter<<" Obj: " <<obj << " Ndec/Obj:"<<nprec << " linesearch: "<< -t ;
+ if (iter> maxiter)
+ {
+ LOG(INFO)<< "Maxiter reached";
+ break;
+ }
if (nprec < prec)
break;
}