I can not understand the output of argmax
and argmin
when use with the axis parameter. For example:
>>> a = np.array([[1,2,4,7], [9,88,6,45], [9,76,3,4]])
>>> a
array([[ 1, 2, 4, 7],
[ 9, 88, 6, 45],
[ 9, 76, 3, 4]])
>>> a.shape
(3, 4)
>>> a.size
12
>>> np.argmax(a)
5
>>> np.argmax(a,axis=0)
array([1, 1, 1, 1])
>>> np.argmax(a,axis=1)
array([3, 1, 1])
>>> np.argmin(a)
0
>>> np.argmin(a,axis=0)
array([0, 0, 2, 2])
>>> np.argmin(a,axis=1)
array([0, 2, 2])
As you can see, the maximum value is the point (1,1) and the minimum one is the point (0,0). So in my logic when I run:
np.argmin(a,axis=0)
I expectedarray([0,0,0,0])
np.argmin(a,axis=1)
I expectedarray([0,0,0])
np.argmax(a,axis=0)
I expectedarray([1,1,1,1])
np.argmax(a,axis=1)
I expectedarray([1,1,1])
What is wrong with my understanding of things?