Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #175 from antinucleon/master
Browse files Browse the repository at this point in the history
[Python] Remove logloss for speed reason
  • Loading branch information
tqchen committed Sep 28, 2015
2 parents cd142c4 + 2e70300 commit e373355
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions python/mxnet/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ def update(self, label, pred):
self.sum_metric += numpy.sum(pred_label == label)
self.num_inst += label.size

# pylint: disable=pointless-string-statement
"""
class LogLoss(EvalMetric):
"""Calculate logloss"""
# remove because it because it is too slow
def __init__(self):
self.eps = 1e-15
super(LogLoss, self).__init__('logloss')
Expand All @@ -70,6 +72,8 @@ def update(self, label, pred):
p = max(min(p, 1 - self.eps), self.eps)
self.sum_metric += -numpy.log(p)
self.num_inst += label.size
"""
# pylint: enable=pointless-string-statement

class CustomMetric(EvalMetric):
"""Custom evaluation metric that takes a NDArray function.
Expand Down Expand Up @@ -128,7 +132,5 @@ def create(metric):
raise TypeError('metric should either be callable or str')
if metric == 'acc' or metric == 'accuracy':
return Accuracy()
elif metric == 'logloss':
return LogLoss()
else:
raise ValueError('Cannot find metric %s' % metric)

0 comments on commit e373355

Please sign in to comment.