comment on NLL implementation
This commit is contained in:
parent
96dfc904b1
commit
a8871d4a67
1 changed files with 4 additions and 0 deletions
|
@ -12,6 +12,10 @@ class Loss:
|
||||||
|
|
||||||
|
|
||||||
class NLL(Loss): # Negative Log Likelihood
|
class NLL(Loss): # Negative Log Likelihood
|
||||||
|
# NOTE: this is a misnomer -- the "log" part is not implemented here.
|
||||||
|
# instead, you should use a Log activation at the end of your network
|
||||||
|
# e.g. LogSoftmax.
|
||||||
|
# TODO: simplify the math that comes about it.
|
||||||
def forward(self, p, y):
|
def forward(self, p, y):
|
||||||
correct = p * y
|
correct = p * y
|
||||||
return np.mean(-correct)
|
return np.mean(-correct)
|
||||||
|
|
Loading…
Add table
Reference in a new issue