move train docs

This commit is contained in:
Mike J Innes 2018-02-16 12:22:53 +00:00
parent 1908b4f451
commit 81ab91418d
1 changed files with 16 additions and 16 deletions

View File

@ -57,6 +57,22 @@ ys = [rand( 10), rand( 10), rand( 10)]
data = zip(xs, ys)
```
Note that, by default, `train!` only loops over the data once (a single "epoch").
A convenient way to run multiple epochs from the REPL is provided by `@epochs`.
```julia
julia> using Flux: @epochs
julia> @epochs 2 println("hello")
INFO: Epoch 1
hello
INFO: Epoch 2
hello
julia> @epochs 2 Flux.train!(...)
# Train for two epochs
```
## Callbacks
`train!` takes an additional argument, `cb`, that's used for callbacks so that you can observe the training process. For example:
@ -76,19 +92,3 @@ evalcb() = @show(loss(test_x, test_y))
Flux.train!(objective, data, opt,
cb = throttle(evalcb, 5))
```
Note that, by default, `train!` only loops over the data once (a single "epoch").
A convenient way to run multiple epochs from the REPL is provided by `@epochs`.
```julia
julia> using Flux: @epochs
julia> @epochs 2 println("hello")
INFO: Epoch 1
hello
INFO: Epoch 2
hello
julia> @epochs 2 Flux.train!(...)
# Train for two epochs
```