summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2015-05-15 20:38:04 +0800
committerJoe Zhao <ztuowen@gmail.com>2015-05-15 20:38:04 +0800
commit0cd52e0cae3ab1f6411765dff69359809a0ae83e (patch)
tree9d01a0d027896d625314da7b8cbb2f7e19b938c8
parentff9d455740a4ec246da1a7942e962a700d3579ef (diff)
downloadranksvm-0cd52e0cae3ab1f6411765dff69359809a0ae83e.tar.gz
ranksvm-0cd52e0cae3ab1f6411765dff69359809a0ae83e.tar.bz2
ranksvm-0cd52e0cae3ab1f6411765dff69359809a0ae83e.zip
reordering, iter, output, check
-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;
}