Negative Log-Likelihood #
Negative log-likelihood for one-hot targets when the input is already log-probabilities.
noncomputable def
Proofs.Autograd.TapeNodes.nllOneHotLast
{Γ : List Spec.Shape}
{m n : ℕ}
(logProbs target : Idx Γ (Spec.Shape.dim m (Spec.Shape.dim n Spec.Shape.scalar)))
:
Negative log-likelihood loss for log-probabilities and one-hot targets of shape (m×n).
Forward:
-(1/m) * ⟪target, logProbs⟫
This is the natural primitive loss that cross_entropy reduces to after log_softmax.
Instances For
noncomputable def
Proofs.Autograd.TapeNodes.nllOneHotLastFderiv
{Γ : List Spec.Shape}
{m n : ℕ}
(logProbs target : Idx Γ (Spec.Shape.dim m (Spec.Shape.dim n Spec.Shape.scalar)))
:
NodeFDerivCorrect (nllOneHotLast logProbs target)
NodeFDerivCorrect for nll_one_hot_last (negative log-likelihood with one-hot targets).