-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcvestPlotter.jl
57 lines (48 loc) · 1.72 KB
/
cvestPlotter.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Helper function to plot results for the
# deterministic covariance estimation problem
using Plots
using JLD
#reset past font scaling
Plots.scalefontsizes()
#scale fonts
Plots.scalefontsizes(1.5)
@load "./out/cvest_d_60_maxIter_100000.jld"
NUM_GRADS = 100000
d = 40
cvgPlot = plot(xlim=(0:NUM_GRADS),
xlabel="Number of forward passes",
ylabel="\$\\log_{10}(\\|V V^{T} - \\Sigma\\|_{Fro}^2 + \\|W W^{T}\\|_{Fro}^2)/2\$",
legend=:right)
for (sgrads, errs, η) in zip(sgradsCGDA, errsCGDA, ηList)
mxg = findlast(x -> ~isnan(x), errs)
if findfirst(isnan, errs) == nothing
plot!(cvgPlot, sgrads[1:mxg], log10.(errs[1:mxg]),
linestyle=:solid, linecolor=cdict[η],
label="CGD, \\eta = $η")
end
end
for (sgrads, errs, η) in zip(sgradsOGDA, errsOGDA, ηList)
mxg = findlast(x -> ~isnan(x), errs)
if findfirst(isnan, errs) == nothing
plot!(cvgPlot, sgrads[1:mxg], log10.(errs[1:mxg]),
linestyle=:dot, linecolor=cdict[η],
label="OGDA, \\eta = $η")
end
end
for (sgrads, errs, η) in zip(sgradsSGA, errsSGA, ηList)
mxg = findlast(x -> ~isnan(x), errs)
if findfirst(isnan, errs) == nothing
plot!(cvgPlot, sgrads[1:mxg], log10.(errs[1:mxg]),
linestyle=:dash, linecolor=cdict[η],
label="SGA, \\eta = $η")
end
end
for (sgrads, errs, η) in zip(sgradsConOpt, errsConOpt, ηList)
mxg = findlast(x -> ~isnan(x), errs)
if findfirst(isnan, errs) == nothing
plot!(cvgPlot, sgrads[1:mxg], log10.(errs[1:mxg]),
linestyle=:dashdot, linecolor=cdict[η],
label="ConOpt, \\eta = $η")
end
end
savefig(cvgPlot, "./out/cvest_d_$(d)")