more docs
This commit is contained in:
parent
b44ba162b1
commit
79391beca0
@ -1,12 +1,23 @@
|
|||||||
## Loss Functions
|
## Loss Functions
|
||||||
Flux provides a large number of common loss functions used for training machine learning models.
|
Flux provides a large number of common loss functions used for training machine learning models.
|
||||||
|
|
||||||
|
Loss functions for supervised learning typically expect as inputs a target `y`, and a prediction `ŷ`.
|
||||||
|
In Flux's convention, the order of the arguments is the following
|
||||||
|
```julia
|
||||||
|
loss(ŷ, y)
|
||||||
|
```
|
||||||
|
|
||||||
Most loss functions in Flux have an optional argument `agg`, denoting the type of aggregation performed over the
|
Most loss functions in Flux have an optional argument `agg`, denoting the type of aggregation performed over the
|
||||||
batch:
|
batch:
|
||||||
```julia
|
```julia
|
||||||
loss(ŷ, y; agg=mean)
|
loss(ŷ, y) # defaults to `mean`
|
||||||
|
loss(ŷ, y, agg=sum) # use `sum` for reduction
|
||||||
|
loss(ŷ, y, agg=x->sum(x, dims=2)) # partial reduction
|
||||||
|
loss(ŷ, y, agg=x->mean(w .* x)) # weighted mean
|
||||||
|
loss(ŷ, y, agg=identity) # no aggregation.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Losses Reference
|
||||||
```@docs
|
```@docs
|
||||||
Flux.mae
|
Flux.mae
|
||||||
Flux.mse
|
Flux.mse
|
||||||
@ -22,4 +33,4 @@ Flux.hinge
|
|||||||
Flux.squared_hinge
|
Flux.squared_hinge
|
||||||
Flux.dice_coeff_loss
|
Flux.dice_coeff_loss
|
||||||
Flux.tversky_loss
|
Flux.tversky_loss
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user