anirudhacharya commented on a change in pull request #12697: [MXNET -1004]
Poisson NegativeLog Likelihood loss
URL: https://github.com/apache/incubator-mxnet/pull/12697#discussion_r223536222
##########
File path: python/mxnet/gluon/loss.py
##########
@@ -706,3 +707,65 @@ def hybrid_forward(self, F, pred, positive, negative):
axis=self._batch_axis, exclude=True)
loss = F.relu(loss + self._margin)
return _apply_weighting(F, loss, self._weight, None)
+
+
+class PoissonNLLLoss(Loss):
+ r"""For a target (Random Variable) in a Poisson distribution, the function
calculates the Negative
+ Log likelihood loss.
+ PoissonNLLLoss measures the loss accrued from a poisson regression
prediction made by the model.
+
+ .. math::
+ L = \text{pred} - \text{target} * \log(\text{pred})
+\log(\text{target!})
+
+ `pred`, `target` can have arbitrary shape as long as they have the same
number of elements.
+
+ Parameters
+ ----------
+ from_logits : boolean, default True
+ indicating whether log(predicted) value has already been computed. If
True, the loss is computed as
+ :math:`\exp(\text{pred}) - \text{target} * \text{pred}`, and if False,
then loss is computed as
+ :math:`\text{pred} - \text{target} *
\log(\text{pred}+\text{epsislon})`.The default value
Review comment:
these definitions seem to be at odds with the definition given above in line
718
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services