Convex Margin-Based Loss Functions

  • Definition: Given a measurable prediction function f:XYf : X \rightarrow Y, a measurable loss function :Y×YR<em>[InvisibleComma]+\ell : Y \times Y \rightarrow \mathbb{R}<em>[InvisibleComma]+, and a probability distribution P(X,Y)P(X,Y) on X×YX \times Y, the expected risk of ff is defined as R</em>(f):=E[(f(X),Y)]=[InvisibleComma]X×Y(f(x),y)P(X,Y)dx,dyR</em>\ell(f) := E[\ell(f(X), Y)] = \int[InvisibleComma]{X \times Y} \ell(f(x), y) P(X,Y) {dx, dy}

  • Definition: The Bayes (optimal) risk R<em>R<em>\ell^{\star} is given by R</em>=infR(f)f is measurable R</em>\ell^{\star} = \inf { R_\ell(f) | f \text{ is measurable } }. A function f:XYf^{\star} : X \rightarrow Y that attains the above infimum is called Bayes predictor or Bayes (optimal) learning rule.

  • Proposition: A Bayes optimal learning rule satisfies for PXP_X-almost all xXx \in X

    f(x)argmin<em>yYE[(y,Y)X=x]=argmin</em>yYr(yx)f^{\star}(x) \in \operatorname{argmin}<em>{y' \in Y} E[ \ell(y', Y) | X = x ] = \operatorname{argmin}</em>{y' \in Y} r(y' | x)

Examples: Bayes Risk and Bayes Predictor

  • Example: Binary Classification

    • Y=1,1Y = {-1, 1}, (z,y)=1zy\ell(z, y) = 1_{z \neq y}.

    • The risk can be decomposed as follows:

      R(f)=E[(f(X),Y)]=Pf(X)YR_\ell(f) = E[\ell(f(X), Y)] = P{f(X) \neq Y}

      =E[1<em>f(X)=1PY=1X+1</em>f(X)=1PY=1X]= E[1<em>{f(X)=1}P{Y = -1 | X} + 1</em>{f(X)=-1}P{Y = 1 | X}]

    • From this, we derive the (optimal) Bayes classifier for PXP_X-almost all xx:

      f(x)={1,amp;if P<em>YX=x1gt;P</em>YX=x1 1,amp;otherwisef^{\star}(x) = \begin{cases} -1, &amp; \text{if } P<em>{Y|X=x}{-1} &gt; P</em>{Y|X=x}{1} \ 1, &amp; \text{otherwise} \end{cases}

      • However, this leads to combinatorial optimization problems, which can be computationally intractable (NP-hard).

      • Can we define convex loss functions for real-valued prediction function that achieve the Bayes optimal risk?

Convex margin-based loss functions

Problem: Different loss functions lead to different optimal functions.

Question: Let g:XRg^{\star} : X \rightarrow \mathbb{R} be the function that minimizes the Φ\Phi-risk RΦR_\Phi

RΦ(g):=E[Φ(Yg(X))]R_\Phi(g) := E[\Phi(Y g(X))],

where Φ\Phi is a convex margin-based loss function (surrogate of the 0-1-loss).

Does sign(g)\operatorname{sign}(g^{\star}) agree with the Bayes classifier ff^{\star}?

Convex margin-based loss functions (II)

  • Definition: A margin-based loss (measurable) function Φ:RR\Phi : \mathbb{R} \rightarrow \mathbb{R} is classification calibrated if sign(g)=f\operatorname{sign}(g^{\star}) = f^{\star}, where gg^{\star} minimizes RΦR_\Phi and ff^{\star} is a Bayes classifier.

Convex margin-based loss functions

  • Theorem: Let Φ\Phi be a margin-based, convex loss function. Then Φ\Phi is classification calibrated if and only if Φ\Phi is differentiable at 0 and \Phi'(0) < 0.

    Examples:

    Loss Function

    Formula



    Exponential Loss

    Φ(z)=ez{ \Phi(z) = e^{-z} }

    Hinge Loss

    Φ(z)=max(0,1z){ \Phi(z) = \max(0, 1 - z) }

    Truncated Squared Loss

    Φ(z)={(1z)2,amp;zlt;1 0,amp;z1{ \Phi(z) = \begin{cases} (1 - z)^2, &amp; z &lt; 1 \ 0, &amp; z \geq 1 \end{cases} }

    Squared Loss

    Φ(z)=(1z)2{ \Phi(z) = (1 - z)^2 }

    Logistic Loss

    Φ(z)=ln(1+ez){ \Phi(z) = \ln(1 + e^{-z}) }

Convex margin-based loss functions (II)

  • Derivation of the theorem: The Φ\Phi-risk can be decomposed as follows (set η(x):=PYX=x1\eta(x) := P_{Y|X=x}{1})

    RΦ(g):=E[Φ(Yg(X))]=E[E[Φ(Yg(X))X]]R_\Phi(g) := E[\Phi(Y g(X))] = E[ E[\Phi(Y g(X)) | X] ]

    =E[Φ(g(X))PY=1X+Φ(g(X))PY=1X]= E[\Phi(-g(X)) P{Y = -1 | X} + \Phi(g(X)) P{Y = 1 | X}]

    =E[η(X)Φ(g(X))+(1η(X))Φ(g(X))]= E[\eta(X) \Phi(g(X)) + (1 - \eta(X)) \Phi(-g(X))].

Convex margin-based loss functions (III)

Introduce conditional Φ\Phi-risk given η(x)=:ξ[0,1]\eta(x) =: \xi \in [0, 1]:

rΦ(zξ):=ξΦ(z)+(1ξ)Φ(z){ r_\Phi(z | \xi) := \xi \Phi(z) + (1 - \xi) \Phi(-z) }

Convex margin-based loss functions (IV)

Therefore, we have R<em>Φ(g)=E[r</em>Φ(g(X)η(X))]{ R<em>\Phi(g) = E[r</em>\Phi(g(X) | \eta(X))] }.

Convex margin-based loss functions (V)

Since we optimize over all measurable functions g:XR{ g : X \rightarrow \mathbb{R} }, the problem reduces to pointwise minimization { P_X-almost everywhere.

Convex margin-based loss functions (VI)

Therefore, consider minimization of rΦ(zξ){ r_\Phi(z | \xi) } for given ξ[0,1]{ \xi \in [0, 1] } (corresponds to η(x){ \eta(x) }).

Convex margin-based loss functions (VII)

We remark that Φ{ \Phi } is classification calibrated if the following equivalences hold true

{ 2\xi - 1 > 0 \quad \iff \quad \operatorname{argmin}z r\Phi(z | \xi) \in (0, \infty) } and { 2\xi - 1 < 0 \quad \iff \quad \operatorname{argmin}z r\Phi(z | \xi) \in (-\infty, 0) }.

Convex margin-based loss functions (VIII)

Since Φ{ \Phi } is convex, also r<em>Φ(zξ){ r<em>\Phi(z | \xi) } is convex in z{ z }. We abbreviate c~</em>ξ(z):=rΦ(zξ){ \tilde{c}</em>\xi(z) := r_\Phi(z | \xi) }.

Convex margin-based loss functions (IX)

Use monotonicity of the directional derivatives c~ξ(;+1){ \tilde{c}'_\xi(\cdot; +1) } to obtain

{ \tilde{c}'\xi(0; +1) = \xi \Phi'(0; +1) + (1 - \xi) \Phi'(0; -1) < 0 \quad \iff \quad \operatorname{argmin}z \tilde{c}_\xi(z) \in (0, \infty) }.

Analogously, { \tilde{c}'\xi(0; +1) > 0 } if and only if argmin</em>zc~ξ(z)(,0){ \operatorname{argmin}</em>z \tilde{c}_\xi(z) \in (-\infty, 0) }.

Convex margin-based loss functions (X)

Therefore, consider minimization of rΦ(zξ){ r_\Phi(z | \xi) } for given ξ[0,1]{ \xi \in [0, 1] } (corresponds to η(x){ \eta(x) }).

We remark that Φ{ \Phi } is classification calibrated if the following equivalences hold true

{ 2\xi - 1 > 0 \quad \iff \quad \operatorname{argmin}z r\Phi(z | \xi) \in (0, \infty) } and { 2\xi - 1 < 0 \quad \iff \quad \operatorname{argmin}z r\Phi(z | \xi) \in (-\infty, 0) }.

Since Φ{ \Phi } is convex, also r<em>Φ(zξ){ r<em>\Phi(z | \xi) } is convex in z{ z }. We abbreviate c~</em>ξ(z):=rΦ(zξ){ \tilde{c}</em>\xi(z) := r_\Phi(z | \xi) }.

Use monotonicity of the directional derivatives c~ξ(;+1){ \tilde{c}'_\xi(\cdot; +1) } to obtain

{ \tilde{c}'\xi(0; +1) = \xi \Phi'(0; +1) + (1 - \xi) \Phi'(0; -1) < 0 \quad \iff \quad \operatorname{argmin}z \tilde{c}_\xi(z) \in (0, \infty) }.

Analogously, { \tilde{c}'\xi(0; +1) > 0 } if and only if argmin</em>zc~ξ(z)(,0){ \operatorname{argmin}</em>z \tilde{c}_\xi(z) \in (-\infty, 0) }.

Convex margin-based loss functions (XI)

    { \implies }

    { \impliedby }

Convex margin-based loss functions (XII)

"    \implies"

Now, assume Φ{ \Phi } is classification calibrated. Let ξ12{ \xi \searrow \frac{1}{2} } to observe that

c~ξ(0;+1)=12(Φ(0;+1)Φ(0;1))0{ \tilde{c}'_\xi(0; +1) = \frac{1}{2} (\Phi'(0; +1) - \Phi'(0; -1)) \leq 0 }.

Moreover, by monotonicity of the (directional) derivatives, we always have Φ(0;1)Φ(0;+1){ \Phi'(0; -1) \leq \Phi(0; +1) }, which yields Φ(0;1)=Φ(0;+1){ \Phi'(0; -1) = \Phi'(0; +1) } and hence Φ{ \Phi } is differentiable at 0. We conclude that c~<em>ξ(0)=(2ξ1)Φ(0){ \tilde{c}'<em>\xi(0) = (2\xi - 1) \Phi'(0) }. Using { \xi > \frac{1}{2} }, yields argmin</em>zc~<em>ξ(z)(0,){ \operatorname{argmin}</em>z \tilde{c}<em>\xi(z) \in (0, \infty) }, which induces that { \tilde{c}'\xi(0) < 0 }, and we deduce that { \Phi'(0) < 0 }.