Skip to content

Commit a21a699

Browse files
committed
update MNIST example to julia 1.7 and resolve #210
1 parent 14b39b1 commit a21a699

File tree

9 files changed

+3872
-685
lines changed

9 files changed

+3872
-685
lines changed

examples/mnist/Manifest.toml

Lines changed: 1027 additions & 670 deletions
Large diffs are not rendered by default.

examples/mnist/Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
[deps]
22
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
3-
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
43
MLDatasets = "eb30cadb-4394-5ae3-aed4-317e484a6458"
54
MLJ = "add582a8-e3ab-11e8-2d5e-e98b27df1bc7"
65
MLJFlux = "094fc8d1-fd35-5302-93ea-dabda2abf845"
76
MLJIteration = "614be32b-d00c-4edb-bd02-1eb411ab5e55"
87
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
9-
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"

examples/mnist/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Contents
22

3-
- `mnist.ipynb`: Juptyer notebook
4-
- `mnist.jl`: executable Julia script annotated with comments
3+
- `notebook.ipynb`: Juptyer notebook
4+
- `notebook.jl`: executable Julia script annotated with comments
55

66
# Important
77

88
Scripts or notebooks in this folder cannot be reliably exectued without the accompanying
9-
Manifest.toml and Project.toml files. If the Manifest.toml does not specify a
10-
`julia_version` in the first four lines, use Julia 1.6.x, where x is any integer.
9+
Manifest.toml and Project.toml files.

examples/mnist/generate.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Execute this julia file to generate the notebooks from ../notebook.jl
2+
3+
joinpath(@__DIR__, "..", "generate.jl") |> include
4+
generate(@__DIR__, execute=true, pluto=false)

examples/mnist/loss.png

-1.55 KB
Loading

examples/mnist/notebook.ipynb

Lines changed: 2143 additions & 0 deletions
Large diffs are not rendered by default.

examples/mnist/mnist.jl renamed to examples/mnist/notebook.jl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,15 @@ const DIR = @__DIR__
66
Pkg.activate(DIR)
77
Pkg.instantiate()
88

9-
# **Julia version** is assumed to be ^1.6
9+
# **Julia version** is assumed to be ^1.7
1010

1111
using MLJ
1212
using Flux
1313
import MLJFlux
1414
import MLJIteration # for `skip`
1515

16-
MLJ.color_off()
17-
1816
using Plots
19-
pyplot(size=(600, 300*(sqrt(5)-1)));
17+
gr(size=(600, 300*(sqrt(5)-1)));
2018

2119
# ## Basic training
2220

@@ -230,7 +228,7 @@ fit!(mach, rows=1:500);
230228

231229
plot(epochs, losses,
232230
xlab = "epoch",
233-
ylab = "root squared error",
231+
ylab = "cross entropy",
234232
label="out-of-sample")
235233
plot!(epochs, training_losses, label="training")
236234

@@ -266,10 +264,7 @@ fit!(mach, rows=1:500)
266264

267265
plot(epochs, losses,
268266
xlab = "epoch",
269-
ylab = "root squared error",
267+
ylab = "cross entropy",
270268
label="out-of-sample")
271269
plot!(epochs, training_losses, label="training")
272270

273-
using Literate #src
274-
Literate.markdown(@__FILE__, @__DIR__, execute=false) #src
275-
Literate.notebook(@__FILE__, @__DIR__, execute=false) #src

0 commit comments

Comments
 (0)