More data speeds up training time in learning halfspaces over sparse vectors
Amit Daniely, Nati Linial, Shai Shalev Shwartz
Introduction
In the modern digital period, we are facing a rapid growth of available datasets in science and technology. In most computing tasks (e.g. storing and searching in such datasets), large datasets are a burden and require more computation. However, for learning tasks the situation is radically different. A simple observation is that more data can never hinder you from performing a task. If you have more data than you need, just ignore it!
A basic question is how to learn from “big data”. The statistical learning literature classically studies questions like “how much data is needed to perform a learning task?” or “how does accuracy improve as the amount of data grows?” etc. In the modern, “data revolution era”, it is often the case that the amount of data available far exceeds the information theoretic requirements. We can wonder whether this, seemingly redundant data, can be used for other purposes. An intriguing question in this vein, studied recently by several researchers ((Decatur et al., 1998; Servedio., 2000; Shalev-Shwartz et al., 2012; Berthet and Rigollet, 2013; Chandrasekaran and Jordan, 2013)), is the following
Question 1: Are there any learning tasks in which more data, beyond the information theoretic barrier, can provably be leveraged to speed up computation time?
To prove this, we present a novel technique to establish computational-statistical tradeoffs in supervised learning problems. To the best of our knowledge, this is the first such a result that is not based on cryptographic primitives.
The natural learning problem we consider is the task of learning the class of halfspaces over -sparse vectors. Here, the instance space is the space of -sparse vectors,
and the hypothesis class is halfspaces over -sparse vectors, namely
In addition, we allow improper learning (a.k.a. representation independent learning), namely, the learning algorithm is not restricted to output a hypothesis from , but only should output a hypothesis whose error is not much larger than the error of the best hypothesis in . This gives the learner a lot of flexibility in choosing an appropriate representation of the problem. This additional freedom to the learner makes it much harder to prove lower bounds in this model. Concretely, it is not clear how to use standard reductions from NP hard problems in order to establish lower bounds for improper learning (moreover, Applebaum et al. (2008) give evidence that such simple reductions do not exist).
The classes and similar classes have been studied by several authors (e.g. Long. and Servedio (2013)). They naturally arise in learning scenarios in which the set of all possible features is very large, but each example has only a small number of active features. For example:
Predicting an advertisement based on a search query: Here, the possible features of each instance are all English words, whereas the active features are only the set of words given in the query.
Learning Preferences (Hazan et al., 2012): Here, we have players. A ranking of the players is a permutation (think of as the rank of the ’th player). Each ranking induces a preference over the ordered pairs, such that iff is ranked higher that . Namely,
We will show a positive answer to Question 1 for the class . To do so, we showIn fact, similar results hold for every constant . Indeed, since for every , it is trivial that item below holds for every . The upper bound given in item holds for every . For item 2, it is not hard to show that can be learnt using a sample of examples by a naive improper learning algorithm, similar to the algorithm we describe in this section for . the following:
Ignoring computational issues, it is possible to learn the class using examples.
A graphical illustration of our main results is given below:
runtime2^{O(n)}<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo>></mo><mi mathvariant="normal">poly</mi><mo></mo><mo stretchy="false">(</mo><mi>n</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">>\operatorname{poly}(n)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.5782em;vertical-align:-0.0391em;"></span><span class="mrel">></span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mop"><span class="mord mathrm" style="margin-right:0.0139em;">poly</span></span><span class="mopen">(</span><span class="mord mathnormal">n</span><span class="mclose">)</span></span></span></span></span>n^{O(1)}examples The proof of item 1 above is easy – simply note that has VC dimension .
Item 2 is proved in section 4, relying on the results of Hazan et al. (2012). We note, however, that a weaker result, that still suffices for answering Question 1 in the affirmative, can be proven using a naive improper learning algorithm. In particular, we show below how to learn efficiently with a sample of examples. The idea is to replace the class with the class containing all functions from to . Clearly, this class contains . In addition, we can efficiently find a function that minimizes the empirical training error over a training set as follows: For every , if does not appear at all in the training set we will set arbitrarily to . Otherwise, we will set to be the majority of the labels in the training set that correspond to . Finally, note that the VC dimension of is smaller than (since ). Hence, standard generalization results (e.g. Vapnik (1995)) implies that a training set size of suffices for learning this class.
Item 3 is shown in section 3 by presenting a novel technique for establishing statistical-computational tradeoffs.
The class . Our main result gives a positive answer to Question 1 for the task of improperly learning for . A natural question is what happens for and . Since , the information theoretic barrier for learning these classes is . In section 4, we prove that (and, consequently, ) can be learnt using examples, indicating that significant computational-statistical tradeoffs start to manifest themselves only for .
Recently, (Berthet and Rigollet, 2013) gave a positive answer to Question 1 in the context of unsupervised learning. Concretely, they studied the problem of sparse PCA, namely, finding a sparse vector that maximizes the variance of an unsupervised data. Conditioning on the hardness of the planted clique problem, they gave a positive answer to Question 1 for sparse PCA. Our work, as well as the previous work of Decatur et al. (1998); Servedio. (2000); Shalev-Shwartz et al. (2012), studies Question 1 in the supervised learning setup. We emphasize that unsupervised learning problems are radically different than supervised learning problems in the context of deriving lower bounds. The main reason for the difference is that in supervised learning problems, the learner is allowed to employ improper learning, which gives it a lot of power in choosing an adequate representation of the data. For example, the upper bound we have derived for the class of sparse halfspaces switched from representing hypotheses as halfspaces to representation of hypotheses as tables over , which made the learning problem easy from the computational perspective. The crux of the difficulty in constructing lower bounds is due to this freedom of the learner in choosing a convenient representation. This difficulty does not arise in the problem of sparse PCA detection, since there the learner must output a good sparse vector. Therefore, it is not clear whether the approach given in (Berthet and Rigollet, 2013) can be used to establish computational-statistical gaps in supervised learning problems.
Background and notation
For and a distribution on we denote the error of w.r.t. by . For we denote the error of w.r.t. by . For a sample we denote by (resp. ) the error of (resp. ) w.r.t. the empirical distribution induces by the sample .
A learning algorithm, , receives a sample and return a hypothesis . We say that learns using examples if,For simplicity, we require the algorithm to succeed with probability of at least . This can be easily amplified to probability of at least , as in the usual definition of agnostic PAC learning, while increasing the sample complexity by a factor of . for every distribution on and a sample of more than i.i.d. examples drawn from ,
The algorithm is efficient if it runs in polynomial time in the sample size and returns a hypothesis that can be evaluated in polynomial time.
Soundness: If , then
In fact, for all we know, the following conjecture may be true for every .
Note that Feige’s conjecture is equivalent to the -R3SAT hardness assumption.
Let . If the -R3SAT hardness assumption (conjecture 2.2) is true, then there exists no efficient learning algorithm that learns the class using examples.
In the proof of Theorem 3.1 we rely on the validity of a conjecture, similar to conjecture 2.2 for -variables majority formulas. Following an argument from (Feige, 2002) (Theorem 3.2) the validity of the conjecture on which we rely for majority formulas follows the validity of conjecture 2.2.
An -variables 3MAJ clause is a boolean formula of the form
An -variables 3MAJ formula is a boolean formula of the form
where the ’s are 3MAJ clauses. By we denote the set of 3MAJ formulas with variables and clauses.
Let . If the -R3SAT hardness assumption is true, then for every and for every large enough integer there exists no efficient algorithm with the following properties.
If , then
Next, we prove Theorem 3.1. In fact, we will prove a slightly stronger result. Namely, define the subclass , of homogenous halfspaces with binary weights, given by . As we show, under the -R3SAT hardness assumption, it is impossible to efficiently learn this subclass using only examples.
The crux of the construction is that if is random, no algorithm (even improper and even inefficient) can return a hypothesis with a small error. The reason for that is that since the sample provided to the algorithm consists of only samples, the algorithm won’t see most of ’s clauses, and, consequently, the produced hypothesis will be independent of them. Since these clauses are random, is likely to err on about half of them, so that will be close to half!
To summarize we constructed an efficient algorithm with the following properties: if is almost satisfiable, the algorithm will return a hypothesis with a small error, and then we will declare “exceptional”, while for random , the algorithm will return a hypothesis with a large error, and we will declare “typical”.
Our construction crucially relies on the restriction to learning algorithm with a small sample complexity. Indeed, if the learning algorithm obtains more than examples, then it will see most of ’s clauses, and therefore it might succeed in “learning” even when the source of the formula is random. Therefore, we will declare “exceptional” even when the source is random.
(of theorem 3.1) Assume by way of contradiction that the -R3SAT hardness assumption is true and yet there exists an efficient learning algorithm that learns the class using examples. Setting , we conclude that there exists an efficient algorithm and a constant such that given a sample of more than examples drawn from a distribution on , returns a classifier such that
W.p. over the choice of , .
Fix large enough such that and the conclusion of Theorem 3.2 holds with . We will construct an algorithm, , contradicting Theorem 3.2. On input consisting of the 3MAJ clauses , the algorithm proceeds as follows
Generate a sample consisting of examples as follows. For every clause, , generate an example by choosing at random and letting
For example, if , the clause is and , we generate the example
Choose a sample consisting of examples by choosing at random (with repetitions) examples from .
We claim that contradicts Theorem 3.2. Clearly, runs in polynomial time. It remains to show that
If , then
Assume first that is chosen at random. Given the sample , the sample is a sample of i.i.d. examples which are independent from the sample , and hence also from . Moreover, for every example , is a Bernoulli random variable with parameter which is independent of . To see that, note that an example whose instance is can be generated by exactly two clauses – one corresponds to , while the other corresponds to (e.g., the instance can be generated from the clause and or the clause and ). Thus, given the instance , the probability that is , independent of .
It follows that is an average of at least independent Bernoulli random variable. By Chernoff’s bound, with probability , . Thus,
Assume now that and let be an assignment that indicates that. Let be the hypothesis . It can be easily checked that if and only if satisfies . Since , it follows that
By the choice of , with probability ,
The following theorem derives upper bounds for learning and . Its proof relies on results from Hazan et al. (2012) about learning -decomposable matrices, and due to the lack of space is given in the appendix.
There exists an efficient algorithm that learns using examples
There exists an efficient algorithm that learns using examples
Discussion
We formally established a computational-sample complexity tradeoff for the task of (agnostically and improperly) PAC learning of halfspaces over -sparse vectors. Our proof of the lower bound relies on a novel, non cryptographic, technique for establishing such tradeoffs. We also derive a new non-trivial upper bound for this task.
Amit Daniely is a recipient of the Google Europe Fellowship in Learning Theory, and this research is supported in part by this Google Fellowship. Nati Linial is supported by grants from ISF, BSF and I-Core. Shai Shalev-Shwartz is supported by the Israeli Science Foundation grant number 590-10.
References
Appendix A Proof of Theorem 4.1
The proof of the theorem relies on results from Hazan et al. about learning -decomposable matrices. Let be an matrix. We define the symmetrization of to be the matrix
We say that is -decomposable if there exist positive semi-definite matrices for which
Each matrix in can be naturally interpreted as a hypothesis on .
We say that a learning algorithm learns a class using examples if, for every distribution on and a sample of more than i.i.d. examples drawn from ,
Hazan et al. have provedThe result of Hazan et al. is more general than what is stated here. Also, Hazan et al. considered the online scenario. The result for the statistical scenario, as stated here, can be derived by applying standard online-to-batch conversions (see for example Cesa-Bianchi et al. ). that
Hazan et al. The hypothesis class of -decomposable matrices with entries ban be efficiently learnt using a sample of examples.
We start with a generic reduction from a problem of learning a class over an instance space to the problem of learning -decomposable matrices. We say that is realized by matrices that are -decomposable if there exists a mapping such that for every there exists a -decomposable matrix for which . The mapping is called a realization of . In the case that the mapping can be computed in time polynomial in , we say that is efficiently realized and is an efficient realization. It follows from Theorem A.1 that:
If is efficiently realized by matrices that are -decomposable then can be efficiently learnt using a sample of examples.
We now turn to the proof of Theorem 4.1. We start with the first assertion, about learning . The idea will be to partition the instance space into a disjoint union of subsets and show that the restriction of the hypothesis class to each subset can be efficiently realized by -decomposable. Concretely, we decompose into a disjoint union of five sets
For every , can be efficiently realized by matrices that are -decomposable.
To glue together the five restrictions, we will rely on the following Lemma, whose proof is given in section A.1.
Let be partition of a domain and let be a hypothesis class over . Define . Suppose the for every there exist a learning algorithm that learns using examples, for some constant . Consider the algorithm which receives an i.i.d. training set of examples from and applies the learning algorithm for each on the examples in that belongs to . Then, learns using at most
The first part of Theorem 4.1 is therefore follows from Lemma A.3, Lemma A.4 and Corollary A.2.
Having the first part of Theorem 4.1 and Lemma A.4 at hand, it is not hard to prove the second part of Theorem 4.1:
For and define
Let be the mapping that zeros the first non zero coordinate. It is not hard to see that . Therefore can be identified with using the mapping , and therefore can efficiently learnt using examples (the dependency on does not appear in the statement, but can be easily inferred from the proof). The second part of Theorem 4.1 is therefore follows from the first part of the Theorem and Lemma A.4.
In the proof, we will rely on the following facts. The tensor product of two matrices and is defined as the matrix
Let be a -decomposable matrix and let be a PSD matrix whose diagonal entries are upper bounded by . Then is -decomposable.
It is not hard to see that for every matrix and a symmetric matrix ,
Moreover, since the tensor product of two PSD matrices is PSD, if is a -decomposition of , then
is a -decomposition of . ∎
If is a -decomposable matrix, then so is every matrix obtained from by iteratively deleting rows and columns.
It is enough to show that deleting one row or column leaves -decomposable. Suppose that is obtained from by deleting the ’th row (the proof for deleting columns is similar). It is not hard to see that is the ’th principal minor of . Therefore, since principal minors of PSD matrices are PSD matrices as well, if is -decomposition of then is a -decomposition of . ∎
Hazan et al. Let be the upper triangular matrix whose all entries in the diagonal and above are , and whose all entries beneath the diagonal are . Then is -decomposable.
Lastly, we will also need the following generalization of proposition A.7
Let be an matrix. Assume that there exists a sequence such that
Since switching rows of a -decomposable matrix leaves a -decomposable matrix, we can assume without loss of generality that . Let be the all ones matrix. It is not hard to see that can be obtained from by iteratively deleting rows and columns. Combining propositions A.5, A.6 and A.7, we conclude that is -decomposable, as required. ∎
(of Lemma A.3) Denote . We split into cases.
Case 1, r=0: Note that . Define by . We claim that is an efficient realization of by matrices that are decomposable. Indeed, let , and let be the matrix . It is enough to show that is -decomposable.
From equation (1), it is not hard to see that there exist numbers
The conclusion follows from Proposition A.8
Case 2, r=2 and r=-2: We confine ourselves to the case . The case is similar. Note that . Define by . We claim that is an efficient realization of by matrices that are decomposable. Indeed, let , and let be the matrix . It is enough to show that is -decomposable.
From equation (2), it is not hard to see that there exist numbers
The conclusion follows from Proposition A.8
Case 3, r=1 and r=-1: We confine ourselves to the case . The case is similar. Note that . Define by . We claim that is an efficient realization of by matrices that are -decomposable (let alone, -decomposable). Indeed, let , and let be the matrix with and outside the diagonal. It is enough to show that is -decomposable. Since is -decomposable, it is enough to show that is -decomposable. However, it is not hard to see that every diagonal matrix is -decomposable. ∎
(of Lemma A.4) Let be a training set and let be the number of examples in that belong to . Given that the values of the random variables is determined, we have that w.p. of at least ,
where is the induced distribution over , is the output of the ’th algorithm, and is the optimal hypothesis w.r.t. the original distribution . Define,
It follows from the above that we also have, w.p. at least , for every ,
Let , and note that . Therefore,
Next note that if then . Otherwise, using Chernoff’s inequality, for every we have
It follows that with probability of at least ,
All in all, we have shown that with probability of at least it holds that
Therefore, the the algorithm learns using