Skip to content

Commit 49bd8f1

Browse files
Incorporate Youssef comments
1 parent 3318ca2 commit 49bd8f1

File tree

4 files changed

+40
-12
lines changed

4 files changed

+40
-12
lines changed

paper/examples/Benchmark.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,30 @@ 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)
111+
reg_nls = RegularizedNLSModel(nls_model, RootNormLhalf(λ))
112+
solver = LMSolver(reg_nls)
113+
stats = RegularizedExecutionStats(reg_nls)
114+
RegularizedOptimization.solve!(solver, reg_nls, stats;
115+
x = x0, atol = atol, rtol = rtol, verbose = verbose)
116+
reset!(nls_model) # Reset counters before timing
117+
reg_nls = RegularizedNLSModel(nls_model, RootNormLhalf(λ))
118+
solver = LMSolver(reg_nls)
119+
t = @elapsed RegularizedOptimization.solve!(solver, reg_nls, stats;
120+
x = x0, atol = atol, rtol = rtol, verbose = verbose)
121+
return (
122+
name = "LM (SVM)",
123+
status = string(stats.status),
124+
time = t,
125+
iters = get(stats.solver_specific, :outer_iter, missing),
126+
fevals = neval_residual(nls_model),
127+
gevals = neval_jtprod_residual(nls_model) + neval_jprod_residual(nls_model),
128+
proxcalls = get(stats.solver_specific, :prox_evals, missing),
129+
solution = stats.solution,
130+
final_obj = obj(nls_model, stats.solution)
131+
)
132+
end
133+
110134
function bench_svm!(cfg = CFG)
111135
Random.seed!(cfg.SEED)
112136
model, nls_train, _ = RegularizedProblems.svm_train_model()
@@ -115,6 +139,7 @@ function bench_svm!(cfg = CFG)
115139
results = NamedTuple[]
116140
(: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))
117141
(: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))
118143

119144
# Print quick summary
120145
println("\n=== SVM: solver comparison ===")

paper/examples/Benchmark.tex

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +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 & 4.0193 & 347 & 291 & 4037 & 179.837 \\
5-
R2N (LSR1, SVM) & first\_order & 2.5033 & 185 & 101 & 27932 & 192.493 \\
6-
TR (LBFGS, NNMF) & first\_order & 0.1089 & 42 & 40 & 3160 & 976.06 \\
7-
R2N (LBFGS, NNMF) & first\_order & 0.4921 & 169 & 107 & 17789 & 411.727 \\
8-
LM (NNMF) & first\_order & 0.4542 & 15 & 27723 & 12320 & 131.183 \\\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 \\
7+
\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
911
\end{tabular}

paper/examples/comparison-config.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Base.@kwdef mutable struct Config
88
MAXIT_PANOC::Int = 10000
99
VERBOSE_PANOC::Bool = false
1010
VERBOSE_RO::Int = 0
11-
RUN_SOLVERS::Vector{Symbol} = [:TR, :R2N] # mutable
11+
RUN_SOLVERS::Vector{Symbol} = [:LM, :TR, :R2N] # mutable
1212
QN_FOR_TR::Symbol = :LSR1
1313
QN_FOR_R2N::Symbol = :LBFGS
1414
SUB_KWARGS_R2N::NamedTuple = (; max_iter = 200)
@@ -17,6 +17,6 @@ end
1717

1818
# One global, constant *binding* to a mutable object = type stable & editable
1919
const CFG = Config(QN_FOR_R2N=:LSR1)
20-
const CFG2 = Config(RUN_SOLVERS = [:LM, :TR, :R2N], QN_FOR_TR = :LBFGS)
20+
const CFG2 = Config(QN_FOR_TR = :LBFGS)
2121

2222
end # module

paper/paper.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ $$
8181
where $q$ is given, $x$ and $s$ are fixed shifts, $\chi(\cdot \mid \Delta \mathbb{B})$ is the indicator of a ball of radius $\Delta > 0$ defined by a certain norm, and $\psi(\cdot; x)$ is a model of $h$ about $x$.
8282
It is common to set $\psi(t + s; x) = h(x + s + t)$.
8383

84-
These shifted operators allow us to (i) incorporate bound or trust-region constraints via the indicator, which is required for the **TR** and **TRDH** solvers, and (ii) evaluate the above **in place**, without additional allocations, which is currently not possible with ProximalOperators.jl.
84+
These shifted operators allow to (i) incorporate bound or trust-region constraints via the indicator, which is required for the **TR** and **TRDH** solvers, and (ii) evaluate the above in place, without additional allocations, which is currently not possible with ProximalOperators.jl.
8585

8686
RegularizedOptimization.jl provides a consistent API to formulate optimization problems and apply different solvers.
8787
It integrates seamlessly with the [JuliaSmoothOptimizers](https://github.com/JuliaSmoothOptimizers) [@jso] ecosystem, an academic organization for nonlinear optimization software development, testing, and benchmarking.
@@ -106,7 +106,7 @@ reg_nls = RegularizedNLSModel(f, h)
106106
RegularizedProblems.jl also provides a set of instances commonly used in data science and in the nonsmooth optimization literature, where several choices of $f$ can be paired with various nonsmooth terms $h$.
107107
This design makes for a convenient source of reproducible problem instances for testing and benchmarking the solvers in [RegularizedOptimization.jl](https://www.github.com/JuliaSmoothOptimizers/RegularizedOptimization.jl).
108108

109-
## Support for exact or approximate second derivatives
109+
## Support for both exact and approximate Hessian
110110

111111
In contrast with [ProximalAlgorithms.jl](https://github.com/JuliaFirstOrder/ProximalAlgorithms.jl), [RegularizedOptimization.jl](https://github.com/JuliaSmoothOptimizers/RegularizedOptimization.jl), methods such as **R2N** and **TR** methods support exact Hessians as well as several Hessian approximations of $f$.
112112
Hessian–vector products $v \mapsto Hv$ can be obtained via automatic differentiation through [ADNLPModels.jl](https://github.com/JuliaSmoothOptimizers/ADNLPModels.jl) or implemented manually.
@@ -175,13 +175,14 @@ The subproblem solver is **R2**.
175175

176176
\input{examples/Benchmark.tex}
177177

178-
- For the LM solver, gradient evaluations count $\#\nabla f$ equals the number of Jacobian–vector and adjoint-Jacobian–vector products.
178+
- Note that for the LM solver, gradient evaluations count $\#\nabla f$ equals the number of Jacobian–vector and adjoint-Jacobian–vector products.
179179

180180
All methods successfully reduced the optimality measure below the specified tolerance of $10^{-4}$, and thus converged to an approximate first-order stationary point.
181-
However, the final objective values differ due to the nonconvexity of the problems.
181+
Note that, the final objective values differ due to the nonconvexity of the problems.
182182

183183
- **SVM with $\ell^{1/2}$ penalty:** **R2N** is the fastest, requiring the fewest function and gradient evaluations compared to **TR**.
184184
However, it requires more proximal evaluations, but these are inexpensive.
185+
**LM** requires the fewest function evaluations, but many gradient evaluations, and is the slowest.
185186
- **NNMF with constrained $\ell_0$ penalty:** **TR** is the fastest, and requires a fewer number of function and gradient evaluations than **R2N**. **LM** is competitive in terms of function calls but incurs many Jacobian–vector products; it nevertheless achieves the lowest objective value.
186187

187188
Additional tests (e.g., other regularizers, constraint types, and scaling dimensions) have also been conducted, and a full benchmarking campaign is currently underway.
@@ -202,6 +203,6 @@ In ongoing research, the package will be extended with algorithms that enable to
202203

203204
The authors would like to thank Alberto Demarchi for his implementation of the Augmented Lagrangian solver.
204205
Mohamed Laghdaf Habiboullah is supported by an excellence FRQNT grant.
205-
Youssef Diouane and Dominique Orban are partially supported by an NSERC Discovery Grant.
206+
Youssef Diouane, Maxence Gollier and Dominique Orban are partially supported by an NSERC Discovery Grant.
206207

207208
# References

0 commit comments

Comments
 (0)