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

[Python] Remove logloss for speed reason #175

Merged
merged 2 commits into from
Sep 28, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)