Skip to content

Commit db114d6

Browse files
make LM a bit faster
1 parent 2d9fece commit db114d6

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

paper/examples/Benchmark.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,17 @@ function run_r2n_svm!(model, x0; λ = 1.0, qn = :LBFGS, atol = 1e-3, rtol = 1e-3
107107
)
108108
end
109109

110-
function run_LM_svm!(nls_model, x0; λ = 1.0, atol = 1e-3, rtol = 1e-3, verbose = 0)
110+
function run_LM_svm!(nls_model, x0; λ = 1.0, atol = 1e-3, rtol = 1e-3, verbose = 0, sub_kwargs = (;))
111111
reg_nls = RegularizedNLSModel(nls_model, RootNormLhalf(λ))
112112
solver = LMSolver(reg_nls)
113113
stats = RegularizedExecutionStats(reg_nls)
114114
RegularizedOptimization.solve!(solver, reg_nls, stats;
115-
x = x0, atol = atol, rtol = rtol, verbose = verbose)
115+
x = x0, atol = atol, rtol = rtol, verbose = verbose, sub_kwargs = sub_kwargs)
116116
reset!(nls_model) # Reset counters before timing
117117
reg_nls = RegularizedNLSModel(nls_model, RootNormLhalf(λ))
118118
solver = LMSolver(reg_nls)
119119
t = @elapsed RegularizedOptimization.solve!(solver, reg_nls, stats;
120-
x = x0, atol = atol, rtol = rtol, verbose = verbose)
120+
x = x0, atol = atol, rtol = rtol, verbose = verbose, sub_kwargs = sub_kwargs)
121121
return (
122122
name = "LM (SVM)",
123123
status = string(stats.status),
@@ -139,7 +139,7 @@ function bench_svm!(cfg = CFG)
139139
results = NamedTuple[]
140140
(:TR in cfg.RUN_SOLVERS) && push!(results, run_tr_svm!(model, x0; λ = cfg.LAMBDA_L0, qn = cfg.QN_FOR_TR, atol = cfg.TOL, rtol = cfg.RTOL, verbose = cfg.VERBOSE_RO, sub_kwargs = cfg.SUB_KWARGS_R2N))
141141
(:R2N in cfg.RUN_SOLVERS) && push!(results, run_r2n_svm!(model, x0; λ = cfg.LAMBDA_L0, qn = cfg.QN_FOR_R2N, atol = cfg.TOL, rtol = cfg.RTOL, verbose = cfg.VERBOSE_RO, sub_kwargs = cfg.SUB_KWARGS_R2N))
142-
(:LM in cfg.RUN_SOLVERS) && push!(results, run_LM_svm!(nls_train, x0; λ = cfg.LAMBDA_L0, atol = cfg.TOL, rtol = cfg.RTOL, verbose = cfg.VERBOSE_RO))
142+
(:LM in cfg.RUN_SOLVERS) && push!(results, run_LM_svm!(nls_train, x0; λ = cfg.LAMBDA_L0, atol = cfg.TOL, rtol = cfg.RTOL, verbose = cfg.VERBOSE_RO, sub_kwargs = cfg.SUB_KWARGS_R2N))
143143

144144
# Print quick summary
145145
println("\n=== SVM: solver comparison ===")

paper/examples/Benchmark.tex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
\begin{tabular}{lcrrrrr}
22
\hline
33
\textbf{Method} & \textbf{Status} & \textbf{$t$($s$)} & \textbf{$\#f$} & \textbf{$\#\nabla f$} & \textbf{$\#prox$} & \textbf{Objective} \\\hline
4-
TR (LSR1, SVM) & first\_order & 2.3656 & 347 & 291 & 4037 & 179.837 \\
5-
R2N (LSR1, SVM) & first\_order & 0.9742 & 185 & 101 & 27932 & 192.493 \\
6-
LM (SVM) & first\_order & 24.6641 & 6 & 9161 & 3644 & 202.731 \\
4+
TR (LSR1, SVM) & first\_order & 3.4768 & 347 & 291 & 4037 & 179.837 \\
5+
R2N (LSR1, SVM) & first\_order & 1.728 & 185 & 101 & 27932 & 192.493 \\
6+
LM (SVM) & first\_order & 18.0861 & 6 & 2876 & 1001 & 201.186 \\
77
\hline
8-
TR (LBFGS, NNMF) & first\_order & 0.0542 & 42 & 40 & 3160 & 976.06 \\
9-
R2N (LBFGS, NNMF) & first\_order & 0.2905 & 169 & 107 & 17789 & 411.727 \\
10-
LM (NNMF) & first\_order & 0.2596 & 15 & 27703 & 12320 & 131.183 \\\hline
8+
TR (LBFGS, NNMF) & first\_order & 0.1013 & 42 & 40 & 3160 & 976.06 \\
9+
R2N (LBFGS, NNMF) & first\_order & 0.4974 & 169 & 107 & 17789 & 411.727 \\
10+
LM (NNMF) & first\_order & 0.4654 & 15 & 27703 & 12320 & 131.183 \\\hline
1111
\end{tabular}

0 commit comments

Comments
 (0)