Skip to content

Commit ff192ad

Browse files
committed
Port "Move warning reaching max iter for dual L1-loss SVM and dual L1-loss SVR to train_one()"
Ported from cjlin1/liblinear@d07e89b
1 parent f206a58 commit ff192ad

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main/java/de/bwaldvogel/liblinear/Linear.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,6 @@ private static int solve_l2r_l1l2_svc(Problem prob, Parameter param, double[] w,
767767
}
768768

769769
info("%noptimization finished, #iter = %d%n", iter);
770-
if (solver_type == L2R_L1LOSS_SVC_DUAL && iter >= max_iter)
771-
info("%nWARNING: reaching max number of iterations%nUsing -s 2 may be faster (also see FAQ)%n%n");
772770

773771
// calculate objective value
774772

@@ -961,8 +959,6 @@ else if (Gn > H * beta[i])
961959
}
962960

963961
info("%noptimization finished, #iter = %d%n", iter);
964-
if (solver_type == L2R_L1LOSS_SVR_DUAL && iter >= max_iter)
965-
info("%nWARNING: reaching max number of iterations%nUsing -s 11 may be faster%n%n");
966962

967963
// calculate objective value
968964
double v = 0;
@@ -2310,7 +2306,9 @@ private static void train_one(Problem prob, Parameter param, double[] w, double
23102306
break;
23112307
}
23122308
case L2R_L1LOSS_SVC_DUAL: {
2313-
solve_l2r_l1l2_svc(prob, param, w, Cp, Cn, dual_solver_max_iter);
2309+
iter = solve_l2r_l1l2_svc(prob, param, w, Cp, Cn, dual_solver_max_iter);
2310+
if (iter >= dual_solver_max_iter)
2311+
info("%nWARNING: reaching max number of iterations%nUsing -s 2 may be faster (also see FAQ)%n%n");
23142312
break;
23152313
}
23162314
case L1R_L2LOSS_SVC: {
@@ -2343,7 +2341,10 @@ private static void train_one(Problem prob, Parameter param, double[] w, double
23432341

23442342
}
23452343
case L2R_L1LOSS_SVR_DUAL: {
2346-
solve_l2r_l1l2_svr(prob, param, w, dual_solver_max_iter);
2344+
iter = solve_l2r_l1l2_svr(prob, param, w, dual_solver_max_iter);
2345+
if (iter >= dual_solver_max_iter)
2346+
info("%nWARNING: reaching max number of iterations%nUsing -s 11 may be faster (also see FAQ)%n%n");
2347+
23472348
break;
23482349
}
23492350
case L2R_L2LOSS_SVR_DUAL: {

0 commit comments

Comments
 (0)