diff options
Diffstat (limited to 'model')
-rw-r--r-- | model/rankaccu.cpp | 2 | ||||
-rw-r--r-- | model/ranksvmtn.cpp | 16 |
2 files changed, 11 insertions, 7 deletions
diff --git a/model/rankaccu.cpp b/model/rankaccu.cpp index ba8aee6..726f2c8 100644 --- a/model/rankaccu.cpp +++ b/model/rankaccu.cpp @@ -136,7 +136,7 @@ void rank_CMC(DataList &D,const std::vector<double> pred,CMC & cmc) { for (int k=j;k<=i;++k) if (orig[pred_rank[k]]>0) { - cout<<dat[pred_rank[k]]->qid<<" "<<pred[k]<<" "<< k-j<<endl; + LOG(INFO)<<"qid:"<<dat[pred_rank[k]]->qid<<"; pred:"<<pred[k]<<"; rank:"<< k-j; cmc.addEntry(k-j); break; // account only for the first match; } diff --git a/model/ranksvmtn.cpp b/model/ranksvmtn.cpp index d3ef3af..3136426 100644 --- a/model/ranksvmtn.cpp +++ b/model/ranksvmtn.cpp @@ -8,11 +8,12 @@ using namespace Eigen; const double C=1e-4; // Compensating & scaling // Main terminating criteria -const int maxiter = 20; // max iteration count +const int maxiter = 60; // max iteration count const double prec=1e-10; // precision // conjugate gradient const double cg_prec=1e-10; // precision -const int cg_maxiter = 30; +const int cg_maxiter = 10; +const int ls_maxiter = 10; // line search const double line_prec=1e-10; // precision const double line_turb=1e-15; // purturbation @@ -61,11 +62,13 @@ int cg_solve(RidList &D,const vector<int> &rank,const VectorXd &corr,const Vecto { // Non preconditioned version r_1 = res.dot(res); + if (iter) + LOG(INFO) << "CG iter "<<iter<<", r:"<<r_1; if (r_1<cg_prec) // Terminate condition break; - if (iter > cg_maxiter) + if (iter >= cg_maxiter) { - LOG(INFO) << "CG forced termination by maxiter, r:"<<r_1; + LOG(INFO) << "CG forced termination by maxiter"; break; } if (iter){ @@ -178,9 +181,10 @@ int line_search(const VectorXd &w,RidList &D,const VectorXd &corr,const VectorXd if (g*g/h<line_prec) break; ++iter; - if (iter > cg_maxiter) + LOG(INFO) << "line search iter "<<iter<<", prec:"<<g*g/h; + if (iter >= ls_maxiter) { - LOG(INFO) << "line search forced termination by maxiter, prec:"<<g*g/h; + LOG(INFO) << "line search forced termination by maxiter"; break; } } |