A PTAS for Agnostically Learning Halfspaces

Amit Daniely

Introduction

For every μ>0\mu>0, there is an efficient algorithm for agnostically learning halfspaces under the uniform distribution with an approximation ratio of (1+μ)(1+\mu).

As noted above, showed that under a certain complexity assumption (hardness of learning sparse parity), there are no exact efficient algorithms (i.e., with approximation ratio α=1\alpha=1). In that case, our result is optimal.

Open questions: Obvious open questions are to extend our results to more distributions (uniform on {±1}d\{\pm 1\}^{d}, permutation-invariant, product, log-concave, …) and more problems (learning intersection of halfspaces, functions of halfspaces, …). In addition, as opposed to previous approximation algorithms , our algorithm does not always return a halfspace classifier. A natural open question is therefore to find a proper PTAS.

Our algorithm and its analysis build on and combine various algorithmic and proof techniques that were previously used for learning halfspaces. This includes regression based algorithms (e.g. ), polynomial approximations of the sign function (e.g. ) and localization techniques . In this section we outline these techniques and the way we use them. Then, we present our PTAS, state its properties (theorem 1.5), and describe the course of the proof. The full proof is in sections 2 and 3.

1.3 Learning halfspaces using sign approximations

To use theorem 1.2 for learning halfspaces, we need to prove the existence of low degree polynomials PP such that ∥h−P∥1,D\|h-P\|_{1,{\cal D}} is small, where hh is a halfspace classifier. As explained below, this is naturally done by approximating the sign function, sign⁡(x)={1x>0−1x≤0\operatorname*{sign}(x)=\begin{cases}1&x>0\\ -1&x\leq 0\end{cases}, with respect to an appropriate proximity measure.

1.4 Localization

An additional algorithmic component we will use, except polynomial regression, is localization in the instance and the hypotheses space (e.g. ). The basic idea is the following. Suppose that w∗∈Sd−1w^{*}\in S^{d-1} defines the optimal halfspace. Suppose furthermore that we have found (say, using some simple algorithm) a vector w∈Sd−1w\in S^{d-1} that defines a halfspace with a relatively small error. The facts that the marginal distribution is uniform and Err⁡(hw)\operatorname{Err}(h_{w}) is small have two relevant consequences:

We know that the optimal vector, w∗w^{*}, is close to ww.

Hence, if ∣⟨w,x⟩∣|\langle w,x\rangle| is large, then hw∗(x)=hw(x)h_{w^{*}}(x)=h_{w}(x) and therefore we know hw∗(x)h_{w^{*}}(x).

There is an efficient learning algorithm with label complexity poly⁡(d,log⁡(1η))\operatorname{poly}\left(d,\log\left(\frac{1}{\eta}\right)\right) that tolerates noise rate of ηα0\frac{\eta}{\alpha_{0}} for some universal constant α0>1\alpha_{0}>1. Moreover, the algorithm is proper, that is, its output is a halfspace.

1.5 The PTAS and its analysis

In a nutshell, our algorithm first find (step 1) a “rough estimation”, ww, of w∗w^{*}. Then, it “localizes the learning” and apply more computation power (step 3), to a small strip TT that is closed to hwh_{w}’s decision boundary, and therefore, intuitively, we are less certain about hwh_{w}’s prediction.

With appropriate choice of the parameters r,β,γr,\beta,\gamma (depending on 0<μ,η≤10<\mu,\eta\leq 1), algorithm 1 satisfies:

It tolerates noise rate of (1−μ)η(1-\mu)\eta.

It runs in time poly⁡(dlog⁡3(1μ)μ2,1η)\operatorname{poly}\left(d^{\frac{\log^{3}\left(\frac{1}{\mu}\right)}{\mu^{2}}},\frac{1}{\eta}\right).

Its label complexity is poly⁡(dlog⁡3(1μ)μ2,log⁡(1η))\operatorname{poly}\left(d^{\frac{\log^{3}\left(\frac{1}{\mu}\right)}{\mu^{2}}},\log\left(\frac{1}{\eta}\right)\right).

Proof outline. To prove theorem 1.5, we must show that we can choose the parameters so that the time and label complexity are as stated, and under the assumption that Err⁡D(hw∗)≤(1−μ)η\operatorname{Err}_{{\cal D}}(h_{w^{*}})\leq(1-\mu)\eta, the error of the returned classifier satisfies Err⁡D(h)≤η\operatorname{Err}_{{\cal D}}(h)\leq\eta. Below, we explain how we do that. We would naturally like to decompose the error into two parts:

We first handle the former summand using a localization lemma (lemma 2.1 below). We show that for γ=Θ(ηlog⁡(1μ)d)\gamma=\Theta\left(\frac{\eta\sqrt{\log\left(\frac{1}{\mu}\right)}}{\sqrt{d}}\right), the probability that hw(x)≠hw∗(x)h_{w}(x)\neq h_{w^{*}}(x) outside the strip TT, is ≤μη2\leq\frac{\mu\eta}{2}. Hence, on the complement of TT, the returned classifier, that coincides with hwh_{w}, is as good as h∗h_{*}, up to an additive error of μη2\frac{\mu\eta}{2}. Concretely,

It remains to handle the latter summand in equation (4). It is enough to show that

Indeed, in that case it follows from equations (3), (4) and (5) that

We first (section 3.1) show how to find polynomials that approximate the sign function on all the points of a given segment [−a,a][-a,a], except the area that is very close to the origin, say [−ϵ,ϵ][-\epsilon,\epsilon]. To this end, we invoke Jackson’s theorem (theorem 1.3) to find a polynomial that roughly (up to an error of, say, 0.10.1) approximates the sign function on the mentioned regime. Namely, we find a polynomial pp of degree O(aϵ)O\left(\frac{a}{\epsilon}\right) that maps [−a,−ϵ][-a,-\epsilon] (resp. [ϵ,a][\epsilon,a]) to [−1.1,−0.9][-1.1,-0.9] (resp. [0,9,1.1][0,9,1.1]). To move from accuracy of 0.10.1 to accuracy of some small τ>0\tau>0, we compose pp with another polynomial rr that maps [−1.1,−0.9][-1.1,-0.9] (resp. [0.9,1.1][0.9,1.1]) to [−1−τ,−1+τ][-1-\tau,-1+\tau] (resp. [1−τ,1+τ][1-\tau,1+\tau]). Using the Taylor expansion of the the error function erf⁡(x):=12π∫−∞xe−t22dt\operatorname*{erf}(x):=\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{x}e^{-\frac{t^{2}}{2}}dt, we show that there exists such rr of degree O(log⁡(1τ))O\left(\log\left(\frac{1}{\tau}\right)\right).

In the last step (section 3.3), using basic facts about high dimensional spherical geometry, we show that the distribution (D∣T×{±1})w∗({\cal D}|_{T\times\{\pm 1\}})_{w^{*}} have strong enough tail bounds.

2 Related work

Proof of theorem 1.5

For localization arguments, we will use the following lemma.

Let w,w∗∈Sn−1w,w^{*}\in S^{n-1} and let D{\cal D} be a distribution of Sd−1×{±1}S^{d-1}\times\{\pm 1\} such that D∣Sd−1{\cal D}|_{S^{d-1}} is uniform.

We have θ(w,w∗)π≤Err⁡D(w)+Err⁡D(w∗)\frac{\theta(w,w^{*})}{\pi}\leq\operatorname{Err}_{{\cal D}}(w)+\operatorname{Err}_{{\cal D}}(w^{*}).

If x∈Sd−1x\in S^{d-1} is a uniform vector, then for every r>0r>0,

Proof For the first part we note that Pr⁡x∼D(hw(x)≠hw∗(x))=θ(w,w∗)π\Pr_{x\sim{\cal D}}\left(h_{w}(x)\neq h_{w^{*}}(x)\right)=\frac{\theta(w,w^{*})}{\pi}, while on the other hand,

Therefore, if PV(x)∈BP_{V}(x)\in B and ∣⟨x,w⟩∣>r⋅θ(w,w∗)|\langle x,w\rangle|>r\cdot\theta(w,w^{*}) then hw(x)=hw∗(x)h_{w}(x)=h_{w^{*}}(x). It follows that

Finally, let e1,e2∈Ve_{1},e_{2}\in V be an orthonormal basis. Note that if ∣⟨x,e1⟩∣≤r2|\langle x,e_{1}\rangle|\leq\frac{r}{\sqrt{2}} and ∣⟨x,e2⟩∣≤r2|\langle x,e_{2}\rangle|\leq\frac{r}{\sqrt{2}} then PV(x)∈BP_{V}(x)\in B. Hence, we have

Here, the last inequality follows from the well known measure concentration bound according which for every e∈Sd−1e\in S^{d-1} and σ>0\sigma>0 we have Pr⁡(∣⟨x,e⟩∣≥σ)≤2exp⁡(−14σ2d)\Pr\left(|\langle x,e\rangle|\geq\sigma\right)\leq 2\exp\left(-\frac{1}{4}\sigma^{2}d\right).

Lastly, we will also rely on the following complexity analysis of algorithm 1.

The runtime of algorithm 1 is poly⁡(dr,1β,1γ,1η)\operatorname{poly}\left(d^{r},\frac{1}{\beta},\frac{1}{\gamma},\frac{1}{\eta}\right) and the label complexity is poly⁡(dr,1η,log⁡(1η))\operatorname{poly}\left(d^{r},\frac{1}{\eta},\log\left(\frac{1}{\eta}\right)\right).

Proof The runtime of step 1 is poly⁡(d,1η)\operatorname{poly}\left(d,\frac{1}{\eta}\right), while the label complexity is poly⁡(d,log⁡(1η))\operatorname{poly}\left(d,\log\left(\frac{1}{\eta}\right)\right). For step 3, we can apply the algorithm on poly⁡(dr,1η)\operatorname{poly}\left(d^{r},\frac{1}{\eta}\right) examples and labels from the distribution D∣T{\cal D}|_{T}. We can get these many examples by sampling poly⁡(dr,1β,1Pr⁡D(T×{±1}))\operatorname{poly}\left(d^{r},\frac{1}{\beta},\frac{1}{\Pr_{{\cal D}}(T\times\{\pm 1\})}\right) examples from D{\cal D} and keep and expose the labels of only the first poly⁡(dr,1β)\operatorname{poly}\left(d^{r},\frac{1}{\beta}\right) examples that fell in TT. It is not hard to see that Pr⁡D(T×{±1})≥Ω(min⁡(γd,1))\Pr_{{\cal D}}(T\times\{\pm 1\})\geq\Omega\left(\min\left(\gamma\sqrt{d},1\right)\right). Hence, the runtime of step 3 is poly⁡(dr,1β,1γ)\operatorname{poly}\left(d^{r},\frac{1}{\beta},\frac{1}{\gamma}\right). To summarize, the total runtime is poly⁡(dr,1β,1γ,1η)\operatorname{poly}\left(d^{r},\frac{1}{\beta},\frac{1}{\gamma},\frac{1}{\eta}\right) and the label complexity is poly⁡(dr,1β,log⁡(1η))\operatorname{poly}\left(d^{r},\frac{1}{\beta},\log\left(\frac{1}{\eta}\right)\right).

By assumption, Err⁡D(hw∗)≤(1−μ)η\operatorname{Err}_{{\cal D}}(h_{w^{*}})\leq(1-\mu)\eta. Hence, Err⁡D(P)≤η\operatorname{Err}_{{\cal D}}(P)\leq\eta, as required. It also follows from lemma 2.4 that the runtime and label complexity are poly⁡(dlog⁡2(1/μ)μ2)\operatorname{poly}\left(d^{\frac{\log^{2}\left(1/\mu\right)}{\mu^{2}}}\right) (note that η\eta is bounded from below by a constant) as stated .

Next, we deal with the case that η≤12(1+α0)\eta\leq\frac{1}{2(1+\alpha_{0})}. We will show that it is possible to choose r=Θ(log⁡3(1μ)μ2)r=\Theta\left(\frac{\log^{3}\left(\frac{1}{\mu}\right)}{\mu^{2}}\right), β=θ(μlog⁡(1μ))\beta=\theta\left(\frac{\mu}{\sqrt{\log\left(\frac{1}{\mu}\right)}}\right) and γ=Θ(ηlog⁡(1μ)d)\gamma=\Theta\left(\frac{\eta\sqrt{\log\left(\frac{1}{\mu}\right)}}{\sqrt{d}}\right) for which the algorithm will have the desired properties. Also, by lemma 2.4, for such a choice of parameters, the runtime and label complexity are as stated.

Let w∗w^{*} be the vector defining the optimal halfspace. By assumption, Err⁡D(hw∗)≤(1−μ)η\operatorname{Err}_{{\cal D}}(h_{w^{*}})\leq(1-\mu)\eta. Let ww be the vector found in step 1, and let PP be the polynomial found in step 3. We first claim that we can assume w.l.o.g. that

and in that case the algorithm will return, in the last step, w.p. 12\frac{1}{2}, a hypothesis with error at most η\eta, as required.

Let h(x)={hw(x)∣⟨w,x⟩∣>γsign⁡(P(x))∣⟨w,x⟩∣≤γh(x)=\begin{cases}h_{w}(x)&|\langle w,x\rangle|>\gamma\\ \operatorname*{sign}(P(x))&|\langle w,x\rangle|\leq\gamma\end{cases}. It is enough to show that Err⁡D(h)≤η\operatorname{Err}_{{\cal D}}(h)\leq\eta. Let T=Td,γ(w):={u∈Sd−1:∣⟨w,u⟩∣≤γ}T=T_{d,\gamma}(w):=\{u\in S^{d-1}:|\langle w,u\rangle|\leq\gamma\}. The error of hh is

Now, by an appropriate choice of γ=Θ(ηlog⁡(1μ)d)\gamma=\Theta\left(\frac{\eta\sqrt{\log\left(\frac{1}{\mu}\right)}}{\sqrt{d}}\right), we get

We next deal with the term Pr⁡(x,y)∼D(x∈T)⋅Err⁡D∣T(P)\Pr_{(x,y)\sim{\cal D}}\left(x\in T\right)\cdot\operatorname{Err}_{{\cal D}|_{T}}(P). Since γ=Θ(ηlog⁡(1μ)d)\gamma=\Theta\left(\frac{\eta\sqrt{\log\left(\frac{1}{\mu}\right)}}{\sqrt{d}}\right) we have that

Also, by equation (8) and the assumption that η≤12(α0+1)\eta\leq\frac{1}{2(\alpha_{0}+1)}, we have that 0≤θ≤π20\leq\theta\leq\frac{\pi}{2}. For this regime, sin⁡(θ)≥2θπ\sin(\theta)\geq\frac{2\theta}{\pi}. Hence, by equation (6) we have

By equations (10) and (11) we can choose β=μ4Clog⁡(1μ)\beta=\frac{\mu}{4C\sqrt{\log\left(\frac{1}{\mu}\right)}}, where C>0C>0 is a universal constant that is large enough so that

By equation 12 and lemma 2.3 we can choose r=Θ(log⁡2(1β)β2)=Θ(log⁡3(1μ)μ2)r=\Theta\left(\frac{\log^{2}\left(\frac{1}{\beta}\right)}{\beta^{2}}\right)=\Theta\left(\frac{\log^{3}\left(\frac{1}{\mu}\right)}{\mu^{2}}\right) such that

By equations (7), (9) and (13) we conclude that

Polynomial approximation of the sign function

Let a,γ,τ>0a,\gamma,\tau>0. There exist a polynomial pp of degree O(1γ⋅log⁡(1τ))O\left(\frac{1}{\gamma}\cdot\log\left(\frac{1}{\tau}\right)\right) such that

For x∈[−a,a]∖[−γ⋅a,γ⋅a]x\in[-a,a]\setminus[-\gamma\cdot a,\gamma\cdot a], ∣p(x)−sign⁡(x)∣<τ|p(x)-\operatorname*{sign}(x)|<\tau.

Let τ>0\tau>0. There exist a polynomial pp of degree O(log⁡(1τ))O\left(\log\left(\frac{1}{\tau}\right)\right) such that

For x∈[−1.5,1.5]∖[−0.5,0.5]x\in[-1.5,1.5]\setminus[-0.5,0.5], ∣p(x)−sign⁡(x)∣<τ|p(x)-\operatorname*{sign}(x)|<\tau.

Proof The proof is established by approximating the error function, erf⁡(x):=12π∫−∞xe−t22dt\operatorname*{erf}(x):=\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{x}e^{-\frac{t^{2}}{2}}dt by a low degree polynomial. Let σ=22log⁡(42πτ)\sigma=2\sqrt{2\log(\frac{4}{\sqrt{2\pi}\tau})}. We claim that for every x>σ2x>\frac{\sigma}{2} we have

Because 0≤erf⁡(x)≤10\leq\operatorname*{erf}(x)\leq 1 for all xx, and since erf⁡(x)=1−erf⁡(−x)\operatorname*{erf}(x)=1-\operatorname*{erf}(-x), it is enough to prove that erf⁡(x)≥1−τ4\operatorname*{erf}(x)\geq 1-\frac{\tau}{4}. Indeed, we have

Now, by the Taylor expansion of exe^{x} we have

Integrating element-wise and using the fact that erf⁡(0)=12\operatorname*{erf}(0)=\frac{1}{2}, we have

Let rr be the 2k2k’th Taylor polynomial of erf⁡\operatorname*{erf} for k=max⁡{⌈2(1.5σ)2e⌉,log⁡2(4τ)}=O(log⁡(1τ))k=\max\{\lceil 2(1.5\sigma)^{2}e\rceil,\log_{2}\left(\frac{4}{\tau}\right)\}=O\left(\log\left(\frac{1}{\tau}\right)\right). We have, for ∣x∣≤1.5σ≤k2e|x|\leq 1.5\sigma\leq\sqrt{\frac{k}{2e}}

Here, the 4’th inequality follows from the well known fact that n!≥2π(ne)nn!\geq\sqrt{2\pi}\left(\frac{n}{e}\right)^{n}. Finally, using the last inequality and equation (14), it is not hard to check that the polynomial p(x)=2r(σx)−1p(x)=2r(\sigma x)-1 satisfies the required properties.

2 Approximations for short tailed distributions

Then, for every 0<τ≤σ2γ0<\tau\leq\frac{\sigma}{2\gamma} there is a polynomial of degreeThe constant in the big-O notation is universal. O(log⁡2(1/τ)τ2)O\left(\frac{\log^{2}\left(1/\tau\right)}{\tau^{2}}\right) such that

Proof (of lemma 3.3) By lemma 3.1, there is a polynomial pp of degree O(rlog⁡(1/τ))O\left(r\log\left(1/\tau\right)\right) such that

For x∈[−rτσ,rτσ]x\in\left[-r\tau\sigma,r\tau\sigma\right], ∣p(x)∣<2|p(x)|<2.

For x∈[−rτσ,−τσ100]x\in\left[-r\tau\sigma,-\frac{\tau\sigma}{100}\right], ∣p(x)∣<τ100|p(x)|<\frac{\tau}{100}.

For x∈[τσ100,rτσ]x\in\left[\frac{\tau\sigma}{100},r\tau\sigma\right], ∣p(x)−1∣<τ100|p(x)-1|<\frac{\tau}{100}.

It remains to bound ∫∣x∣≥rτσ∣p(x)−sign⁡(x)∣ρ(x)dx\int_{|x|\geq r\tau\sigma}|p(x)-\operatorname*{sign}(x)|\rho(x)dx. We will choose r≥1τ2r\geq\frac{1}{\tau^{2}}, and therefore we will have rτσ≥στ≥2γr\tau\sigma\geq\frac{\sigma}{\tau}\geq 2\gamma. Hence, by lemma 3.4 we have

Now, it is possible to choose r=Θ(log⁡(1/τ)τ2)r=\Theta\left(\frac{\log\left(1/\tau\right)}{\tau^{2}}\right) such that for all y>rτy>r\tau we have (2yrτ)r⋅e−y264≤1\left(\frac{2y}{r\tau}\right)^{r}\cdot e^{-\frac{y^{2}}{64}}\leq 1. For such rr, the last expression is bounded by 12∫ω(1τ)∞e−y264dy=o(τ)12\int_{\omega\left(\frac{1}{\tau}\right)}^{\infty}e^{-\frac{y^{2}}{64}}dy=o(\tau).

3 Approximation on a biased strip: proof of lemma 2.3

There is a univariate polynomial pp of degree r=O(log⁡2(1/τ)τ)r=O\left(\frac{\log^{2}\left(1/\tau\right)}{\tau}\right) such that

Lemma 3.5 follows immediately from lemma 3.3 with σ=sin⁡(θ)d\sigma=\frac{\sin(\theta)}{\sqrt{d}}, the assumptions that γ<12\gamma<\frac{1}{2} and τ<sin⁡(θ)2γd\tau<\frac{\sin(\theta)}{2\gamma\sqrt{d}}, and the following bound:

We will use the following well known inequality

Let AA be the probability of Td,γ(w)T_{d,\gamma}(w) according to the uniform distribution. We have

Proof Let xx be a uniform vector in the strip Td,γ(w)T_{d,\gamma}(w), and let y=⟨w∗,x⟩y=\langle w^{*},x\rangle. We note that ρd,γ,θ\rho_{d,\gamma,\theta} is the density of yy. We write

where ⟨w,z⟩=0\langle w,z\rangle=0. For (w∗)⊥=w∗−⟨w∗,w⟩w(w^{*})^{\perp}=w^{*}-\langle w^{*},w\rangle w we have,

We note that the density function of the distribution of α⋅cos⁡(θ)\alpha\cdot\cos(\theta) is given by

Now, given α\alpha, zz is a uniform vector of norm 1−α2\sqrt{1-\alpha^{2}} in the orthogonal complement of ww, and (w∗)⊥(w^{*})^{\perp} is a vector of norm sin⁡(θ)\sin(\theta) in that space. It follows that the density function of ⟨(w∗)⊥,z⟩\langle(w^{*})^{\perp},z\rangle given that α⋅cos⁡(θ)=u\alpha\cdot\cos(\theta)=u is ρd−1,sin⁡(θ)⋅1−u2cos⁡2(θ)=ρd−1,sin⁡2(θ)−tan⁡2(θ)u2\rho_{d-1,\sin(\theta)\cdot\sqrt{1-\frac{u^{2}}{\cos^{2}(\theta)}}}=\rho_{d-1,\sqrt{\sin^{2}(\theta)-\tan^{2}(\theta)u^{2}}}. It therefore follows that

Proof (of lemma 3.6) Let AA be the probability of the strip Td,γ(w)T_{d,\gamma}(w) according to the uniform distribution on the sphere. We have, using equations (15) and (16),

Proof (of lemma 2.2) By equation (1.1.3), in is enough to show that the there is a univariate polynomial pp of degree r=O(log⁡2(1/τ)τ2)r=O\left(\frac{\log^{2}\left(1/\tau\right)}{\tau^{2}}\right) such that

This, however, follows immediately from lemma 3.3 and equation (16).

Amit Daniely is a recipient of the Google Europe Fellowship in Learning Theory, and this research is supported in part by this Google Fellowship. The author thanks Pranjal Awasthi, Adam Klivans, Nati Linial, and Shai Shalev-Shwartz for valuable discussions and comments.

References