Category NumPy

Python np.argmax() function

Python np.argmax() function

With `axis=0` on a 2×3 array, the result has one row index for each column. I like how that lets each column identify its own winning position. Those indices can guide a separate lookup for each column’s winner. `np.argmax` returns…

Numpy linalg.norm – Matrix or vector norm

Numpy linalg.norm - Matrix or vector norm

A matrix of feature rows can produce one output from `np.linalg.norm(matrix)`, even when the next step needs a length for each row. I was curious that `axis=1` can preserve that row-by-row view without changing the matrix. A norm reports size…

NumPy eye function: A Complete Guide

NumPy eye function: A Complete Guide

np.eye builds an identity matrix, and the arguments that matter are its size, its dtype, and an offset that moves the diagonal. The examples go from a basic identity matrix to one-hot encodings. What np.eye actually returns That prints True.…

NumPy full() function

NumPy full() function

NumPy full creates an array with a chosen shape and the same fill value in every cell. Install NumPy and import it Install the current NumPy release in your environment, then import it with the short name np used in…