Skip to content

Commit 8b0002c

Browse files
Solve the future size issues (#98)
* return plots as png * Fix format * Replacing the Manifest... again.... 😡😡😡😡 * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Use hide trick * Update examples/a-regression/script.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Use plt instead of ans * Formatting * Change hide * Try new syntax Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 4fdd20f commit 8b0002c

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

examples/a-regression/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[deps]
22
ApproximateGPs = "298c2ebc-0411-48ad-af38-99e88101b606"
3+
DisplayAs = "0b91fe84-8a4c-11e9-3e1d-67c38462b6d6"
34
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
45
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
56
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"

examples/a-regression/script.jl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
using ApproximateGPs
1313
using Distributions
1414
using LinearAlgebra
15+
#jl using DisplayAs
1516

1617
using Plots
17-
default(; palette=:seaborn_colorblind, legend=:outertopright, size=(700, 400))
18+
default(; fmt=:png, palette=:seaborn_colorblind, legend=:outertopright, size=(700, 400))
1819

1920
using Random
2021
Random.seed!(1234);
@@ -29,7 +30,10 @@ N = 10000 # Number of training points
2930
x = rand(Uniform(-1, 1), N)
3031
y = g.(x) + 0.3 * randn(N)
3132

32-
scatter(x, y; xlabel="x", ylabel="y", markershape=:xcross, markeralpha=0.1, legend=false)
33+
plt = scatter(
34+
x, y; xlabel="x", ylabel="y", markershape=:xcross, markeralpha=0.1, legend=false
35+
)
36+
#jl DisplayAs.PNG(plt)
3337

3438
# ## Set up a Flux model
3539
#
@@ -145,7 +149,7 @@ model = SVGPModel(k_init, z_init, m_init, A_init);
145149
# very poor fit to the data, as expected:
146150

147151
init_post = model_posterior(model)
148-
scatter(
152+
plt = scatter(
149153
x,
150154
y;
151155
xlabel="x",
@@ -154,7 +158,8 @@ scatter(
154158
markeralpha=0.1,
155159
label="Training Data",
156160
)
157-
plot!(-1:0.001:1, init_post; label="Initial Posterior", color=4)
161+
plot!(plt, -1:0.001:1, init_post; label="Initial Posterior", color=4)
162+
#jl DisplayAs.PNG(plt)
158163

159164
# ## Training the model
160165
#
@@ -195,7 +200,7 @@ loss(model, x, y)
195200

196201
post = model_posterior(model)
197202

198-
scatter(
203+
plt = scatter(
199204
x,
200205
y;
201206
markershape=:xcross,
@@ -207,5 +212,6 @@ scatter(
207212
label="Training Data",
208213
color=1,
209214
)
210-
plot!(-1:0.001:1, post; label="Posterior", color=4)
211-
sticks!(model.z, fill(0.13, M); label="Pseudo-points", linewidth=1.5, color=5)
215+
plot!(plt, -1:0.001:1, post; label="Posterior", color=4)
216+
sticks!(plt, model.z, fill(0.13, M); label="Pseudo-points", linewidth=1.5, color=5)
217+
#jl DisplayAs.PNG(plt)

0 commit comments

Comments
 (0)