argmax(a, axis=None, out=None, *, keepdims=<no value>)
In case of multiple occurrences of the maximum values, the indices corresponding to the first occurrence are returned.
Input array.
By default, the index is into the flattened array, otherwise along the specified axis.
If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype.
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the array.
Array of indices into the array. It has the same shape as :None:None:`a.shape`
with the dimension along :None:None:`axis`
removed. If :None:None:`keepdims`
is set to True, then the size of :None:None:`axis`
will be 1 with the resulting array having same shape as :None:None:`a.shape`
.
Returns the indices of the maximum values along an axis.
amax
The maximum value along a given axis.
take_along_axis
Apply np.expand_dims(index_array, axis)
from argmax to an array as if by calling max.
unravel_index
Convert a flat index into an index tuple.
>>> a = np.arange(6).reshape(2,3) + 10
... a array([[10, 11, 12], [13, 14, 15]])
>>> np.argmax(a) 5
>>> np.argmax(a, axis=0) array([1, 1, 1])
>>> np.argmax(a, axis=1) array([2, 2])
Indexes of the maximal elements of a N-dimensional array:
>>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape)
... ind (1, 2)
>>> a[ind] 15
>>> b = np.arange(6)
... b[1] = 5
... b array([0, 5, 2, 3, 4, 5])
>>> np.argmax(b) # Only the first occurrence is returned. 1
>>> x = np.array([[4,2,3], [1,0,3]])
... index_array = np.argmax(x, axis=-1)
... # Same as np.amax(x, axis=-1, keepdims=True)
... np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1) array([[4], [3]])
>>> # Same as np.amax(x, axis=-1)
... np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1) array([4, 3])
Setting :None:None:`keepdims`
to :None:None:`True`
,
>>> x = np.arange(24).reshape((2, 3, 4))See :
... res = np.argmax(x, axis=1, keepdims=True)
... res.shape (2, 1, 4)
The following pages refer to to this document either explicitly or contain code examples using this.
numpy.nanargmax
pandas.core.series.Series.idxmax
scipy.signal._signaltools.correlation_lags
dask.array.core.Array.argmax
scipy.signal._signaltools.correlate2d
numpy.amax
skimage.transform.hough_transform.hough_circle
numpy.argmin
numpy.matrixlib.defmatrix.matrix.argmax
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them