Skip to content

Commit

Permalink
New style exception for Python 3 (apache#11668)
Browse files Browse the repository at this point in the history
Old style exceptions are treated as __syntax errors__ in Python 3.
  • Loading branch information
cclauss authored and szha committed Jul 12, 2018
1 parent 0d83038 commit 31f3dda
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions example/sparse/factorization_machine/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class LogLossMetric(mx.metric.EvalMetric):
>>> labels = [mx.nd.array([0, 1, 1])]
>>> log_loss= mx.metric.NegativeLogLikelihood()
>>> log_loss.update(labels, predicts)
>>> print log_loss.get()
>>> print(log_loss.get())
('log-loss', 0.57159948348999023)
"""
def __init__(self, eps=1e-12, name='log-loss',
Expand Down Expand Up @@ -106,7 +106,7 @@ def update(self, labels, preds):
tmp = sorted(tmp, key=itemgetter(1), reverse=True)
label_sum = label_weight.sum()
if label_sum == 0 or label_sum == label_weight.size:
raise Exception, "AUC with one class is undefined"
raise Exception("AUC with one class is undefined")

total_area = label_zero_num * label_one_num
height = 0
Expand Down

0 comments on commit 31f3dda

Please sign in to comment.