Simultaneous Model Selection and Optimization through Parameter-free Stochastic Learning
Francesco Orabona
Introduction
Stochastic Gradient Descent (SGD) algorithms are gaining more and more importance in the Machine Learning community as efficient and scalable machine learning tools. There are two possible ways to use a SGD algorithm: to optimize a batch objective function, e.g. , or to directly optimize the generalization performance of a learning algorithm, in a stochastic approximation way . The second use is the one we will consider in this paper. It allows learning over streams of data, coming Independent and Identically Distributed (IID) from a stochastic source. Moreover, it has been advocated that SGD theoretically yields the best generalization performance in a given amount of time compared to other more sophisticated optimization algorithms .
Yet, both in theory and in practice, the convergence rate of SGD for any finite training set critically depends on the step sizes used during training. In fact, often theoretical analysis assumes the use of optimal step sizes, rarely known in reality, and in practical applications wrong step sizes can result in arbitrary bad performance. While in finite hypothesis spaces simple optimal strategies are known , in infinite dimensional spaces the only attempts to solve this problem achieve convergence only in the realizable case, e.g. , or assume prior knowledge of intrinsic (and unknown) characteristic of the problem . The only known practical and theoretical way to achieve optimal rates in infinite Reproducing Kernel Hilbert Space (RKHS) is to use some form of cross-validation to select the step size that corresponds to a form of model selection [26, Chapter 7.4]. However, cross-validation techniques would result in a slower training procedure partially neglecting the advantage of the stochastic training. A notable exception is the algorithm in , that keeps the step size constant and uses the number of epochs on the training set as a regularization procedure. Yet, the number of epochs is decided through the use of a validation set .
Note that the situation is exactly the same in the batch setting where the regularization takes the role of the step size. Even in this case, optimal rates can be achieved only when the regularization is chosen in a problem dependent way .
On a parallel route, the Online Convex Optimization (OCO) literature studies the possibility to learn in a scenario where the data are not IID . It turns out that this setting is strictly more difficult than the IID one and OCO algorithms can also be used to solve the corresponding stochastic problems . The literature on OCO focuses on the adversarial nature of the problem and on various ways to achieve adaptivity to its unknown characteristics .
This paper is in between these two different worlds: We extend tools from OCO to design a novel stochastic parameter-free algorithm able to obtain optimal finite sample convergence bounds in infinite dimensional RKHS. This new algorithm, called Parameter-free STOchastic Learning (PiSTOL), has the same complexity as the plain stochastic gradient descent procedure and implicitly achieves the model selection while training, with no parameters to tune nor the need for cross-validation. The core idea is to change the step sizes over time in a data-dependent way. As far as we know, this is the first algorithm of this kind to have provable optimal convergence rates.
The rest of the paper is organized as follows. After introducing some basic notations (Sec. 2), we will explain the basic intuition of the proposed method (Sec. 3). Next, in Sec. 4 we will describe the PiSTOL algorithm and its regret bounds in the adversarial setting and in Sec. 5 we will show its convergence results in the stochastic setting. The detailed discussion of related work is deferred to Sec. 6. Finally, we show some empirical results and draw the conclusions in Sec. 7.
Problem Setting and Definitions
Let the integral operator defined by . There exists an orthonormal basis of consisting of eigenfunctions of with corresponding non-negative eigenvalues and the set is finite or when [12, Theorem 4.7]. Since is a Mercer kernel, is compact and positive. Therefore, the fractional power operator is well defined for any . We indicate its range space by
A Gentle Start: ASGD, Optimal Step Sizes, and the Perceptron
On the other hand, using the tools to design self-tuning algorithms, e.g. , it may be possible to design an ASGD-like algorithm, able to self-tune its step size in a data-dependent way. Indeed, we would like an algorithm able to select the optimal step size in (3), that is
In the OCO setting, this would correspond to a regret bound of the form . An algorithm that has this kind of guarantee is the Perceptron algorithm , see Algorithm 2. In fact, for the Perceptron it is possible to prove the following mistake bound :
The r.h.s of (6) has exactly the same form of the expression in (3), but with a minimum over . Hence, we can expect it to always have the optimal rate of convergence. In the next section, we will present such algorithm.
PiSTOL: Parameter-free STOchastic Learning
In this section we describe the PiSTOL algorithm. The pseudo-code is in Algorithm 3. The algorithm builds on recent advancement in unconstrained online learning . It is very similar to a SGD algorithm , the main difference being the computation of the solution based on the past gradients, in line 4. Note that the calculation of can be done incrementally, hence, the computational complexity is the same as ASGD in a RKHS, Algorithm 1. For the PiSTOL algorithm we have the following regret bound.All the proofs are in Appendix.
where .
This theorem shows that PiSTOL has the right dependency on and that was outlined in Sec. 3 and its regret bound is also optimal up to terms . Moreover, Theorem 1 improves on the results in , obtaining an almost optimal regret that depends on the sum of the absolute values of the gradients, rather than on the time . This is critical to obtain a tighter bound when the losses are -smooth, as shown in the next Corollary.
In the Appendix, we also show a variant of PiSTOL for linear kernels with almost optimal learning rate for each coordinate. Contrary to other similar algorithms, e.g. , it is a truly parameter-free one.
Convergence Results for PiSTOL
Setting , and , condition (7) is equivalent [32, Lemma 6.1] to:
It would be possible to obtain similar results with other algorithms, as the one in , using a doubling-trick approach . However, this would result most likely in an algorithm not useful in any practical application. Moreover, the doubling-trick itself would not be trivial, for example the one used in achieves a suboptimal regret and requires to start from scratch the learning over two different variables, further reducing its applicability in any real-world application.
Also, note that the guarantees of Corollary 2 and Theorem 2 hold simultaneously. Hence, the theoretical performance of PiSTOL is always better than both the ones of SGD with the step sizes tuned with the knowledge of or with the agnostic choice . In the Appendix, we also show another convergence result assuming a different smoothness condition.
Regarding the optimality of our results, lower bounds for the square loss are known under assumption (2) and further assuming that the eigenvalues of have a polynomial decay, that is
Related Work
For finite dimensional spaces and self-concordant losses, an optimal parameter-free stochastic algorithm has been proposed in . However, the convergence result seems specific to finite dimension.
In the batch setting, the same optimal rates were obtained by for the square loss, in high probability, for . In , using an additional assumption on the infinity norm of the functions in , they give high probability bounds also in the range . The optimal tuning of the regularization parameter is achieved by cross-validation. Hence, we match the optimal rates of a batch algorithm, without the need to use validation methods.
In Sec. 3 we saw that the core idea to have the optimal rate was to have a classifier whose performance is close to the best regularized solution, where the regularizer is . Changing the regularization term from the standard to with is not new in the batch learning literature. It has been first proposed for classification by , and for regression by . Note that, in both cases no computational methods to solve the optimization problem were proposed. Moreover, in it was proved that all the regularizers of the form with gives optimal convergence rates bound for the square loss, given an appropriate setting of the regularization weight. In particular, [27, Corollary 6] proves that, using the square loss and under assumptions (2) and (9), the optimal weight for the regularizer is This implies a very important consequence, not mentioned in that paper: In the the capacity independent setting, that is , if we use the regularizer , the optimal regularization weight is , independent of the exponent of the range space (1) where belongs. Moreover, in the same paper it was argued that “From an algorithmic point of view however, q = 2 is currently the only feasible case, which in turn makes SVMs the method of choice”. Indeed, in this paper we give a parameter-free efficient procedure to train predictors with smooth losses, that implicitly uses the regularizer. Thanks to this, the regularization parameter does not need to be set using prior knowledge of the problem.
Discussion
Borrowing from OCO and statistical learning theory tools, we have presented the first parameter-free stochastic learning algorithm that achieves optimal rates of convergence w.r.t. the smoothness of the optimal predictor. In particular, the algorithm does not require any validation method for the model selection, rather it automatically self-tunes in an online and data-dependent way.
Even if this is mainly a theoretical work, we believe that it might also have a big potential in the applied world. Hence, as a proof of concept on the potentiality of this method we have also run few preliminary experiments, to compare the performance of PiSTOL to an SVM using 5-folds cross-validation to select the regularization weight parameter. The experiments were repeated with 5 random shuffles, showing the average and standard deviations over three datasets.Datasets available at http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/. The precise details to replicate the experiments are in the Appendix. The latest version of LIBSVM was used to train the SVM . We have that PiSTOL closely tracks the performance of the tuned SVM when a Gaussian kernel is used. Also, contrary to the common intuition, the stochastic approach of PiSTOL seems to have an advantage over the tuned SVM when the number of samples is small. Probably, cross-validation is a poor approximation of the generalization performance in that regime, while the small sample regime does not affect at all the analysis of PiSTOL. Note that in the case of News20, a linear kernel is used over the vectors of size . The finite dimensional case is not covered by our theorems, still we see that PiSTOL seems to converge at the same rate of SVM, just with a worse constant. It is important to note that the total time the 5-folds cross-validation plus the training with the selected parameter for the SVM on 58000 samples of SensIT Vehicle takes hours, while our unoptimized Matlab implementation of PiSTOL less than 1 hour, times faster. The gains in speed are similar on the other two datasets.
References
Appendix A Per-coordinate Variant of PiSTOL
Recently a number of algorithms with a different step size for each coordinate have been proposed, e.g. . The motivation is to take advantage of the sparsity of the features and, at the same time, to have a slower decaying step size for rare features. However, till now this adaptation has considered only the gradients and not to the norm of the competitor. Here we close this gap.
As shown in , these kind of algorithms can be very easily designed and analyzed just running an independent copy of the algorithm on each coordinate. Hence, we have the following corollary.
where .
Up to logarithmic terms, this regret bound is very similar to the one of AdaGrad , with two importance differences. Using our notation, AdaGrad depends rather than . In the case of Lipschitz losses and binary features, these two dependencies are essentially equivalent. The second and more important difference is that AdaGrad depends on instead of , or in alternative it assumes the knowledge of the (unknown) to tune its step size.
Define . We now use the the standard assumption on the behavior of the approximation error in , see, e.g., .
then, under the assumptions of Theorem 1, the averaged solution of PiSTOL satisfies
This Theorem improves over the result in , where the worse bound , was proved using the prior knowledge of . See for a discussion on the condition (10).
Appendix C Details about the Empirical Results
For the sake of the reproducibility of the experiments, we report here the exact details. The loss used by PiSTOL in all the experiments is a smoothed version of the hinge loss:
For the SVM we used the hinge loss. The parameters of PiSTOL were the same in all the experiments: , , . The a9a dataset is composed by training samples and for testing, the dimension of the features is 123. The Gaussian kernel is
where was fixed to , as done in . The “C” parameter of the SVM was tuned with cross-validation over the range . The SensIT Vehicle dataset is a 3-class dataset composed by training samples and for testing. A binary classification task was built using the third class versus the other two, to have a very balanced problem. For the amount of time taken by LIBSVM to train a model, we only used a maximum of training samples. The parameter in the Gaussian kernel is , again as in in . The range of the “C” parameter of the SVM was . The news20.binary dataset is composed by samples with dimension , and normalized to have norm equal to 1. The test set was composed by samples drawn randomly from the training samples. The range of the “C” parameter of the SVM was .
Appendix D Proofs
Given a closed and convex function , its Fenchel conjugate is defined as h^{*}(g)=\sup_{f\in\mathcal{H}_{K}}\bigl{(}\left\langle{f}\,,\,{g}\right\rangle_{K}-h(f)\bigr{)}.
D.2 Proof of (3)
From , it is possible to extract the following inequality
Using the elementary inequalities , we have
D.3 Proof of Theorem 1
In this section we prove the regret bound in the adversarial setting. The key idea is of the proof is to design a time-varying potential function. Some of the ideas in the proof are derived from .
In the proof of Theorem 1 we also use the following technical lemmas.
Consider the function . Using a second order Taylor expansion around we have
for some between and . Note that r.h.s of (11) is a convex function w.r.t. , so it is maximized when or . Hence, the first inequality is obtained using upper bounding with , and with in the second case. ∎
[15, Lemma 14] Define , for . Then
Define . The concavity of the logarithm implies for all . Hence we have
We are now ready to prove Theorem 1. Differently from the proof methods in , here the potential functions will depend explicitly on the sum of the past gradients, rather than simple on the time.
The Fenchel-Young inequality states that for all . Hence, it implies that, for any sequence of and any , we have
Hence, using the definition of , we have
Observe that, with the choice of , we have the following inequalities that will be used often in the proof:
Consider the max of the r.h.s. of the last equality w.r.t. . Being a convex function of , the maximum is achieved at the border of the domain. Hence, where or . We will analyze the two case separately.
Case positive: Consider the case that . Considering only the expression in parenthesis in (12), we have
where in the first inequality we used the first statement of Lemma 2. We now use the fact that and the elementary inequality , to have
This quantity is non-positive iff .
We now consider the case of . In this case, from (14), we have
Case negative: Now consider the case that . So we have
where in the inequality we used the second statement of Lemma 2. Considering again only the expression in the parenthesis we have
We have that this quantity is non-positive if . Hence we now consider the case that .
Using the definition of and summing over time we have
where in the third inequality we used Lemma 4.
Using (D.3), (20), and the definition of subgradient, we have
D.4 Proof of Corollary 1
We first state the technical results, used in the proofs.
[12, Lemma 7.2] Let and . Then the equation
has a unique positive solution . In addition,
Let and . Then the inequality
Denote by , so consider the function . Applying Lemma 6 we get that the has a unique positive solution and
Moreover, the inequality is verified for , and , so we have implies . We also have
Substituting back we get the stated bound. ∎
Using Cauchy-Schwarz inequality and Lemma 5, we have
Denote by . Using Lemma 7 we get
D.5 Proof of Lemma 1
For any , define . It is easy to verify that
Using Lemma 10.10 in and proceeding as in the proof of Theorem 10.5 in , we have
An application of Jensen’s inequality concludes the proof. ∎
D.6 Proof of Theorem 2
[12, Lemma 10.7] Let be such that . Then
and the argmin is .
Equating the first derivative to zero we have
Substituting this expression into the min we have
The next Lemma is needed for the proof of Lemma 12 that is a stronger version of [12, Corollary 10.14] because it needs only smoothness rather than a bound on the second derivative.
We will first get rid of the norm inside the logarithmic term. This will allow us to have a bound that depends only on norm of .
Let . Denote by . Hence, we have
Solving the quadratic inequality and using the elementary inequality , we have
We now use this result in the regret bound of Theorem 1, to have
Dividing everything by , taking the expectation of the two sides and using Jensen’s inequality we have
We now need to upper bound the terms in the . Using Lemma 8, we have that, for any
Consider first (33). Observe that from Lemma 12 and Lemma 10, we have
Consider now (32). Reasoning in a similar way we have
We now use the elementary inequality , to study separately
On the other hand, for (36), for , we have that the minimum over is 0. For , from Lemma 9, we have
Putting together (34), (37), and (38), we have the stated bound. ∎
D.7 Proof of Theorem 3
From the proof of Theorem 2, we have that
Dividing everything by , taking the expectation of the two sides and using Jensen’s inequality we have
where in the last inequality we used Lemma 9. ∎