Please help on this error
Very simply this error says to you that the variable J should be either a string or a number to be converted to float. So check what J type is and make sure is as needed.
Your dot matrix calculation is not right it should be np.dot(x,y) where x and y are mock variables in my case.
No the operation itself in the J calculation. It should be np.dot(yt, np.log(…))…