klyn.math.NDArray.argMax
method
public argMax(axis as Int) as NDArray<UInt>:
Description

Returns the indices of the maximum values along one axis.

Parameters
ParameterDescription
axis0 for columns, 1 for rows on 2D arrays.
Returns

A 1D array containing the first zero-based index of each maximum value.

Throws
  • IndexException if the axis does not exist.
  • ValueException if the array is empty, has unsupported dimensions or its numeric type is not ordered.
Example
import klyn.math

a = NDArray<Int>.fromList([[3, 2], [1, 4]])
print(a.argMax(axis=1))  # [0, 1]