The truth value of an array with more than one element is ambiguous
I had the same problem in my code:

c = max(
[np.dot(theta[j], X[i]) for j in range(theta.shape[0])]
) / temp_parameter


I ran debugger and figured out that theta[j], X[i] were not the same shape, so dot product gave an ndarray instead of scalar as a result. max() function was a bit confused about it, because it does not work with ndarrays.
So, the conclusion is:


if prob_ is an ndarray, please, use numpy.max(), it should definitely work:

[In]: f = np.array([[1, 1, 1], [2, 2, 2]])
[In]: max(f)
[Out]: Traceback (most recent call last):
  File "&lt;input&gt;", line 1, in &lt;module&gt;
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
[In]: np.max(f)
[Out]: 2
if prob_ is a list, check whether its components are scalars or lists:

[In]: f = [[1, 1, 1], [2, 2, 2]]
[In]: max(f)
[Out]: [2, 2, 2]
[In]: g = [numpy.array([1, 1, 1]), numpy.array([2, 2, 2])]
[In]: max(g)
[Out]: Traceback (most recent call last):
  File "&lt;input&gt;", line 1, in &lt;module&gt;
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()