Skip to content

Commit 18bc8c4

Browse files
remove commented code and dataframes
1 parent 0120916 commit 18bc8c4

File tree

3 files changed

+1
-71
lines changed

3 files changed

+1
-71
lines changed

examples/Project.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[deps]
22
ADNLPModels = "54578032-b7ea-4c30-94aa-7cbd1cce6c9a"
3-
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
43
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
54
MLDatasets = "eb30cadb-4394-5ae3-aed4-317e484a6458"
65
NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"

examples/demo-svm.jl

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ using LinearAlgebra
33
using ProximalOperators, ShiftedProximalOperators, RegularizedProblems
44
using NLPModels, NLPModelsModifiers
55
using RegularizedOptimization
6-
using DataFrames
76
using MLDatasets
87

98
include("plot-utils-svm.jl")
@@ -54,73 +53,9 @@ function demo_solver(nlp_tr, nls_tr, sol_tr, nlp_test, nls_test, sol_test, h, χ
5453
nglm = neval_jtprod_residual(nls_tr) + neval_jprod_residual(nls_tr)
5554
@show acc(lmtrain), acc(lmtest)
5655
lmdec = plot_svm(LM_out, LM_out.solution, "lm-$(suffix)")
57-
58-
# c = PGFPlots.Axis(
59-
# [
60-
# PGFPlots.Plots.Linear(1:length(r2dec), r2dec, mark="none", style="black, dotted", legendentry="R2"),
61-
# PGFPlots.Plots.Linear(1:length(trdec), trdec, mark="none", style="black, dashed", legendentry="TR"),
62-
# PGFPlots.Plots.Linear(LM_out.solver_specific[:ResidHist], lmdec, mark="none", style="black, thick", legendentry="LM"),
63-
# PGFPlots.Plots.Linear(LMTR_out.solver_specific[:ResidHist], lmtrdec, mark="none", style = "black, very thin", legendentry="LMTR"),
64-
# ],
65-
# xlabel="\$ k^{th}\$ \$ f \$ Eval",
66-
# ylabel="Objective Value",
67-
# ymode="log",
68-
# xmode="log",
69-
# )
70-
# PGFPlots.save("svm-objdec.tikz", c, include_preamble=false)
71-
72-
# temp = hcat([R2_out.solver_specific[:Fhist][end], R2_out.solver_specific[:Hhist][end],R2_out.objective, acc(r2train), acc(r2test), nr2, ngr2, sum(R2_out.solver_specific[:SubsolverCounter]), R2_out.elapsed_time],
73-
# [TR_out.solver_specific[:Fhist][end], TR_out.solver_specific[:Hhist][end], TR_out.objective, acc(trtrain), acc(trtest), ntr, ngtr, sum(TR_out.solver_specific[:SubsolverCounter]), TR_out.elapsed_time],
74-
# [LM_out.solver_specific[:Fhist][end], LM_out.solver_specific[:Hhist][end], LM_out.objective, acc(lmtrain), acc(lmtest), nlm, nglm, sum(LM_out.solver_specific[:SubsolverCounter]), LM_out.elapsed_time],
75-
# [LMTR_out.solver_specific[:Fhist][end], LMTR_out.solver_specific[:Hhist][end], LMTR_out.objective, acc(lmtrtrain), acc(lmtrtest), nlmtr, nglmtr, sum(LMTR_out.solver_specific[:SubsolverCounter]), LMTR_out.elapsed_time])'
76-
77-
# df = DataFrame(temp, [:f, :h, :fh, :x,:xt, :n, :g, :p, :s])
78-
# T = []
79-
# for i = 1:nrow(df)
80-
# push!(T, Tuple(df[i, [:x, :xt]]))
81-
# end
82-
# select!(df, Not(:xt))
83-
# df[!, :x] = T
84-
# df[!, :Alg] = ["R2", "TR", "LM", "LMTR"]
85-
# select!(df, :Alg, Not(:Alg), :)
86-
# fmt_override = Dict(:Alg => "%s",
87-
# :f => "%10.2f",
88-
# :h => "%10.2f",
89-
# :fh => "%10.2f",
90-
# :x => "%10.2f, %10.2f",
91-
# :n => "%i",
92-
# :g => "%i",
93-
# :p => "%i",
94-
# :s => "%02.2f")
95-
# hdr_override = Dict(:Alg => "Alg",
96-
# :f => "\$ f \$",
97-
# :h => "\$ h \$",
98-
# :fh => "\$ f+h \$",
99-
# :x => "(Train, Test)",
100-
# :n => "\\# \$f\$",
101-
# :g => "\\# \$ \\nabla f \$",
102-
# :p => "\\# \$ \\prox{}\$",
103-
# :s => "\$t \$ (s)")
104-
# open("svm.tex", "w") do io
105-
# SolverBenchmark.pretty_latex_stats(io, df,
106-
# col_formatters=fmt_override,
107-
# hdr_override=hdr_override)
108-
# end
10956
end
11057

11158
function demo_svm()
112-
## load phishing data from libsvm
113-
# A = readdlm("data_matrix.txt")
114-
# b = readdlm("label_vector.txt")
115-
116-
# # sort into test/trainig
117-
# test_ind = randperm(length(b))[1:Int(floor(length(b)*.1))]
118-
# train_ind = setdiff(1:length(b), test_ind)
119-
# btest = b[test_ind]
120-
# Atest = A[test_ind,:]'
121-
# btrain = b[train_ind]
122-
# Atrain = A[train_ind,:]'
123-
12459
nlp_train, nls_train, sol_train = RegularizedProblems.svm_train_model()
12560
nlp_test, nls_test, sol_test = RegularizedProblems.svm_test_model()
12661
nlp_train = LSR1Model(nlp_train)

examples/plot-utils-svm.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ function plot_svm(outstruct, sol, name="tr-qr")
66
x = outstruct.solution
77
a = PGFPlots.Axis(
88
[
9-
PGFPlots.Plots.MatrixPlot(reshape(x, 28, 28); #filename="svm-$(name).tikz",
9+
PGFPlots.Plots.MatrixPlot(reshape(x, 28, 28);
1010
colormap = PGFPlots.ColorMaps.GrayMap())#, zmin = -700, zmax = 700)#, legendentry="computed"),
11-
# PGFPlots.Plots.Linear(1:length(sol), sol, mark="none", legendentry="exact"),
1211
],
13-
# xlabel="index",
14-
# ylabel="parameter",
15-
# legendStyle="at={(1.0,1.0)}, anchor=north east, draw=none, font=\\scriptsize",
1612
)
1713
PGFPlots.save("svm-$(name).pdf", a)
1814

0 commit comments

Comments
 (0)