Maths for ML / Notation

1[y=k]\mathbb{1}[y = k]

indicator function

Probability and statisticsIntermediate

Say it “indicator of y equals k”

1 if the condition inside is true, 0 otherwise.

Example

acc=1n∑i1[y^i=yi]\text{acc} = \tfrac1n\sum_i \mathbb{1}[\hat{y}_i = y_i]

Accuracy is the average of an indicator.

In code

(y_hat == y).astype(int)
(y_hat == y).float()

Where you’ll see it in ML

Accuracy, one-hot labels, 0–1 loss.

Lessons that use it

← All 94 symbols