optunity icon indicating copy to clipboard operation
optunity copied to clipboard

Problem with optunity.metrics.logloss

Open TropComplique opened this issue 9 years ago • 0 comments

Function logloss(y, yhat) is not working when there are zeros or ones in yhat.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-42-e21f1cc9f451> in <module>()
----> 1 logloss(Y_test, Y_hat)

/mnt/500/bo/pythonProjects/optunity/optunity/metrics.py in logloss(y, yhat)
    273     """
    274     loss = sum([math.log(pred) for _, pred in
--> 275                 filter(lambda i: i[0], zip(y, yhat))])
    276     loss += sum([math.log(1 - pred) for _, pred in
    277                 filter(lambda i: not i[0], zip(y, yhat))])

/mnt/500/bo/pythonProjects/optunity/optunity/metrics.py in <listcomp>(.0)
    272 
    273     """
--> 274     loss = sum([math.log(pred) for _, pred in
    275                 filter(lambda i: i[0], zip(y, yhat))])
    276     loss += sum([math.log(1 - pred) for _, pred in

ValueError: math domain error

TropComplique avatar May 14 '16 21:05 TropComplique