From d07e89bbedee26a81998445ef0846dfd9ac189c7 Mon Sep 17 00:00:00 2001 From: Chih-Jen Lin Date: Thu, 12 Nov 2020 20:09:34 +0800 Subject: [PATCH] Move warning reaching max iter for dual L1-loss SVM and dual L1-loss SVR to train_one() --- linear.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/linear.cpp b/linear.cpp index 7e1b2ea..2e44ace 100644 --- a/linear.cpp +++ b/linear.cpp @@ -1048,8 +1048,6 @@ static int solve_l2r_l1l2_svc(const problem *prob, const parameter *param, doubl } info("\noptimization finished, #iter = %d\n",iter); - if (solver_type == L2R_L1LOSS_SVC_DUAL && iter >= max_iter) - info("\nWARNING: reaching max number of iterations\nUsing -s 2 may be faster (also see FAQ)\n\n"); // calculate objective value @@ -1264,8 +1262,6 @@ static int solve_l2r_l1l2_svr(const problem *prob, const parameter *param, doubl } info("\noptimization finished, #iter = %d\n", iter); - if(solver_type == L2R_L1LOSS_SVR_DUAL && iter >= max_iter) - info("\nWARNING: reaching max number of iterations\nUsing -s 11 may be faster\n\n"); // calculate objective value double v = 0; @@ -2704,7 +2700,9 @@ static void train_one(const problem *prob, const parameter *param, double *w, do } case L2R_L1LOSS_SVC_DUAL: { - solve_l2r_l1l2_svc(prob, param, w, Cp, Cn, dual_solver_max_iter); + iter = solve_l2r_l1l2_svc(prob, param, w, Cp, Cn, dual_solver_max_iter); + if(iter >= dual_solver_max_iter) + info("\nWARNING: reaching max number of iterations\nUsing -s 2 may be faster (also see FAQ)\n\n"); break; } case L1R_L2LOSS_SVC: @@ -2754,7 +2752,10 @@ static void train_one(const problem *prob, const parameter *param, double *w, do } case L2R_L1LOSS_SVR_DUAL: { - solve_l2r_l1l2_svr(prob, param, w, dual_solver_max_iter); + iter = solve_l2r_l1l2_svr(prob, param, w, dual_solver_max_iter); + if(iter >= dual_solver_max_iter) + info("\nWARNING: reaching max number of iterations\nUsing -s 11 may be faster (also see FAQ)\n\n"); + break; } case L2R_L2LOSS_SVR_DUAL: -- 2.50.1