This commit is contained in:
Mike J Innes 2017-10-03 19:00:42 +01:00
parent 5fd1b7d9a2
commit c202e2bc1a
1 changed files with 3 additions and 0 deletions

View File

@ -25,6 +25,9 @@ m = Chain(
# Model loss function
loss(x, y) = Flux.mse(m(x), y)
# later
Flux.train!(loss, data, opt)
```
The loss will almost always be defined in terms of some *cost function* that measures the distance of the prediction `m(x)` from the target `y`. Flux has several of these built in, like `mse` for mean squared error or `logloss` for cross entropy loss, but you can calculate it however you want.