Functions and operators

f(x)={xx>00otherwisef(x) = \begin{cases} x & x > 0 \\ 0 & \text{otherwise} \end{cases} Cases (piecewise)

A piecewise definition: the value on each line applies when that line’s condition holds.

In ML papers

A big left brace with rows defines a function piece by piece: each row is a value, then the condition under which it applies. ReLU, the Huber loss, clipping and masks are written this way.

How to type it

LaTeXShows
\begin{cases} a & \text{if } \ldots \\ b & \text{otherwise} \end{cases}{aif …botherwise\begin{cases} a & \text{if } \ldots \\ b & \text{otherwise} \end{cases}

A worked example

f(−2)=0,f(3)=3f(-2) = 0, \quad f(3) = 3

The ReLU above, evaluated on both sides of zero.

Related

ReLU⁡(x)=max⁡(0,x)\operatorname{ReLU}(x) = \max(0, x)ReLU1[y=k]\mathbb{1}[y = k]Indicator functionD={(xi,yi)}i=1N\mathcal{D} = \{(\mathbf{x}_i, y_i)\}_{i=1}^{N}Set braces

Decode this example →