You probably still have negative values inside the log, which gives nan with real numbers.
a
and y
should represent probability between 0 to 1, So you need to check why do you have smaller/larger values there. Adding 1e-7 shows there is something fishy, because np.log(0)
gives -inf
, which I think is the value you want.