Skip to content

Commit

Permalink
Fix a bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Jan 6, 2015
1 parent 2bc5712 commit a3f83ca
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ object LogLoss extends Loss {
val margin = 2.0 * point.label * prediction
// The following are equivalent to 2.0 * log(1 + exp(-margin)) but are more numerically
// stable.
if (margin >= 0) {
if (point.label > 0) {
2.0 * math.log1p(math.exp(-margin))
} else {
2.0 * (-margin + math.log1p(math.exp(margin)))
2.0 * math.log1p(math.exp(margin))
}
}.mean()
}
Expand Down

0 comments on commit a3f83ca

Please sign in to comment.