Home / Maths for AI / Symbols / Functions

Argmax and argmin

Say it: "the argument that maximises"

What it means

arg⁡max⁡xf(x)\arg\max_x f(x) is the input xx that makes f(x)f(x) largest, not the largest value itself. arg⁡min⁡\arg\min is the input that makes it smallest.

Example

arg⁡min⁡x(x−3)2=3,min⁡x(x−3)2=0\arg\min_x (x - 3)^2 = 3, \quad \min_x (x - 3)^2 = 0

The location of the minimum versus its height.

In code

import numpy as np
p = np.array([0.1, 0.7, 0.2])
print(np.argmax(p), p.max())

Output

1 0.7

Where it appears in machine learning

A classifier predicts arg⁡max⁡kpk\arg\max_k p_k, the most likely class; training finds arg⁡min⁡θL(θ)\arg\min_\theta L(\theta), the best parameters.

Related symbols

Learn it properly in the free lesson Reading ML Maths, with practice questions that check your answers.