Skip to content

Commit 2fdbb18

Browse files
remove panoc wrappers
1 parent 3fb090e commit 2fdbb18

File tree

3 files changed

+2
-111
lines changed

3 files changed

+2
-111
lines changed

paper/examples/Bench-utils.jl

Lines changed: 0 additions & 58 deletions
This file was deleted.

paper/examples/Benchmark.jl

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,6 @@ end
5555
# Accuracy for SVM (as in original script)
5656
acc = vec -> length(findall(x -> x < 1, vec)) / length(vec) * 100
5757

58-
# PANOC (SVM) with RootNormLhalf
59-
function run_panoc_svm!(model, x0; λ = 1.0, maxit = 500, tol = 1e-3, verbose = false)
60-
f = BenchUtils.Counting(model)
61-
g = BenchUtils.Counting(RootNormLhalf(λ))
62-
algo = ProximalAlgorithms.PANOC(maxit = maxit, tol = tol, verbose = verbose)
63-
x̂, it = algo(x0 = x0, f = f, g = g)
64-
BenchUtils.reset_counters!(f)
65-
BenchUtils.reset_counters!(g)
66-
t = @elapsed x̂, it = algo(x0 = x0, f = f, g = g)
67-
return (
68-
name = "PANOC (SVM)",
69-
status = "first_order",
70-
time = t,
71-
iters = it,
72-
fevals = f.eval_count,
73-
gevals = f.gradient_count,
74-
proxcalls = g.prox_count,
75-
solution = x̂,
76-
final_obj = obj(model, x̂)
77-
)
78-
end
79-
8058
function run_tr_svm!(model, x0; λ = 1.0, qn = :LSR1, atol = 1e-3, rtol = 1e-3, verbose = 0, sub_kwargs = (;))
8159
qn_model = ensure_qn(model, qn)
8260
reset!(qn_model)
@@ -135,7 +113,6 @@ function bench_svm!(cfg = CFG)
135113
x0 = model.meta.x0
136114

137115
results = NamedTuple[]
138-
(:PANOC in cfg.RUN_SOLVERS) && push!(results, run_panoc_svm!(model, x0; λ = cfg.LAMBDA_L0, maxit = cfg.MAXIT_PANOC, tol = cfg.TOL, verbose = cfg.VERBOSE_PANOC))
139116
(: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))
140117
(: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))
141118

@@ -173,33 +150,6 @@ end
173150
# ======= NNMF bench ====== #
174151
#############################
175152

176-
function run_panoc_nnmf!(model, x0; λ = 1.0, maxit = 500, tol = 1e-3, verbose = false, selected = nothing)
177-
f = BenchUtils.Counting(model)
178-
# Define the nonsmooth term for panoc
179-
dim = model.meta.nvar
180-
l = zeros(dim)
181-
u = fill(Inf, dim)
182-
h = ShiftedNormL0Box(NormL0(λ), zeros(dim), zeros(dim), l, u, false, selected)
183-
h_panoc = BenchUtils.MyShiftedl0Box(h)
184-
g = BenchUtils.Counting(h_panoc)
185-
algo = ProximalAlgorithms.PANOC(maxit = maxit, tol = tol, verbose = verbose)
186-
x̂, it = algo(x0 = x0, f = f, g = g)
187-
BenchUtils.reset_counters!(f)
188-
BenchUtils.reset_counters!(g)
189-
t = @elapsed x̂, it = algo(x0 = x0, f = f, g = g)
190-
return (
191-
name = "PANOC (NNMF)",
192-
status = "first_order",
193-
time = t,
194-
iters = it,
195-
fevals = f.eval_count,
196-
gevals = f.gradient_count,
197-
proxcalls = g.prox_count,
198-
solution = x̂,
199-
final_obj = obj(model, x̂)
200-
)
201-
end
202-
203153
function run_tr_nnmf!(model, x0; λ = 1.0, qn = :LSR1, atol = 1e-3, rtol = 1e-3, verbose = 0, sub_kwargs = (;), selected = nothing)
204154
qn_model = ensure_qn(model, qn)
205155
reset!(qn_model)
@@ -291,7 +241,6 @@ function bench_nnmf!(cfg = CFG2; m = 100, n = 50, k = 5)
291241
cfg.LAMBDA_L0 = norm(grad(model, rand(model.meta.nvar)), Inf) / 200
292242

293243
results = NamedTuple[]
294-
(:PANOC in cfg.RUN_SOLVERS) && push!(results, run_panoc_nnmf!(model, x0; λ = cfg.LAMBDA_L0, maxit = cfg.MAXIT_PANOC, tol = cfg.TOL, verbose = cfg.VERBOSE_PANOC, selected = selected))
295244
(:TR in cfg.RUN_SOLVERS) && push!(results, run_tr_nnmf!(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, selected = selected))
296245
(:R2N in cfg.RUN_SOLVERS) && push!(results, run_r2n_nnmf!(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, selected = selected))
297246
(:LM in cfg.RUN_SOLVERS) && push!(results, run_LM_nnmf!(nls_model, x0; λ = cfg.LAMBDA_L0, atol = cfg.TOL, rtol = cfg.RTOL, verbose = cfg.VERBOSE_RO, selected = selected))

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} = [:PANOC, :TR, :R2N] # mutable
11+
RUN_SOLVERS::Vector{Symbol} = [: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 = [:PANOC, :LM, :TR, :R2N], QN_FOR_TR = :LBFGS)
20+
const CFG2 = Config(RUN_SOLVERS = [:LM, :TR, :R2N], QN_FOR_TR = :LBFGS)
2121

2222
end # module

0 commit comments

Comments
 (0)