Skip to content

Commit

Permalink
Fix cross-references for loss functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh-cpp committed Aug 8, 2022
1 parent a377cb0 commit 7bf3581
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/src/models/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ These layers don't affect the structure of the network but may improve training
Flux.normalise
BatchNorm
Dropout
Flux.dropout
AlphaDropout
LayerNorm
InstanceNorm
Expand Down
10 changes: 5 additions & 5 deletions src/losses/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Cross entropy is typically used as a loss in multi-class classification,
in which case the labels `y` are given in a one-hot format.
`dims` specifies the dimension (or the dimensions) containing the class probabilities.
The prediction `ŷ` is supposed to sum to one across `dims`,
as would be the case with the output of a [`softmax`](@ref) operation.
as would be the case with the output of a [softmax](@ref Softmax) operation.
For numerical stability, it is recommended to use [`logitcrossentropy`](@ref)
rather than `softmax` followed by `crossentropy` .
Expand Down Expand Up @@ -225,7 +225,7 @@ Return the cross entropy calculated by
This is mathematically equivalent to `crossentropy(softmax(ŷ), y)`,
but is more numerically stable than using functions [`crossentropy`](@ref)
and [`softmax`](@ref) separately.
and [softmax](@ref Softmax) separately.
See also: [`binarycrossentropy`](@ref), [`logitbinarycrossentropy`](@ref), [`label_smoothing`](@ref).
Expand Down Expand Up @@ -262,7 +262,7 @@ Return the binary cross-entropy loss, computed as
agg(@.(-y * log(ŷ + ϵ) - (1 - y) * log(1 - ŷ + ϵ)))
Where typically, the prediction `ŷ` is given by the output of a [`sigmoid`](@ref) activation.
Where typically, the prediction `ŷ` is given by the output of a [sigmoid](@ref Activation-Functions) activation.
The `ϵ` term is included to avoid infinity. Using [`logitbinarycrossentropy`](@ref) is recomended
over `binarycrossentropy` for numerical stability.
Expand Down Expand Up @@ -452,7 +452,7 @@ end
binary_focal_loss(ŷ, y; agg=mean, γ=2, ϵ=eps(ŷ))
Return the [binary_focal_loss](https://arxiv.org/pdf/1708.02002.pdf)
The input, 'ŷ', is expected to be normalized (i.e. [`softmax`](@ref) output).
The input, 'ŷ', is expected to be normalized (i.e. [softmax](@ref Softmax) output).
For `γ == 0`, the loss is mathematically equivalent to [`Losses.binarycrossentropy`](@ref).
Expand Down Expand Up @@ -493,7 +493,7 @@ end
Return the [focal_loss](https://arxiv.org/pdf/1708.02002.pdf)
which can be used in classification tasks with highly imbalanced classes.
It down-weights well-classified examples and focuses on hard examples.
The input, 'ŷ', is expected to be normalized (i.e. [`softmax`](@ref) output).
The input, 'ŷ', is expected to be normalized (i.e. [softmax](@ref Softmax) output).
The modulating factor, `γ`, controls the down-weighting strength.
For `γ == 0`, the loss is mathematically equivalent to [`Losses.crossentropy`](@ref).
Expand Down

0 comments on commit 7bf3581

Please sign in to comment.