Functions and operators

[yi=k][y_i = k] Iverson bracket

Square brackets around a condition: 1 if it is true, 0 if it is false.

In ML papers

[P][P] with a true-or-false statement PP inside is the Iverson bracket: it equals 11 when PP holds and 00 when it does not. It is the same as the Indicator function 1[P]\mathbb{1}[P], written without the 1\mathbb{1}. The cross-entropy for a label yy can be written −∑k[y=k]log⁡pk-\sum_k [y = k] \log p_k: only the correct class's term survives.

The rule for reading square brackets: a condition inside (an ==, << or ∈\in) makes it an Iverson bracket; a quantity inside makes it plain grouping or an expectation's argument, E[X]\mathbb{E}[X].

How to type it

LaTeXShows
[y_i = k][yi=k][y_i = k]
\left[ y_i = k \right] tall[yi=k]\left[ y_i = k \right]

A worked example

[3>2]+[1=2]+[0≤0]=1+0+1=2[3 > 2] + [1 = 2] + [0 \leq 0] = 1 + 0 + 1 = 2

Summing brackets counts how many conditions hold.

Common confusions

Related

1[y=k]\mathbb{1}[y = k]Indicator function∑i=1Nxi\sum_{i=1}^{N} x_iSummationf(x)={xx>00otherwisef(x) = \begin{cases} x & x > 0 \\ 0 & \text{otherwise} \end{cases}Cases (piecewise)

Decode this example →