Generalization in Adaptive Data Analysis and Holdout Reuse
Cynthia Dwork, Vitaly Feldman, Moritz Hardt, Toniann Pitassi, Omer Reingold, Aaron Roth
Introduction
The goal of machine learning is to produce hypotheses or models that generalize well to the unseen instances of the problem. More generally, statistical data analysis is concerned with estimating properties of the underlying data distribution, rather than properties that are specific to the finite data set at hand. Indeed, a large body of theoretical and empirical research was developed for ensuring generalization in a variety of settings. In this work, it is commonly assumed that each analysis procedure (such as a learning algorithm) operates on a freshly sampled dataset – or if not, is validated on a freshly sampled holdout (or testing) set.
Unfortunately, learning and inference can be more difficult in practice, where data samples are often reused. For example, a common practice is to perform feature selection on a dataset, and then use the features for some supervised learning task. When these two steps are performed on the same dataset, it is no longer clear that the results obtained from the combined algorithm will generalize. Although not usually understood in these terms, “Freedman’s paradox” is an elegant demonstration of the powerful (negative) effect of adaptive analysis on the same data [Fre83]. In Freedman’s simulation, variables with significant -statistic are selected and linear regression is performed on this adaptively chosen subset of variables, with famously misleading results: when the relationship between the dependent and explanatory variables is non-existent, the procedure overfits, erroneously declaring significant relationships.
Most of machine learning practice does not rely on formal guarantees of generalization for learning algorithms. Instead a dataset is split randomly into two (or sometimes more) parts: the training set and the testing, or holdout, set. The training set is used for learning a predictor, and then the holdout set is used to estimate the accuracy of the predictor on the true distributionAdditional averaging over different partitions is used in cross-validation.. Because the predictor is independent of the holdout dataset, such an estimate is a valid estimate of the true prediction accuracy (formally, this allows one to construct a confidence interval for the prediction accuracy on the data distribution). However, in practice the holdout dataset is rarely used only once, and as a result the predictor may not be independent of the holdout set, resulting in overfitting to the holdout set [Reu03, RF08, CT10]. One well-known reason for such dependence is that the holdout data is used to test a large number of predictors and only the best one is reported. If the set of all tested hypotheses is known and independent of the holdout set, then it is easy to account for such multiple testing or use the more sophisticated approach of Ng [Ng97].
However such static approaches do not apply if the estimates or hypotheses tested on the holdout are chosen adaptively: that is, if the choice of hypotheses depends on previous analyses performed on the dataset. One prominent example in which a holdout set is often adaptively reused is hyperparameter tuning (e.g.[DFN07]). Similarly, the holdout set in a machine learning competition, such as the famous ImageNet competition, is typically reused many times adaptively. Other examples include using the holdout set for feature selection, generation of base learners (in aggregation techniques such as boosting and bagging), checking a stopping condition, and analyst-in-the-loop decisions. See [Lan05] for a discussion of several subtle causes of overfitting.
The concrete practical problem we address is how to ensure that the holdout set can be reused to perform validation in the adaptive setting. Towards addressing this problem we also ask the more general question of how one can ensure that the final output of adaptive data analysis generalizes to the underlying data distribution. This line of research was recently initiated by the authors in [DFH+14], where we focused on the case of estimating expectations of functions from i.i.d. samples (these are also referred to as statistical queries). They show how to answer a large number of adaptively chosen statistical queries using techniques from differential privacy [DMNS06](see Sec. 1.3 and Sec. 2.2 for more details).
We propose a simple and general formulation of the problem of preserving statistical validity in adaptive data analysis. We show that the connection between differentially private algorithms and generalization from [DFH+14] can be extended to this more general setting, and show that similar (but sometimes incomparable) guarantees can be obtained from algorithms whose outputs can be described by short strings. We then define a new notion, approximate max-information, that unifies these two basic techniques and gives a new perspective on the problem. In particular, we give an adaptive composition theorem for max-information, which gives a simple way to obtain generalization guarantees for analyses in which some of the procedures are differentially private and some have short description length outputs. We apply our techniques to the problem of reusing the holdout set for validation in the adaptive setting.
We describe a simple and general method, together with two specific instantiations, for reusing a holdout set for validating results while provably avoiding overfitting to the holdout set. The analyst can perform any analysis on the training dataset, but can only access the holdout set via an algorithm that allows the analyst to validate her hypotheses against the holdout set. Crucially, our algorithm prevents overfitting to the holdout set even when the analyst’s hypotheses are chosen adaptively on the basis of the previous responses of our algorithm.
Our first algorithm, referred to as Thresholdout, derives its guarantees from differential privacy and the results in [DFH+14, NS15]. For any function given by the analyst, Thresholdout uses the holdout set to validate that does not overfit to the training set, that is, it checks that the mean value of evaluated on the training set is close to the mean value of evaluated on the distribution from which the data was sampled. The standard approach to such validation would be to compute the mean value of on the holdout set. The use of the holdout set in Thresholdout differs from the standard use in that it exposes very little information about the mean of on the holdout set: if does not overfit to the training set, then the analyst receives only the confirmation of closeness, that is, just a single bit. On the other hand, if overfits then Thresholdout returns the mean value of on the training set perturbed by carefully calibrated noise.
Using results from [DFH+14, NS15] we show that for datasets consisting of i.i.d. samples these modifications provably prevent the analyst from constructing functions that overfit to the holdout set. This ensures correctness of Thresholdout’s responses. Naturally, the specific guarantees depend on the number of samples in the holdout set. The number of queries that Thresholdout can answer is exponential in as long as the number of times that the analyst overfits is at most quadratic in .
Our second algorithm SparseValidate is based on the idea that if most of the time the analyst’s procedures generate results that do not overfit, then validating them against the holdout set does not reveal much information about the holdout set. Specifically, the generalization guarantees of this method follow from the observation that the transcript of the interaction between a data analyst and the holdout set can be described concisely. More formally, this method allows the analyst to pick any Boolean function of a dataset (described by an algorithm) and receive back its value on the holdout set. A simple example of such a function would be whether the accuracy of a predictor on the holdout set is at least a certain value . (Unlike in the case of Thresholdout, here there is no need to assume that the function that measures the accuracy has a bounded range or even Lipschitz, making it qualitatively different from the kinds of results achievable subject to differential privacy). A more involved example of validation would be to run an algorithm on the holdout dataset to select an hypothesis and check if the hypothesis is similar to that obtained on the training set (for any desired notion of similarity). Such validation can be applied to other results of analysis; for example one could check if the variables selected on the holdout set have large overlap with those selected on the training set. An instantiation of the SparseValidate algorithm has already been applied to the problem of answering statistical (and more general) queries in the adaptive setting [BSSU15]. We describe the formal guarantees for SparseValidate in Section 4.2.
In Section 5 we describe a simple experiment on synthetic data that illustrates the danger of reusing a standard holdout set, and how this issue can be resolved by our reusable holdout. The design of this experiment is inspired by Freedman’s classical experiment, which demonstrated the dangers of performing variable selection and regression on the same data [Fre83].
2 Generalization in Adaptive Data Analysis
We view adaptive analysis on the same dataset as an execution of a sequence of steps . Each step is described by an algorithm that takes as input a fixed dataset drawn from some distribution over , which remains unchanged over the course of the analysis. Each algorithm also takes as input the outputs of the previously run algorithms through and produces a value in some range . The dependence on previous outputs represents all the adaptive choices that are made at step of data analysis. For example, depending on the previous outputs, can run different types of analysis on . We note that at this level of generality, the algorithms can represent the choices of the data analyst, and need not be explicitly specified. We assume that the analyst uses algorithms which individually are known to generalize when executed on a fresh dataset sampled independently from a distribution . We formalize this by assuming that for every fixed value , with probability at least over the choice of according to distribution , the output of on inputs and has a desired property relative to the data distribution (for example has low generalization error). Note that in this assumption are fixed and independent of the choice of , whereas the analyst will execute on values , where . In other words, in the adaptive setup, the algorithm can depend on the previous outputs, which depend on , and thus the set given to is no longer an independently sampled dataset. Such dependence invalidates the generalization guarantees of individual procedures, potentially leading to overfitting.
First, we spell out how the differential privacy based approach from [DFH+14] can be applied to this more general setting. Specifically, a simple corollary of results in [DFH+14] is that for a dataset consisting of i.i.d. samples any output of a differentially-private algorithm can be used in subsequent analysis while controlling the risk of overfitting, even beyond the setting of statistical queries studied in [DFH+14]. A key property of differential privacy in this context is that it composes adaptively: namely if each of the algorithms used by the analyst is differentially private, then the whole procedure will be differentially private (albeit with worse privacy parameters). Therefore, one way to avoid overfitting in the adaptive setting is to use algorithms that satisfy (sufficiently strong) guarantees of differential-privacy. In Section 2.2 we describe this result formally.
We then show how description length bounds can be applied in the context of guaranteeing generalization in the presence of adaptivity. If the total length of the outputs of algorithms can be described with bits then there are at most possible values of the input to . For each of these individual inputs generalizes with probability . Taking a union bound over failure probabilities implies generalization with probability at least . Occam’s Razor famously implies that shorter hypotheses have lower generalization error. Our observation is that shorter hypotheses (and the results of analysis more generally) are also better in the adaptive setting since they reveal less about the dataset and lead to better generalization of subsequent analyses. Note that this result makes no assumptions about the data distribution . We provide the formal details in Section 2.3. In Section B we also show that description length-based analysis suffices for obtaining an algorithm (albeit not an efficient one) that can answer an exponentially large number of adaptively chosen statistical queries. This provides an alternative proof for one of the results in [DFH+14].
An upper bound on (approximate) max-information gives generalization guarantees.
Differentially private algorithms have low max-information for any distribution over datasets. A stronger bound holds for approximate max-information on i.i.d. datasets. These bounds apply only to so-called pure differential privacy (the case).
Bounds on the description length of the output of an algorithm give bounds on the approximate max-information of the algorithm for any .
Approximate max-information composes adaptively.
Approximate max-information is preserved under post-processing.
Composition properties of approximate max-information imply that one can easily obtain generalization guarantees for adaptive sequences of algorithms, some of which are differentially private, and others of which have outputs with short description length. These properties also imply that differential privacy can be used to control generalization for any distribution over datasets, which extends its generalization guarantees beyond the restriction to datasets drawn i.i.d. from a fixed distribution, as in [DFH+14].
We remark that (pure) differential privacy and description length are otherwise incomparable – low description length is not a sufficient condition for differential privacy, since differential privacy precludes revealing even a small number of bits of information about any single individual in the data set. At the same time differential privacy does not constrain the description length of the output. Bounds on max-information or differential privacy of an algorithm can, however, be translated to bounds on randomized description length for a different algorithm with statistically indistinguishable output. Here we say that a randomized algorithm has randomized description length of if for every fixing of the algorithm’s random bits, it has description length of . Details of these results and additional discussion appear in Sections 3 and A.
3 Related Work
This work builds on [DFH+14] where we initiated the formal study of adaptivity in data analysis. The primary focus of [DFH+14] is the problem of answering adaptively chosen statistical queries. The main technique is a strong connection between differential privacy and generalization: differential privacy guarantees that the distribution of outputs does not depend too much on any one of the data samples, and thus, differential privacy gives a strong stability guarantee that behaves well under adaptive data analysis. The link between generalization and approximate differential privacy made in [DFH+14] has been subsequently strengthened, both qualitatively — by [BSSU15], who make the connection for a broader range of queries — and quantitatively, by [NS15] and [BSSU15], who give tighter quantitative bounds. These papers, among other results, give methods for accurately answering exponentially (in the dataset size) many adaptively chosen queries, but the algorithms for this task are not efficient. It turns out this is for fundamental reasons – Hardt and Ullman [HU14] and Steinke and Ullman [SU14] prove that, under cryptographic assumptions, no efficient algorithm can answer more than quadratically many statistical queries chosen adaptively by an adversary who knows the true data distribution.
Differential privacy emerged from a line of work [DN03, DN04, BDMN05], culminating in the definition given by [DMNS06]. There is a very large body of work designing differentially private algorithms for various data analysis tasks, some of which we leverage in our applications. See [Dwo11] for a short survey and [DR14] for a textbook introduction to differential privacy.
The classical approach in theoretical machine learning to ensure that empirical estimates generalize to the underlying distribution is based on the various notions of complexity of the set of functions output by the algorithm, most notably the VC dimension(see e.g. [SSBD14] for a textbook introduction). If one has a sample of data large enough to guarantee generalization for all functions in some class of bounded complexity, then it does not matter whether the data analyst chooses functions in this class adaptively or non-adaptively. Our goal, in contrast, is to prove generalization bounds without making any assumptions about the class from which the analyst can choose query functions. In this case the adaptive setting is very different from the non-adaptive setting.
An important line of work [BE02, MNPR06, PRMN04, SSSSS10] establishes connections between the stability of a learning algorithm and its ability to generalize. Stability is a measure of how much the output of a learning algorithm is perturbed by changes to its input. It is known that certain stability notions are necessary and sufficient for generalization. Unfortunately, the stability notions considered in these prior works do not compose in the sense that running multiple stable algorithms sequentially and adaptively may result in a procedure that is not stable. The measure we introduce in this work (max information), like differential privacy, has the strength that it enjoys adaptive composition guarantees. This makes it amenable to reasoning about the generalization properties of adaptively applied sequences of algorithms, while having to analyze only the individual components of these algorithms. Connections between stability, empirical risk minimization and differential privacy in the context of learnability have been recently explored in [WLF15].
Freund gives an approach to obtaining data-dependent generalization bounds that takes into account the set of statistical queries that a given learning algorithm can produce for the distribution from which the data was sampled [Fre98]. A related approach of Langford and Blum also allows to obtain data-dependent generalization bounds based on the description length of functions that can be output for a data distribution [LB03]. Unlike our work, these approaches require the knowledge of the structure of the learning algorithm to derive a generalization bound. More importantly, the focus of our framework is on the design of new algorithms with better generalization properties in the adaptive setting.
Finally, inspired by our work, Blum and Hardt [BH15] showed how to reuse the holdout set to maintain an accurate leaderboard in a machine learning competition that allows the participants to submit adaptively chosen models in the process of the competition (such as those organized by Kaggle Inc.). Their analysis also relies on the description length-based technique we used to analyze SparseValidate.
Preliminaries and Basic Techniques
In the discussion below refers to binary logarithm and refers to the natural logarithm. For simplicity we restrict our random variables to finite domains (extension of the claims to continuous domains is straightforward using the standard formalism). For two random variables and over the same domain the max-divergence of from is defined as
-approximate max-divergence is defined as
On an intuitive level, differential privacy hides the data of any single individual. We are thus interested in pairs of datasets that differ in a single element, in which case we say and are adjacent.
[DMNS06, DKM+06] A randomized algorithm with domain for is -differentially private if for all pairs of datasets that differ in a single element : The case when is sometimes referred to as pure differential privacy, and in this case we may say simply that is -differentially private.
Differential privacy is preserved under adaptive composition. Adaptive composition of algorithms is a sequential execution of algorithms on the same dataset in which an algorithm at step can depend on the outputs of previous algorithms. More formally, let be a sequence of algorithms. Each algorithm outputs a value in some range and takes as an input dataset in as well as a value in . Adaptive composition of these algorithm is the algorithm that takes as an input a dataset and executes sequentially with the input to being and the outputs of . Such composition captures the common practice in data analysis of using the outcomes of previous analyses (that is ) to select an algorithm that is executed on .
For an algorithm that in addition to a dataset has other input we say that it is -differentially private if it is -differentially private for every setting of additional parameters. The basic property of adaptive composition of differentially private algorithms is the following result (e.g.[DL09]):
Let be an -differentially private algorithm for . Then the algorithm obtained by composing ’s adaptively is -differentially private.
A more sophisticated argument yields significant improvement when (e.g.[DR14]).
For all , the adaptive composition of arbitrary -differentially private algorithms is -differentially private, where
Another property of differential privacy important for our applications is preservation of its guarantee under post-processing (e.g.[DR14, Prop. 2.1]):
If is an -differentially private algorithm with domain and range , and is any, possibly randomized, algorithm with domain and range , then the algorithm with domain and range is also -differentially private.
2 Generalization via Differential Privacy
Generalization in special cases of our general adaptive analysis setting can be obtained directly from results in [DFH+14] and composition properties of differentially private algorithms. For the case of pure differentially private algorithms with general outputs over i.i.d. datasets, in [DFH+14] we prove the following result.
An immediate corollary of Thm. 6 together with Lemma 1 is that differentially private algorithms that output low-sensitivity functions generalize.
For approximate -differential privacy, strong preservation of generalization results are currently known only for algorithms that output a function over of bounded range (for simplicity we use range $$) [DFH+14, NS15]. The following result was proved by Nissim and Stemmer [NS15] (a weaker statement is also given in [DFH+14, Thm. 10]).
Let be an -differentially private algorithm that outputs a function from to $\bm{S}\mathcal{P}^{n}{\bm{\phi}}={\cal A}({\bm{S}}).n\geq 2\ln(8/\delta)/\varepsilon^{2}$,
Many learning algorithms output a hypothesis function that aims to minimize some bounded loss function as the final output. If algorithms used in all steps of the adaptive data analysis are differentially private and the last step (that is, ) outputs a hypothesis , then generalization bounds for the loss of are implied directly by Theorem 8. We remark that this application is different from the example for pure differential privacy above since there we showed preservation of generalization guarantees of arbitrarily complex learning algorithm which need not be differentially private. In Section 4 we give an application of Theorem 8 to the reusable holdout problem.
3 Generalization via Description Length
Let and be two algorithms. We now give a simple application of bounds on the size of (or, equivalently, the description length of ’s output) to preserving generalization of . Here generalization can actually refer to any valid or desirable output of for a given given dataset and input . Specifically we will use a set to denote all datasets for which the output of on and is “bad” (e.g. overfits). Using a simple union bound we show that the probability (over a random choice of a dataset) of such bad outcome can be bounded.
In Section A we describe a generalization of description length bounds to randomized algorithms and show that it possesses the same properties.
Max-Information
Consider two algorithms and that are composed adaptively and assume that for every fixed input , generalizes for all but fraction of datasets. Here we are speaking of generalization informally: our definitions will support any property of input and dataset . Intuitively, to preserve generalization of we want to make sure that the output of does not reveal too much information about the dataset . We demonstrate that this intuition can be captured via a notion of max-information and its relaxation approximate max-information.
For two random variables and we use to denote the random variable obtained by drawing and independently from their probability distributions.
It follows immediately from Bayes’ rule that for all , . Further, if and only if for all in the support of , . Clearly, max-information upper bounds the classical notion of mutual information: .
In our use is going to be a joint distribution , where is a random -element dataset and is a (possibly randomized) algorithm taking a dataset as an input. If the output of an algorithm on any distribution has low approximate max-information then we say that the algorithm has low max-information. More formally:
We say that an algorithm has -approximate max-information of if for every distribution over -element datasets, , where is a dataset chosen randomly according to . We denote this by .
An alternative way to define the (pure) max-information of an algorithm is using the maximum of the infinity divergence between distributions on two different inputs.
Let be an algorithm with domain and range . Then .
For the other direction let , let and . For , let be the random variable equal to with probability and to with probability and let . By our assumption, . This gives
This holds for every and therefore
Using this inequality for every we obtain . ∎
An immediate corollary of our definition of approximate max-information is that it controls the probability of “bad events” that can happen as a result of the dependence of on .
Let be a random dataset in and be an algorithm with range such that for some , . Then for any event ,
Approximate max-information satisfies the following adaptive composition property:
Let be an algorithm such that , and let be an algorithm such that for every , has -approximate max-information . Let be defined such that . Then .
Let be a distribution over and be a random dataset sampled from . By hypothesis, . Expanding out the definition for all :
We also have for all and for all :
For every , define
Observe that for all . For any event , we have:
Applying the definition of max-information, we see that equivalently, , which is what we wanted. ∎
This lemma can be iteratively applied, which immediately yields the following adaptive composition theorem for max-information:
Consider an arbitrary sequence of algorithms with ranges such that for all , is such that has -approximate max-information for all choices of . Let the algorithm be defined as follows: :
For to : Let
Then has -approximate max-information .
Another useful property that (approximate) max-information shares with differential privacy is preservation under post-processing. The simple proof of this lemma is identical to that for differential privacy (Lemma 5) and hence is omitted.
If is an algorithm with domain and range , and is any, possibly randomized, algorithm with domain and range , then the algorithm with domain and range satisfies: for every random variable over and every , .
1 Bounds on Max-information
We now show that the basic approaches based on description length and (pure) differential privacy are captured by approximate max-information.
Description length gives the following bound on max-information.
Let be a randomized algorithm taking as an input an -element dataset and outputting a value in a finite set . Then for every , .
We will use the following simple property of approximate divergence (e.g.[DR14]) in the proof. For a random variable over we denote by the probability distribution associated with .
Let and be two random variables over the same domain . If
then .
Let be any random variable over -element input datasets and let be the corresponding output distribution . We prove that for every , .
For we say that is “bad” if exists in the support of such that
For every we have that
This, by Lemma 18, gives that . ∎
In Section A we introduce a closely related notion of randomized description length and show that it also provides an upper bound on approximate max-information. More interestingly, for this notion a form of the reverse bound can be proved: A bound on (approximate) max-information of an algorithm implies a bound on the randomized description length of the output of a different algorithm with statistically indistinguishable from output.
1.2 Differential Privacy
We now show that pure differential privacy implies a bound on max information. We start with a simple bound on max-information of differentially private algorithms that applies to all distributions over datasets. In particular, it implies that the differential privacy-based approach can be used beyond the i.i.d. setting in [DFH+14].
Let be an -differentially private algorithm. Then .
Finally, we prove a stronger bound on approximate max-information for datasets consisting of i.i.d. samples using the technique from [DFH+14]. This bound, together with Thm. 13, generalizes Thm. 6.
Let be an -differentially private algorithm with range . For a distribution over , let be a random variable drawn from . Let denote the random variable output by on input . Then for any , .
Fix . We first observe that by Jensen’s inequality,
Further, by definition of differential privacy, for two databases that differ in a single element,
For an integer , let and let
By inequality (1), we have that for ,
Let . Then
For every we have that
Note that for , where this result requires . The stronger bound allows to preserve concentration of measure even when which corresponds to when .
We apply Theorem 20 with to obtain that
Applying Thm. 13 to McDiarmid’s inequality we obtain that
where the last inequality holds when is larger than a fixed constant. ∎
Reusable Holdout
We describe two simple algorithms that enable validation of analyst’s queries in the adaptive setting.
Our first algorithm follows the approach in [DFH+14] where differentially private algorithms are used to answer adaptively chosen statistical queries. This approach can also be applied to any low-sensitivity functions Guarantees based on pure differential privacy follow from the same analysis. Proving generalization guarantees for low-sensitivity queries based on approximate differential privacy requires a modification of Thresholdout using techniques in [BSSU15]. of the dataset but for simplicity we present the results for statistical queries. Here we address an easier problem in which the analyst’s queries only need to be answered when they overfit. Also, unlike in [DFH+14], the analyst has full access to the training set and the holdout algorithm only prevents overfitting to holdout dataset. As a result, unlike in the general query answering setting, our algorithm can efficiently validate an exponential in number of queries as long as a relatively small number of them overfit.
Thresholdout is given access to the training dataset and holdout dataset and a budget limit . It allows any query of the form and its goal is to provide an estimate of . To achieve this the algorithm gives an estimate of in a way that prevents overfitting of functions generated by the analyst to the holdout set. In other words, responses of Thresholdout are designed to ensure that, with high probability, is close to and hence an estimate of gives an estimate of the true expectation . Given a function , Thresholdout first checks if the difference between the average value of on the training set (or ) and the average value of on the holdout set (or ) is below a certain threshold . Here, is a fixed number such as and is a Laplace noise variable whose standard deviation needs to be chosen depending on the desired guarantees (The Laplace distribution is a symmetric exponential distribution.) If the difference is below the threshold, then the algorithm returns . If the difference is above the threshold, then the algorithm returns for another Laplacian noise variable . Each time the difference is above threshold the “overfitting” budget is reduced by one. Once it is exhausted, Thresholdout stops answering queries. In Fig. 1 we provide the pseudocode of Thresholdout.
We now establish the formal generalization guarantees that Thresholdout enjoys. As the first step we state what privacy parameters are achieved by Thresholdout.
Thresholdout satisfies -differential privacy. also satisfies -differential privacy for any .
Thresholdout is an instantiation of a basic tool from differential privacy, the “Sparse Vector Algorithm” ([DR14, Algorithm 2]), together with the Laplace mechanism ([DR14, Defn. 3.3]). The sparse vector algorithm takes as input a sequence of sensitivity queriesIn fact, the theorems for the Sparse Vector algorithm in Dwork and Roth are stated for sensitivity 1 queries – we use them for sensitivity queries of the form , which results in all of the bounds being scaled down by a factor of . (here , the budget), and for each query, attempts to determine whether the value of the query, evaluated on the private dataset, is above a fixed threshold or below it. In our instantiation, the holdout set is the private data set, and each function corresponds to the following query evaluated on : . (Note that the training set is viewed as part of the definition of the query). then is equivalent to the following procedure: we run the sparse vector algorithm [DR14, Algorithm 2] with , queries for each function , and noise rate . Whenever an above-threshold query is reported by the sparse vector algorithm, we release its value using the Laplace mechanism [DR14, Defn. 3.3] with noise rate (this is what occurs every time Thresholdout answers by outputting ). By the privacy guarantee of the sparse vector algorithm ([DR14, Thm. 3.25]), the sparse vector portion of satisfies -differential privacy, and simultaneously satisfies -differential privacy. The Laplace mechanism portion of Thresholdout satisfies -differential privacy by [DR14, Thm. 3.6], and simultaneously satisfies -differential privacy by [DR14, Thm. 3.6] and [DR14, Cor. 3.21]. Finally, the composition of two mechanisms, the first of which is -differentially private, and the second of which is -differentially private is itself -differentially private (Thm. 3). Adding the privacy parameters of the Sparse Vector portion of Thresholdout and the Laplace mechanism portion of Thresholdout yield the parameters of our theorem. ∎
We note that tighter privacy parameters are possible (e.g. by invoking the parameters and guarantees of the algorithm “NumericSparse” ([DR14, Algorithm 3]), which already combines the Laplace addition step) – we chose simpler parameters for clarity.
Note the seeming discrepancy between the guarantee provided by Thresholdout and generalization guarantees in Theorem 8 and Corollary 7: while Theorem 8 promises generalization bounds for functions that are generated by a differentially private algorithm, here we allow an arbitrary data analyst to generate query functions in any way she chooses, with access to the training set and differentially private estimates of the means of her functions on the holdout set. The connection comes from preservation of differential privacy guarantee under post-processing (Lem. 5).
We can now quantify the number of samples necessary to achieve generalization error with probability at least .
Let . Let denote the holdout dataset of size drawn i.i.d. from a distribution . Consider an algorithm that is given access to and adaptively chooses functions while interacting with Thresholdout which is given datasets , and parameters . If
Both settings lead to small generalization error and so we can pick whichever gives the larger bound. The first bound has grows linearly with but is simpler can be easily extended to other distributions over datasets and to low-sensitivity functions. The second bound has quadratically better dependence on at the expense of a slightly worse dependence on . We can now apply our main results to get a generalization bound for the entire execution of Thresholdout.
Let and . We set and . Let denote a holdout dataset of size drawn i.i.d. from a distribution and be any additional dataset over . Consider an algorithm that is given access to and adaptively chooses functions while interacting with Thresholdout which is given datasets , and values . For every , let denote the answer of Thresholdout on function . Further, for every , we define the counter of overfitting
whenever .
There are two types of error we need to control: the deviation between and the average value of on the holdout set , and the deviation between the average value of on the holdout set and the expectation of on the underlying distribution, . Specifically, we decompose the error as
To control the first term we need to bound the values of noise variables used by . For the second term we will use the generalization properties of Thresholdout given in Lemma 24.
By the definition of , . Applying the union bound we obtain that
where by we refer to for brevity. Similarly, and are obtained by sampling from the Laplace distribution and each is re-randomized at most times. Therefore
For answers that are different from , we can now bound the first term of Equation (4) by considering two cases, depending on whether Thresholdout answers query by returning or by returning . First, consider queries whose answers are returned using the former condition. Under this condition, . Next, we consider the second case, those queries whose answers are returned using . By definition of the algorithm, we have
Noting that and applying our bound on variables , and we get
By Lemma 24, for ,
Combining this with Equation (5) and using in Equation (4) we get that
To finish the proof we show that under the conditions on the noise variables and generalization error used above, we have that if then . To see this, observe that for every that reduces Thresholdout’s budget, we have
This means that for every that reduces the budget we have and hence (when the conditions on the noise variables and generalization error are satisfied) for every , if then Thresholdout’s budget is not yet exhausted and . We can therefore conclude that
Note that in the final bound on , the term is equal (up to a constant factor) to the number of samples that are necessary to answer non-adaptively chosen queries with tolerance and confidence . In particular, as in the non-adaptive setting, achievable tolerance scales as (up to the logarithmic factor). Further, this bound allows to be exponentially large in as long as grows sub-quadratically in (that is, for a constant ).
In Thm. 25 is used solely to provide a candidate estimate of the expectation of each query function. The theorem holds for any other way to provide such estimates. In addition, the one-sided version of the algorithm can be used when catching only the one-sided error is necessary. For example, in many cases overfitting is problematic only if the training error estimate is larger than the true error. This is achieved by using the condition to detect overfitting. In this case only one-sided errors will be caught by Thresholdout and only one-sided overfitting will decrease the budget.
2 SparseValidate
We now present a general algorithm for validation on the holdout set that can validate many arbitrary queries as long as few of them fail the validation. The algorithm which we refer to as SparseValidate only reveals information about the holdout set when validation fails and therefore we use bounds based on description length to analyze its generalization guarantees.
More formally, our algorithm allows the analyst to pick any Boolean function of a dataset (or even any algorithm that outputs a single bit) and provides back the value of on the holdout set . SparseValidate has a budget for the total number of queries that can be asked and budget for the number of queries that returned . Once either of the budgets is exhausted, no additional answers are given. We now give a general description of the guarantees of SparseValidate.
We remark that the proof can also be obtained via a more direct application of the union bound over all strings in . But the proof via Thm. 9 demonstrates the conceptual role that short description length plays in this application. ∎
An example of the application of SparseValidate for answering statistical and low-sensitivity queries that is based on our analysis can be found in [BSSU15]. The analysis of generalization on the holdout set in [BH15] and the analysis of the Median Mechanism we give in Section B also rely on this sparsity-based technique.
An alternative view of this algorithm is as a general template for designing algorithms for answering some specific type of adaptively chosen queries. Generalization guarantees specific to the type of query can then be obtained from our general analysis. For example, an algorithm that fits a mixture of Gaussians model to the data could define the validation query to be an algorithm that fits the mixture model to the holdout and obtains a vector of parameters . The validation query then compares it with the vector of parameters obtained on the training set and outputs 1 if the parameter vectors are “not close” (indicating overfitting). Given guarantees of statistical validity of the parameter estimation method in the static setting one could then derive guarantees for adaptive validation via Thm. 27.
Experiments
We describe a simple experiment on synthetic data that illustrates the danger of reusing a standard holdout set and how this issue can be resolved by our reusable holdout. In our experiment the analyst wants to build a classifier via the following common strategy. First the analyst finds a set of single attributes that are correlated with the class label. Then the analyst aggregates the correlated variables into a single model of higher accuracy (for example using boosting or bagging methods). More formally, the analyst is given a -dimensional labeled data set of size and splits it randomly into a training set and a holdout set of equal size. We denote an element of by a tuple where is a -dimensional vector and is the corresponding class label. The analyst wishes to select variables to be included in her classifier. For various values of the number of variables to select , she picks variables with the largest absolute correlations with the label. However, she verifies the correlations (with the label) on the holdout set and uses only those variables whose correlation agrees in sign with the correlation on the training set and both correlations are larger than some threshold in absolute value. She then creates a simple linear threshold classifier on the selected variables using only the signs of the correlations of the selected variables. A final test evaluates the classification accuracy of the classifier on both the training set and the holdout set.
Formally, the algorithm is used to build a linear threshold classifier:
For each attribute compute the correlation with the label on the training and holdout sets: and . Let
that is the set of variables for which and have the same sign and both are at least in absolute value (this is the standard deviation of the correlation in our setting). Let be the subset of variables in with largest values of .
Construct the classifier .
In the experiments we used an implementation of Thresholdout that differs somewhat from the algorithm we analyzed theoretically (given in Figure 1). Specifically, we set the parameters to be and . This is lower than the values necessary for the proof (and which are not intended for direct application) but suffices to prevent overfitting in our experiment. Second, we use Gaussian noise instead of Laplacian noise as it has stronger concentration properties (in many differential privacy applications similar theoretical guarantees hold mechanisms based on Gaussian noise).
No correlation between labels and data: In our first experiment, each attribute is drawn independently from the normal distribution and we choose the class label uniformly at random so that there is no correlation between the data point and its label. We chose , and varied the number of selected variables . In this scenario no classifier can achieve true accuracy better than 50%. Nevertheless, reusing a standard holdout results in reported accuracy of over 63% for on both the training set and the holdout set (the standard deviation of the error is less than 0.5%). The average and standard deviation of results obtained from independent executions of the experiment are plotted in Figure 2 which also includes the accuracy of the classifier on another fresh data set of size drawn from the same distribution. We then executed the same algorithm with our reusable holdout. The algorithm Thresholdout was invoked with and explaining why the accuracy of the classifier reported by Thresholdout is off by up to whenever the accuracy on the holdout set is within of the accuracy on the training set. Thresholdout prevents the algorithm from overfitting to the holdout set and gives a valid estimate of classifier accuracy.
High correlation between labels and some of the variables: In our second experiment, the class labels are correlated with some of the variables. As before the label is randomly chosen from and each of the attributes is drawn from aside from attributes which are drawn from where is the class label. We execute the same algorithm on this data with both the standard holdout and Thresholdout and plot the results in Figure 3. Our experiment shows that when using the reusable holdout, the algorithm still finds a good classifier while preventing overfitting. This illustrates that the reusable holdout simultaneously prevents overfitting and allows for the discovery of true statistical patterns.
In Figures 2 and 3, simulations that used Thresholdout for selecting the variables also show the accuracy on the holdout set as reported by Thresholdout. For comparison purposes, in Figure 4 we plot the actual accuracy of the generated classifier on the holdout set (the parameters of the simulation are identical to those used in Figures 2 and 3). It demonstrates that there is essentially no overfitting to the holdout set. Note that the advantage of the accuracy reported by Thresholdout is that it can be used to make further data dependent decisions while mitigating the risk of overfitting.
Discussion of the results: Overfitting to the standard holdout set arises in our experiment because the analyst reuses the holdout after using it to measure the correlation of single attributes. We first note that neither cross-validation nor bootstrap resolve this issue. If we used either of these methods to validate the correlations, overfitting would still arise due to using the same data for training and validation (of the final classifier). It is tempting to recommend other solutions to the specific problem we used in our experiment. Indeed, a significant number of methods in the statistics and machine learning literature deal with inference for fixed two-step procedures where the first step is variable selection (see [HTF09] for examples). Our experiment demonstrates that even in such simple and standard settings our method avoids overfitting without the need to use a specialized procedure – and, of course, extends more broadly. More importantly, the reusable holdout gives the analyst a general and principled method to perform multiple validation steps where previously the only known safe approach was to collect a fresh holdout set each time a function depends on the outcomes of previous validations.
Conclusions
In this work, we give a unifying view of two techniques (differential privacy and description length bounds) which preserve the generalization guarantees of subsequent algorithms in adaptively chosen sequences of data analyses. Although these two techniques both imply low max-information – and hence can be composed together while preserving their guarantees – the kinds of guarantees that can be achieved by either alone are incomparable. This suggests that the problem of generalization guarantees under adaptivity is ripe for future study on two fronts. First, the existing theory is likely already strong enough to develop practical algorithms with rigorous generalization guarantees, of which Thresholdout is an example. However additional empirical work is needed to better understand when and how the theory should be applied in specific application scenarios. At the same time, new theory is also needed. As an example of a basic question we still do not know the answer to: even in the simple setting of adaptively reusing a holdout set for computing the expectations of boolean-valued predicates, is it possible to obtain stronger generalization guarantees (via any means) than those that are known to be achievable via differential privacy?
References
Appendix A From Max-information to Randomized Description Length
In this section we demonstrate additional connections between max-information, differential privacy and description length. These connections are based on a generalization of description length to randomized algorithms that we refer to as randomized description length.
For a universe let be a randomized algorithm with input in and output in . We say that the output of has randomized description length if for every fixed setting of random coin flips of the set of possible outputs of has size at most .
We first note that just as the (deterministic) description length, randomized description length implies generalization and gives a bound on max-information.
Let be an algorithm with randomized description length taking as an input an -element dataset and outputting a value in . Then for every , .
Let be any random variable over -element input datasets and let be the corresponding output distribution . It suffices to prove that for every , .
Let be the set of all possible values of the random bits of and let denote the uniform distribution over a choice of . For , let denote with the random bits set to and let . Observe that by the definition of randomized description length, the range of has size at most . Therefore, by Theorem 17, we obtain that .
For any event we have that
By the definition of -approximate max-information, we obtain that . ∎
We next show that if the output of an algorithm has low approximate max-information about its input then there exists a (different) algorithm whose output is statistically close to that of while having short randomized description. We remark that this reduction requires the knowledge of the marginal distribution .
Let be a randomized algorithm taking as an input a dataset of points from and outputting a value in . Let be a random variable over . For and a dataset let . There exists an algorithm that given , and any ,
the output of has randomized description length .
for every , .
Let denote the input dataset. By definition of , . By the properties of approximate divergence (e.g.[DR14]), implies that there exists a random variable such that and .
We first note that by the definition of this algorithm its output has randomized description length . Let denote the event that at least one of the samples was accepted. Conditioned on this event the output of is distributed according to . For each ,
This means that the probability that none of samples will be accepted is . Therefore and, consequently, . ∎
We can now use Lemma 31 to show that if for a certain random choice of a dataset , the output of has low approximate max-information then there exists an algorithm whose output on has low randomized description length and is statistically close to the output distribution of .
Let be a random dataset in and be an algorithm taking as an input a dataset in and having a range . Assume that for some , . For any , there exists an algorithm taking as an input a dataset in such that
the output of has randomized description length ;
.
It is important to note that Theorem 32 is not the converse of Theorem 30 and does not imply equivalence between max-information and randomized description length. The primary difference is that Theorem 32 defines a new algorithm rather than arguing about the original algorithm. In addition, the new algorithm requires samples of , that is, it needs to know the marginal distribution on . As a more concrete example, Theorem 32 does not allow us to obtain a description-length-based equivalent of Theorem 20 for all i.i.d. datasets. On the other hand, any algorithm that has bounded max-information for all distributions over datasets can be converted to an algorithm with low randomized description length.
Let be an algorithm over with range and let . For any , there exists an algorithm taking as an input a dataset in such that
the output of has randomized description length ;
for every dataset , .
Let be an -element dataset for an arbitrary . By Lemma 3 we know that for every , . We can now apply Lemma 31 with , and to obtain the result. ∎
The conditions of Theorem 33 are satisfied by any -differentially private algorithm with . This immediately implies that the output of any -differentially private algorithm is -statistically close to the output of an algorithm with randomized description length of . Special cases of this property have been derived (using a technique similar to Lemma 31) in the context of proving lower bounds for learning algorithms [BNS13] and communication complexity of differentially private protocols [MMP+10].
Appendix B Answering Queries via Description Length Bounds
In this section, we show a simple method for answering any adaptively chosen sequence of statistical queries, using a number of samples that scales only polylogarithmically in . This is an exponential improvement over what would be possible by naively evaluating the queries exactly on the given samples. Algorithms that achieve such dependence were given in [DFH+14] and [BSSU15] using differentially private algorithms for answering queries and the connection between generalization and differential privacy (in the same way as we do in Section 4.1). Here we give a simpler algorithm which we analyze using description length bounds. The resulting bounds are comparable to those achieved in [DFH+14] using pure differential privacy but are somewhat weaker than those achieved using approximate differential privacy [DFH+14, BSSU15, NS15].
The mechanism we give here is based on the Median Mechanism of Roth and Roughgarden [RR10]. A differentially private variant of this mechanism was introduced in [RR10] to show that it was possible to answer exponentially many adaptively chosen counting queries (these are queries for an estimate of the empirical mean of a function on the dataset). Here we analyze a noise-free version and establish its properties via a simple description length-based argument. We remark that it is possible to analogously define and analyze the noise-free version of the Private Multiplicative Weights Mechanism of Hardt and Rothblum [HardtR10]. This somewhat more involved approach would lead to better (but qualitatively similar) bounds.
Recall that statistical queries are defined by functions , and our goal is to correctly estimate their expectation . The Median Mechanism takes as input a dataset and an adaptively chosen sequence of such functions , and outputs a sequence of answers .
The guarantee we get for the Median Mechanism is as follows:
Let and . Let denote a dataset of size drawn i.i.d. from a distribution over . Consider any algorithm that adaptively chooses functions while interacting with the Median Mechanism which is given and values , . For every , let denote the answer of the Median Mechanism on function . Then
We begin with a simple lemma which informally states that for every distribution , and for every set of functions , there exists a small dataset that approximately encodes the answers to each of the corresponding statistical queries.
For every dataset over , any set of functions , and any , there exists a data set of size such that:
Next, we observe that by construction, the Median Mechanism (as presented in Figure 5) always returns answers that are close to the empirical means of respective query functions.
For every sequence of queries and dataset given to the Median Mechanism, we have that for every :
Finally, we give a simple lemma from [RR10] that shows that the Median Mechanism only returns answers computed using the dataset in a small number of rounds – for any other round , the answer returned is computed from the set .
For every sequence of queries and a dataset given to the Median Mechanism:
We simply note several facts. First, by construction, . Second, by Lemma 35, for every , (because for every set of queries, there is at least one dataset of size that is consistent up to error with on every query asked, and hence is never removed from on any round). Finally, by construction, on any round such that , we have (because on any such round, the median dataset – and hence at least half of the datasets in were inconsistent with the answer given, and hence removed.) The lemma follows from the fact that there can therefore be at most many such rounds. ∎
Our analysis proceeds by viewing the interaction between the data analyst and the Median Mechanism (Fig. 5) as a single algorithm . takes as input a dataset and outputs a set of queries and answers . We will show that ’s output has short randomized description length (the data analyst is a possibly randomized algorithm and hence might be randomized).
Algorithm has randomized description length of at most
We observe that for every fixing of the random bits of the data analyst the entire sequence of queries asked by the analyst, together with the answers he receives, can be reconstructed from a record of the indices of the queries such that , together with their answers (i.e. it is sufficient to encode . Once this is established, the lemma follows because by Lemma 37, there are at most such queries, and for each one, its index can be encoded with bits, and its answer with bits.
To see why this is so, consider the following procedure for reconstructing the sequence of queries asked and answers received. For every fixing of the random bits of the data analyst, her queries can be expressed as a sequence of functions that take as input the queries previously asked to the Median Mechanism, and the answers previously received, and output the next query to be asked. That is, we have:
Finally, we can complete the proof. By Hoeffding’s concentration inequality and the union bound we know that for any every sequence of queries and a dataset of size drawn from the distribution :
Applying Theorem 29 to the set we obtain that for the queries generated on the dataset and corresponding answers of the Median Mechanism we have
Plugging in gives the theorem. ∎