From 653bee4b89131a997043a074d51c28dedb907f5c Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Mon, 18 May 2015 16:17:01 +0800 Subject: output update --- model/ranksvmtn.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'model/ranksvmtn.cpp') diff --git a/model/ranksvmtn.cpp b/model/ranksvmtn.cpp index 01d9851..0e41861 100644 --- a/model/ranksvmtn.cpp +++ b/model/ranksvmtn.cpp @@ -6,13 +6,13 @@ using namespace std; using namespace Eigen; -const double C=1e-4; // Compensating & scaling // Main terminating criteria -const int maxiter = 20; // max iteration count +const int maxiter = 40; // 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 = 5; // not worth having a large number +const int ls_maxiter = 10; // line search const double line_prec=1e-10; // precision const double line_turb=1e-15; // purturbation @@ -54,11 +54,13 @@ int cg_solve(const MatrixXd &D,const vector &rank,const VectorXd &corr,cons { // Non preconditioned version r_1 = res.dot(res); + if (iter) + LOG(INFO) << "CG iter "< cg_maxiter) + if (iter >= cg_maxiter) { - LOG(INFO) << "CG forced termination by maxiter, r:"< cg_maxiter) + if (iter >= ls_maxiter) { LOG(INFO) << "line search forced termination by maxiter, prec:"< &A1,const vector &A VectorXd alpha,beta; while (true) { - iter+=1; if (iter> maxiter) { LOG(INFO)<< "Maxiter reached"; @@ -208,8 +210,15 @@ int train_orig(int fsize, MatrixXd &D,const vector &A1,const vector &A line_search(weight,D,corr,A1,A2,step,t); weight=weight+step*t; // When dec is small enough - LOG(INFO)<<"Iter: "< maxiter) + { + LOG(INFO)<< "Maxiter reached"; + break; + } + if (nprec < prec) break; } return 0; -- cgit v1.2.3-70-g09d2