Adaptive scale-invariant online algorithms for learning linear models

Michał Kempka, Wojciech Kotłowski, Manfred K. Warmuth

Introduction

The problem described above becomes apparent if we make an analogy from physics and imagine that all features have physical units. In particular, if we assigned a unit [xi]\bm{[}x_{i}\bm{]} to feature ii, and assumed for simplicity that the prediction and the label are unitless (as in, e.g., classification), the corresponding coordinate of the weight vector would need to have unit 1/[xi]1/\bm{[}x_{i}\bm{]}. However, the units in the OGD update (1) are mismatched, because ∇t,i\nabla_{t,i} has unit [xi]\bm{[}x_{i}\bm{]} (as ∇t\nabla_{t} is proportional to xt\bm{x}_{t}), while wt,iw_{t,i} has unit 1/[xi]1/\bm{[}x_{i}\bm{]}; even assigning a unit to η\eta does not help as a single number cannot compensate different units. A reasonable solution to this “unit clash” problem is to use one learning rate per dimension, i.e. to modify (1) to:

If we choose the oracle tuning of the learning rates to minimize the regret against comparator u\bm{u}, it follows that ηi∗=∣ui∣/∑t∇t,i2\eta_{i}^{*}=|u_{i}|/\sqrt{\sum_{t}\nabla_{t,i}^{2}} which results in the regret bound of order ∑i∣ui∣∑t∇t,i2\sum_{i}|u_{i}|\sqrt{\sum_{t}\nabla_{t,i}^{2}}, better than the bound obtained with a single learning rate. Interestingly, the unit of ηi∗\eta_{i}^{*} becomes 1/[xi]21/[x_{i}]^{2}, which fixes the “unit clash” in (2) and makes the scaling issues go away (as now scaling the ii-the feature by any factor cc will be compensated by scaling down uiu_{i} by c−1c^{-1}). Unfortunately, it is infeasible in practice to separately tune a single learning rate per dimension (oracle tuning requires the knowledge the comparator and all future gradients).

The first algorithm achieves a regret bound which depends on instances only relative to the scale of the comparator, through products of the form ∣u∣imax⁡t∣xt,i∣2+∑t∇t,i2|u|_{i}\sqrt{\max_{t}|x_{t,i}|^{2}+\sum_{t}\nabla_{t,i}^{2}} for i=1,…,di=1,\ldots,d, similarly as in the bound of OGD with per-dimension learning rates (with additional maximum over feature values, which is usually much smaller than the sum over squared gradients). As the algorithm can be sometimes a bit conservative in its predictions, we also introduce a second algorithm which is more aggressive in decreasing its cumulative loss; the price to pay is a regret bound which mildly (logarithmically) depends on ratios between the largest and the first non-zero input value for each coordinate. While these quantities can be made arbitrarily large in the worst case, it is unlikely to happen in practice. We test both algorithms in a computational study on several real-life data sets and show that without any need to tune parameters, they are competitive to popular online learning methods, which are allowed to tune their learning rates to optimize the test set performance.

Related work.

Our work is rooted from a long line of research on regret minimizing online algorithms (Cesa-Bianchi et al., 1996; Kivinen & Warmuth, 1997; Cesa-Bianchi & Lugosi, 2006). Most of the proposed methods have “range factors” present both in the algorithm and in the bound: it is typically assumed that some prior knowledge on the range of the comparator and the gradients is given, which allows the algorithm to tune its parameters appropriately. For instance, assuming ∥u∥≤U\|\bm{u}\|\leq U and ∥∇t∥≤G\|\nabla_{t}\|\leq G for all tt, OGD (1) with learning rate η=U/(GT)\eta=U/(G\sqrt{T}) achieves O(UGT)O(UG\sqrt{T}) regret bound.

More recent work on adaptive algorithms aims to get rid of these range factors. In particular, with a prior bound on the comparator norm, it is possible to adapt to the unknown range of the gradients (Duchi et al., 2011; Orabona & Pál, 2015), whereas having a prior bound on all future gradients, one can adapt to the unknown norm of the comparator (Streeter & McMahan, 2012; McMahan & Abernethy, 2013; Orabona, 2014; Orabona & Pál, 2016; Orabona & Tommasi, 2017; Cutkosky & Orabona, 2018). In particular, using reduction methods proposed by Cutkosky & Orabona (2018), one can get a bound matching OGD with separate learning rate per dimension, but this requires to know max⁡t,i∣∇t,i∣\max_{t,i}|\nabla_{t,i}| in advance. Interestingly, Cutkosky & Boahen (2017) have shown that in online convex optimization it is not possible to adapt to both unknown gradient range and unknown comparator norm at the same time. Here, we circumvent this negative result by exploiting the fact that the input instance xt\bm{x}_{t} is available ahead of prediction and therefore can be used to construct y^t\widehat{y}_{t} (this idea was first discovered in the context of linear regression (Vovk, 2001; Azoury & Warmuth, 2001)).

Scale-invariant algorithm has been been studied by Ross et al. (2013); Orabona et al. (2015) in a setup very similar to ours. Their algorithms, however, require a prior knowledge on the largest per-coordinate comparator’s prediction, max⁡t,i∣uixt,i∣\max_{t,i}|u_{i}x_{t,i}|, whereas their bounds scale with relative ratios between the largest and the first non-zero input value for each coordinate (the bound of our second algorithm also depends on these quantities but only in a logarithmic way). Luo et al. (2016); Koren & Livni (2017) considered even a more general setup of invariance under linear transformation of features (of which our invariance is a special case if the transformation is diagonal), but a prior knowledge of max⁡t∣xt⊤u∣\max_{t}|\bm{x}_{t}^{\top}\bm{u}| must be available, and the resulting algorithms are second-order methods. The closest to our work are the results by Kotłowski (2017), which concern the same setup, general invariance under linear transformations, and, similarly to us, make no prior range assumptions. Their bounds, however, do not scale with gradients ∇t,i2\nabla_{t,i}^{2} (as in the optimal OGD bound), but with the size of the features xt,i2x_{t,i}^{2} (multiplied by the Lipschitz constant of the loss), which upper-bounds ∇t,i2\nabla_{t,i}^{2} and can become much larger. For instance, in the “noise-free” case, when some comparator u\bm{u} has zero loss, the algorithm playing sufficiently close to u\bm{u} can inflict arbitrarily small gradients, while the sum of squared feature values will still grow linearly in tt.

The goal of scale-invariance seems to go hand in hand with a requirement for the updates to avoid unit clashes and this connection was the motivating idea for our work. In the most basic case, assume you want to design online algorithms for linear regression

that are to be robust to scaling the input vectors xt\bm{x}_{t} by a single positive constant factor. In this case [η]\bm{[}\eta\bm{]} should be 1/[∥xt∥2]1/\bm{[}\|\bm{x}_{t}\|^{2}\bm{]}. Interestingly enough, good tunings of the learning rates η\eta often “fix the units”: the properly tuned learning rates for the linear regression updates employed in (Cesa-Bianchi et al., 1996; Kivinen & Warmuth, 1997) have units 1/[∥xt∥2]1/\bm{[}\|\bm{x}_{t}\|^{2}\bm{]}. In this paper we focus on robustness to independently scaling the individual components xt,ix_{t,i} of the input vectors by positive factors. This requires privatized learning rates ηi\eta_{i} with the property that [ηi]=1/[xt,i]2\bm{[}\eta_{i}\bm{]}=1/\bm{[}x_{t,i}\bm{]}^{2}. Our paper focuses on this case because of efficiency concerns. However there is a third case (more expensive) where we want robustness to independent scaling and rotation of the input vectors xt\bm{x}_{t}. Now η\bm{\eta} must be a matrix parameter (playing a similar role to a Hessian) and if the instances are pre-multiplied by a fixed invertible A\bm{A}, then the tuned learning rate matrix of the new instances must become ηA−1\bm{\eta}\bm{A}^{-1}, thus correcting for the pre-multiplication with A\bm{A}. The updates of Luo et al. (2016); Koren & Livni (2017); Kotłowski (2017), as well as the Newton algorithm, have this form, but they are all second order algorithms with runtime of at least O(d2)O(d^{2}) per trial.

Problem Setting

Consider running Online Gradient Descent (OGD) algorithm on this problem, as defined in (2), i.e. we let the algorithm have a separate learning rate per dimension. When initialized at w1=0\bm{w}_{1}=\bm{0}, OGD achieves the regret bound:

where we introduced St,i2=∑j≤t∇j,i2=∑j≤t(gjxj,i)2S^{2}_{t,i}=\sum_{j\leq t}\nabla_{j,i}^{2}=\sum_{j\leq t}(g_{j}x_{j,i})^{2}. This is a slight generalization of a standard textbook bound (see, e.g., Hazan, 2015), proven in Appendix A for completeness. Tuning the learning rates to minimize the bound results in ηi=∣ui∣St,i\eta_{i}=\frac{|u_{i}|}{S_{t,i}}, and the bound simply becomes:

Such tuning is, however, not directly feasible as it would require knowing the comparator and the future gradients in hindsight. The goal of this work is to design adaptive online algorithms which for any comparator u\bm{u}, and any data sequence {(xt,yt)}t=1T\{(\bm{x}_{t},y_{t})\}_{t=1}^{T}, without any prior knowledge on their magnitudes, achieve (4) up to logarithmic factors.

The invariance of predictions of the optimal comparator leads to the definition of scale-invariant algorithms. We call a learning algorithm scale-invariant if its behavior (sequence of predictions) is invariant under arbitrary rescaling of individual features (Ross et al., 2013; Kotłowski, 2017). More precisely, if we apply a transformation xt,i↦aixt,ix_{t,i}\mapsto a_{i}x_{t,i} simultaneously to all instances, the predictions of the algorithm y^1,…,y^T\widehat{y}_{1},\ldots,\widehat{y}_{T} remain the same as on the original data sequence. Scale-invariant algorithm are thus independent on the “units” in which the instance vectors are expressed on each feature, and do not require any prior normalization of the data. Interestingly, OGD defined in (2) is not a scale invariant algorithm, but becomes one under the optimal tuning of its learning rates. The algorithms presented in the next section will turn out to be scale-invariant, essentially as a by-product of adaptiveness to arbitrary scale of the comparator and the instances, required to achieve (4).

Remark: As noted in the introduction, scale invariance can be generalized to arbitrary linear invertible transformations xt↦Axt\bm{x}_{t}\mapsto\bm{A}\bm{x}_{t}. Unfortunately, this leads to second-order algorithms (Luo et al., 2016; Koren & Livni, 2017; Kotłowski, 2017), with the complexity at least Θ(d2)\Theta(d^{2}) per trial.

Scale-invariant algorithms

We first briefly describe the motivating idea behind the construction of the algorithms. We start with rewriting the right hand side of (3) to get:

Now, the key idea is to note that the bound must hold for any comparator uiu_{i}, therefore it must hold if we take a supremum over uiu_{i} on the left-hand side, sup⁡ui{GT,iui−B(uiST,i)}\sup_{u_{i}}\{G_{T,i}u_{i}-B(u_{i}S_{T,i})\}. To evaluate this supremum, we note that under variable change x=uiST,ix=u_{i}S_{T,i} it becomes equivalent to sup⁡x{GT,i/ST,ix−B(x)}\sup_{x}\{G_{T,i}/S_{T,i}x-B(x)\}. Recalling the definition of the Fenchel conjugate of a function f(x)f(x), defined as f∗(θ)=sup⁡x{θx−f(x)}f^{*}(\theta)=\sup_{x}\{\theta x-f(x)\} (Boyd & Vandenberghe, 2004), we see that the supremum can be evaluated to B∗(GT,i/ST,i)B^{*}(G_{T,i}/S_{T,i}). Thus, the unknown comparator has been eliminated from the picture, and the algorithm can be designed to satisfy:

for every data sequence. In fact, we construct our algorithms by proceeding in the reverse direction: starting with an appropriate function ψ\psi playing the role of B∗B^{*} (which we call a potential) and getting bound expressed by means of its conjugate ψ∗\psi^{*}. What we just described is known as regret-reward duality and has been successfully used in adaptive online learning (Streeter & McMahan, 2012; McMahan & Orabona, 2014; Orabona & Pál, 2016).

As already briefly mentioned, achieving (4), which corresponds to a bound with B(x)=∣x∣B(x)=|x|, is actually not possible: a negative result by Streeter & McMahan (2012) implies that the best one can hope for is B(x)=O(∣x∣ln⁡(∣x∣))B(x)=O(|x|\sqrt{\ln(|x|)}). We will show that our algorithm achieve a bound of a slightly weaker form B(x)=O(∣x∣ln⁡(∣x∣))B(x)=O(|x|\ln(|x|)), but still giving only a logarithmic overhead comparing to (4).

Algorithms.

ScInOL1.

where δt,i\delta_{t,i} is a small additional overhead. The algorithm resembles FreeRex by (Cutkosky & Boahen, 2017), because it actually uses the same functional form of the potential. The choice of the weight looks almost like a derivative of a potential function ψt−1,i(x)\psi_{t-1,i}(x) at x=Gt−1,ix=G_{t-1,i}, but it differs slightly in using Mt,iM_{t,i} rather than Mt−1,iM_{t-1,i} in its definition. This prior update of Mt,iM_{t,i} let the algorithm account for potentially very large value of xt,ix_{t,i} and avoid incurring too much loss. The coefficients βt,i\beta_{t,i} multiplying the potential are chosen to be a nonincreasing sequence, which at the same time keeps the overhead δt\delta_{t} upper-bounded by ϵt\frac{\epsilon}{t}, in order to to avoid terms in the regret bound depending on ratios between feature values and get ∑tδt,i≤ϵ(1+ln⁡T)\sum_{t}\delta_{t,i}\leq\epsilon(1+\ln T). Summing (5) over trials and using using ψ0,i(G0)=0\psi_{0,i}(G_{0})=0 gives:

Using the convexity of ψT+1,i\psi_{T+1,i} we can rewrite it by means of its Fenchel conjugate, ψT+1,i(GT,i)=sup⁡u{GT,iu−ψT+1,i∗(u)}\psi_{T+1,i}(G_{T,i})=\sup_{u}\{G_{T,i}u-\psi^{*}_{T+1,i}(u)\}, which in turn can be bounded as:

Summing over features i=1,…,di=1,\ldots,d, bounding βT,i≥(ϵT)−1\beta_{T,i}\geq(\epsilon T)^{-1}, and using (3) gives:

The full proof of Theorem 3.1 is given in Appendix C. Note that the bound depends on the scales of the features only relative to the comparator weights u\bm{u} through quantities ∣ui∣S^T,i|u_{i}|\hat{S}_{T,i}, and is equivalent to the optimal OGD bound (4) up to logarithmic factors.

ScInOL2.

The algorithm described in the previous section is designed to achieve a regret bound which depends on instances only relative to the scale of the comparator, no matter how extreme are the ratios ∣xt,i∣/Mt−1,i|x_{t,i}|/M_{t-1,i} between the new inputs and previously observed maximum feature values. We have observed that this can make the behavior of the algorithm too conservative, due to guarding against the worst-case instances. Therefore we introduce a second algorithm, which is more aggressive in decreasing its cumulative loss; the price to pay is a regret bound which mildly depends on ratios between feature values. The algorithm has a multiplicative flavor and resembles a family of Coin Betting algorithms recently developed by Orabona & Pál (2016); Orabona & Tommasi (2017); Cutkosky & Orabona (2018).

The algorithm is based on a potential function ψt,i(x)=e12h(x/S^t,i)\psi_{t,i}(x)=e^{\frac{1}{2}h(x/\hat{S}_{t,i})}, where:

Function h(y)h(y) interpolates between between the quadratic (for ∣y∣≤1|y|\leq 1) and absolute value (otherwise). It is easy to check that h(y)≥∣y∣−12h(y)\geq|y|-\frac{1}{2} for all yy.

By the definition, ηt,i=ϵ−∑j≤tgtxt,iwt,i\eta_{t,i}=\epsilon-\sum_{j\leq t}g_{t}x_{t,i}w_{t,i} is (up to ϵ\epsilon) the cumulative negative loss of the algorithm (“reward”). The weights are chosen in order to guarantee the relative increase in the reward lower-bounded by the relative increase in the potential:

where δt,i\delta_{t,i} is an overhead which can be controlled. Taking the product over trials t=1,…,Tt=1,\ldots,T and using ψ0,i(G0,i)=1\psi_{0,i}(G_{0,i})=1 gives ηT≥ϵψT,i(GT,i)e−ΔT\eta_{T}\geq\epsilon\psi_{T,i}(G_{T,i})e^{-\Delta_{T}}, where ΔT,i=∑tδt,i\Delta_{T,i}=\sum_{t}\delta_{t,i}. Using the definition of ηT,i\eta_{T,i}, this translates to:

where we used h(y)≥∣y∣−12h(y)\geq|y|-\frac{1}{2}. Denote the function on the r.h.s. by f(x)=ϵe−ΔT,i−14e∣x∣/(2S^T,i)f(x)=\epsilon e^{-\Delta_{T,i}-\frac{1}{4}}e^{|x|/(2\hat{S}_{T,i})}. Using convexity of f(x)f(x), we can express it by means of its Fenchel conjugate, f(GT,i)=sup⁡u{GT,iu−f∗(u)}f(G_{T,i})=\sup_{u}\{G_{T,i}u-f^{*}(u)\}, for which we have the following bound (Orabona, 2013):

Unfortunately, it turns out that ΔT,i\Delta_{T,i} can be Ω(T)\Omega(T) in the worst case, which makes the bound linear in TT. We can, however, bound ΔT,i\Delta_{T,i} in a data-dependent way by:

where τi\tau_{i} is the first trial in which ∣xt,i∣≠0|x_{t,i}|\neq 0. As S^T,i2≤(T+1)max⁡txt,i2\hat{S}^{2}_{T,i}\leq(T+1)\max_{t}x_{t,i}^{2}, the bound involves the ratio between the largest and the first non-zero input value. While being vacuous in the worst case, this quantity is likely not to be excessively large for non-adversarial data encountered in practice, and it is moreover hidden under the logarithm in the bound (a similar quantity is analyzed by Ross et al. (2013), where its magnitude is bounded with high probability for data received in a random order). Following along the steps from the previous section, we end up with the following bound:

where S^T,i=ST,i2+MT,i2\hat{S}_{T,i}=\sqrt{S_{T,i}^{2}+M_{T,i}^{2}} and τi=min⁡{t ⁣:∣xt,i∣≠0}\tau_{i}=\min\{t\colon|x_{t,i}|\neq 0\}.

The proof of Theorem 3.2 is given in Appendix D.

Experiments

The algorithms were trained by minimizing the logistic loss (cross entropy loss) in an online fashion. Following similar experiments in the past papers concerning online methods (Kingma & Ba, 2014; Ross et al., 2013; Orabona & Tommasi, 2017), we report the average loss on the test set (after every 50 iterations) rather than the regret. We tested the following algorithms: OGD with learning rate decaying as ηt=η/t\eta_{t}=\eta/\sqrt{t} (called SGD here from stochastic gradient descent), AdaGrad (Duchi et al., 2011), Adam (Kingma & Ba, 2014), two scale-invariant algorithms from past work: NAG (Normalized Adaptive Gradient) (Ross et al., 2013) and Scale-free Mirror Descent by Orabona et al. (2015) (SFMD), and algorithms from this work. All algorithms except ours have a learning rate parameter, which in each case was set to values from {0.001,0.005,0.01,0.05,0.1,0.5,1,5,10}\{0.001,0.005,0.01,0.05,0.1,0.5,1,5,10\} (results concerning all learning rates were reported). We implemented our algorithms in Tensorflow and used existing implementations whenever it was possible.

Figure 1 shows average cross entropy measured on test set as a function of the number of iterations. Lines of the same color show results for the same algorithm but with different learning rates. Figure 1(a) uses logarithmic scale for yy axis: note the extreme values of the loss for most of the non-invariant algorithms. In fact, the two black dashed lines mark the loss achieved by the best possible model u\bm{u} (lower line) and a model with zero weight vector (upper line), so that every method above the upper dashed line does something worse than such a trivial baseline. Figure 1(b) shows only the fragment between dashed lines using linear scale for yy axis.

The results clearly show that algorithms which are not invariant to feature scales (SGD, Adam, and AdaGrad) are unable to achieve any reasonable result for any choice of the learning rate (most of the time performing much worse than the zero vector). This is because a single learning rate is unable to compensate all feature scales at the same time. The scale invariant algorithms, NAG and SFMD, perform much better (achieving the best overall results), but their behavior still depends on the learning rate tuning. Among our algorithms, ScInOL1 slowly decreases its loss moving away from the initial zero solution, but it is clearly too slow in this problem. On the other hand, ScInOL2 was able to achieve descent results without any tuning at all.

2 Linear Classification

To further check empirical performance of our algorithms we tested them on some popular real-life benchmark datasets. We chose 5 datasets with varying levels of feature scale variance from UCI repository (Dheeru & Karra Taniskidou, 2017) (Covertype, Census, Shuttle, Bank, Madelon) and a popular benchmark dataset MNIST (LeCun & Cortes, 2010). For all datasets, categorical features were one-hot-encoded into multiple features and missing values were replaced by dedicated substitute features. Datasets that do not provide separate testing sets were split randomly into training/test sets (2/12/1 ratio). Short summary of datasets can be found in Appendix E.

Algorithms were trained by minimizing the cross entropy loss in an online fashion. Some of the data sets concern multiclass classification, which is beyond the framework considered here, as it would require multivariate prediction y^=(y^1,…,y^K)\widehat{\bm{y}}=(\widehat{y}_{1},\ldots,\widehat{y}_{K}) for each of KK classes, but it is straightforward to extend our setup to such multivariate case (details are given in Appendix G). To gain more insight into the long-term behavior of the algorithms, we trained all algorithms for multiple epochs. Each epoch consisted of running through the entire training set (shuffled) and testing average cross entropy and accuracy on the test set. Each algorithm was run 10 times for stability. We compared our algorithms with the following methods: SGD (with ηt∼1/t\eta_{t}\sim 1/\sqrt{t}), AdaGrad, Adam, NAG, CoCoB (Orabona & Tommasi, 2017) (an adaptive parameter-free algorithm; we used its Tensorflow implementation), and Algorithm 1 (coordinate-wise scale invariant method) by Kotłowski (2017) (which we call Alg1-K17). The algorithms using hand-picked learning rates (SGD, AdaGrad, Adam, NAG) were run with values from {0.00001,0.0001,0.001,0.01,0.1,1.0}\{0.00001,0.0001,0.001,0.01,0.1,1.0\} (all other parameters were kept default), and only the best test set results were reported (note that this biases the results in favour of these algorithms).

Figure 2 shows mean (test set) cross entropy loss (classification accuracy, given in Appendix F, leads to essentially the same conclusions); shaded areas around each curve depicts ±\pm one standard deviation (over different runs). All graphs start with the error measured after the first epoch for better readability. The most noticeable fact in the plots is comparatively high variance (between different runs) of SGD, AdaGrad, Adam and NAG, i.e. the approaches with tunable learning rate. They also often performed worse than the remaining algorithms. Among our methods, ScInOL2 turned out to perform better than ScInOL1 in every case, due to its more aggressive updates. Note, however, that both algorithms are surprisingly stable, exhibiting very small variance in their performance across different runs. The best performance was most of the time achieved by either ScInOL2 or CoCoB. Alg1-K17 was often converging somewhat slower (which is most pronounced for MNIST data), which we believe is due to its very conservative update policy.

Conclusions and future work

We proposed two online algorithms which behavior is invariant under arbitrary rescaling of individual features. The algorithms do not require any prior knowledge on the scale of the instances or the comparator and achieve, without any parameter tuning, regret bounds which match (up to a logarithmic factor) the regret bound of Online Gradient Descent with optimally tuned separate learning rates per dimension. The algorithms run in O(d)O(d) per trial, which is comparable to the runtime of vanilla OGD.

The framework considered in this paper concerns well-understood and relatively simple linear models with convex objectives. It would be interesting to evaluate the importance of scale-invariance for deep learning methods, comprised of multiple layers connected by non-linear activation functions. As scale-invariance leads to well-conditioned algorithms, we believe that it could not only avoid the need for prior normalization of the inputs to the network, but it would also make the algorithm be independent of the scale of the inputs fed forward to the next layers. A scale-invariant update for neural nets might be robust against the “internal covariance shift” phenomenon (Ioffe & Szegedy, 2015) and avoid the need for batch normalization.

Finally, the potential functions we use to analyze our updates seems closely related to the potential function of EGU± (Kivinen & Warmuth, 1997). It may be that our tuned online updates are simply approximation of (a version of) EGU± and this needs further investigation.

Acknowledgements

M. Kempka and W. Kotłowski were supported by the Polish National Science Centre under grant No. 2016/22/E/ST6/00299. Part of this work was done while M. K. Warmuth was at UC Santa Cruz, supported by NSF grant IIS-1619271.

References

Appendix A Bound for Online Gradient Descent with per-dimension learning rates

We remind the update of OGD with per-dimension learning rates:

Summing over trials t=1,…,Tt=1,\ldots,T and rearranging:

Dividing by 2ηi2\eta_{i}, upper bounding and summing over i=1,…,di=1,\ldots,d:

Finally, using (3) shows that the right-hand side of the above upper bounds the regret.

Appendix B Scale invariance of Algorithm 1 and Algorithm 2

so that xt,iwt,i↦xt,iwt,ix_{t,i}w_{t,i}\mapsto x_{t,i}w_{t,i} and thus y^t=xt⊤wt\widehat{y}_{t}=\bm{x}_{t}^{\top}\bm{w}_{t} is invariant under the scale transformation.

Appendix C Proof of Theorem 3.1

Before proving the theorem, we need two auxiliary results:

Let f(x)=α(e∣x∣/γ−∣x∣/γ−1)f(x)=\alpha\left(e^{|x|/\gamma}-|x|/\gamma-1\right) with α,γ>0\alpha,\gamma>0. Its Fenchel conjugate is given by:

Note that since f(x)f(x) is symmetric in xx,

Setting the derivative of g(x)g(x) to zero gives its unconstrained maximizer x∗=γln⁡(1+∣u∣γ/α)x^{*}=\gamma\ln(1+|u|\gamma/\alpha), and since x∗≥0x^{*}\geq 0, it is also the maximizer of g(x)g(x) under constraint x≥0x\geq 0. Thus:

The inequality in the lemma follows from an elementary inequality ln⁡(1+x)≤x\ln(1+x)\leq x applied to αln⁡(1+∣u∣γ/α)\alpha\ln(1+|u|\gamma/\alpha). ∎

It suffices to prove the lemma for v≥0v\geq 0. Indeed, the inequality holds for some v≥0v\geq 0 and q∈q\in if and only if it holds for −v-v and −q-q. Denote:

In this notation and with the assumption v≥0v\geq 0, the inequality translates to:

We will split the proof into three sub-cases: (i) q≥vq\geq v, (ii) q≤v≤3q\leq v\leq 3, and (iii) v≥3v\geq 3. Since q≤1q\leq 1, these cases cover all allowed values of vv and qq.

We have v~=q−v1+q2≤q−v\widetilde{v}=\frac{q-v}{\sqrt{1+q^{2}}}\leq q-v. Since the function ex−xe^{x}-x is increasing in xx for x∈(1,∞)x\in(1,\infty), it holds:

From q≤1q\leq 1 and v≥0v\geq 0 it follows q−2v2≤1−2v2≤12\frac{q-2v}{2}\leq\frac{1-2v}{2}\leq\frac{1}{2}. Since function f(x)=ex−x−1x2f(x)=\frac{e^{x}-x-1}{x^{2}} is nondecreasing in xx (see, e.g., (Cesa-Bianchi & Lugosi, 2006), Section A.1.2), we have:

Thus, we bound eq−2v2e^{\frac{q-2v}{2}} by 1+q−2v2+0.15(q−2v)21+\frac{q-2v}{2}+0.15(q-2v)^{2} and get:

where the last inequality follows from the fact that v≤1v\leq 1 (as q≥vq\geq v and q≤1q\leq 1), which by (9) implies ev2≤1+v2+0.6v24=1+0.5v+0.15v2≤1+ve^{\frac{v}{2}}\leq 1+\frac{v}{2}+0.6\frac{v^{2}}{4}=1+0.5v+0.15v^{2}\leq 1+v, and furthermore 0.15ev2≤0.15e12≤140.15e^{\frac{v}{2}}\leq 0.15e^{\frac{1}{2}}\leq\frac{1}{4}. But v(q−v)+14(q−2v)2=14q2≤q2v(q-v)+\frac{1}{4}(q-2v)^{2}=\frac{1}{4}q^{2}\leq q^{2}, which proves (8) for q≥vq\geq v.

Case (ii): q≤v≤3𝑞𝑣3q\leq v\leq 3.

We have v~=v−q1+q2≤v−q\widetilde{v}=\frac{v-q}{\sqrt{1+q^{2}}}\leq v-q, and by the monotonicity of function ex−xe^{x}-x for x∈(1,∞)x\in(1,\infty):

Using (9) and q≥−1q\geq-1, we bound e−q/2≤1−q2+0.15q2e^{-q/2}\leq 1-\frac{q}{2}+0.15q^{2} to get:

Using 0.15ev2≤0.15e32≤0.68≤10.15e^{\frac{v}{2}}\leq 0.15e^{\frac{3}{2}}\leq 0.68\leq 1 proves (8) for q≤v≤3q\leq v\leq 3.

Case (iii): v>3𝑣3v>3.

We lower-bound the right-hand side of (8):

where the first inequality is simply from q2≥q24q^{2}\geq\frac{q^{2}}{4}, while the second follows from 1−x≥e−x−x21-x\geq e^{-x-x^{2}} for x≤12x\leq\frac{1}{2} (see, .e.g., (Cesa-Bianchi & Lugosi, 2006), Lemma 2.4). Now, using the monotonicity of function ex−xe^{x}-x,

thus it suffices to show the latter to finish the proof. We have:

Using elementary inequality 1+x≤1+x2\sqrt{1+x}\leq 1+\frac{x}{2}, we have: 11+q2=1+q21+q2≤1+q2/21+q2\frac{1}{\sqrt{1+q^{2}}}=\frac{\sqrt{1+q^{2}}}{1+q^{2}}\leq\frac{1+q^{2}/2}{1+q^{2}}, and thus:

This shows that v−q−q22≥v~v-q-\frac{q^{2}}{2}\geq\widetilde{v} and thus proves (9) for v>3v>3. ∎

Before we state the next result, we summarize the notation which will be used in what follows. For any i=1,…,di=1,\ldots,d and any t=1,…,Tt=1,\ldots,T, let:

be, respectively, the maximum input value, the negative cumulative gradient, and the sum of squared gradients at ii-th coordinate up to (and including) trial tt, and we also denote M0,i=G0,i=S0,i2=0M_{0,i}=G_{0,i}=S^{2}_{0,i}=0. Moreover, define:

with β1,i=ϵ\beta_{1,i}=\epsilon. The weight vector at trial tt is given by:

as long as Mt,i>0M_{t,i}>0; if Mt,i=0M_{t,i}=0 (which means that xj,i=0x_{j,i}=0 for all j≤tj\leq t), we set wt,i=0w_{t,i}=0, but any other value of wt,iw_{t,i} would lead to the same loss. Finally, define S^t,i2=St,i2+Mt,i2\hat{S}^{2}_{t,i}=S^{2}_{t,i}+M^{2}_{t,i}.

For any i=1,…,di=1,\ldots,d and any t=1,…,Tt=1,\ldots,T we have:

Fix i∈{1,…,d}i\in\{1,\ldots,d\}, and let τi\tau_{i} be the first trial tt such that xt,i≠0x_{t,i}\neq 0. This means that S^t,i=xt,i=0\hat{S}_{t,i}=x_{t,i}=0 for all t<τit<\tau_{i}, and the inequality is trivially satisfied for any t<τit<\tau_{i}, as the left-hand side is zero, while the right-hand side is ϵ/t\epsilon/t. Thus, assume t≥τit\geq\tau_{i}.

Fix tt and define v=Gt−1,iSt−1,i2+Mt,i2v=\frac{G_{t-1,i}}{\sqrt{S_{t-1,i}^{2}+M_{t,i}^{2}}} and q=gtxt,iSt−1,i2+Mt,i2q=\frac{g_{t}x_{t,i}}{\sqrt{S_{t-1,i}^{2}+M_{t,i}^{2}}}. As ∣q∣≤∣gtxt,i∣Mt,i≤∣xt,i∣max⁡j≤t∣xj,i∣≤1|q|\leq\frac{|g_{t}x_{t,i}|}{M_{t,i}}\leq\frac{|x_{t,i}|}{\max_{j\leq t}|x_{j,i}|}\leq 1, we can apply Lemma C.2 to such vv and qq, which, after subtracting 11 and multiplying by βt,i\beta_{t,i} on both sides, gives:

Using the definition of the weight vector (10) we identify the first term on the left-hand side of (11):

the second term on the left-hand side of (11) is equal to ψt,i(Gt,i)\psi_{t,i}(G_{t,i}). Thus, (11) can be rewritten as:

and to finish the proof, it suffices to show that the two terms on the right-hand side are upper bounded, respectively, by ψt−1,i(Gt−1,i)\psi_{t-1,i}(G_{t-1,i}) and ϵt\frac{\epsilon}{t}.

To bound βt,iq2\beta_{t,i}q^{2} note that if xt,i=0x_{t,i}=0 then βt,iq2=0\beta_{t,i}q^{2}=0, whereas if xt,i≠0x_{t,i}\neq 0 then by the definition of βt,i\beta_{t,i}:

To bound βt,i(e∣v∣/2−∣v∣/2−1)\beta_{t,i}(e^{|v|/2}-|v|/2-1) by ψτi−1,i(Gt−1,i)\psi_{\tau_{i}-1,i}(G_{t-1,i}) note that both are zero if t=τit=\tau_{i} (because Gτi−1,i=0G_{\tau_{i}-1,i}=0 and v=0v=0). On the other hand, for t>τit>\tau_{i} we have:

and by the monotonicity of f(x)=ex−x−1f(x)=e^{x}-x-1:

where in the last inequality we used βt,i≤βt−1,i\beta_{t,i}\leq\beta_{t-1,i} (which follows from the definition) and the fact that ex−x−1≥0e^{x}-x-1\geq 0 for all xx. ∎

We are now ready to prove Theorem 3.1, which we restate here for convenience:

Applying Lemma (C.3) for a fixed i∈{1,…,d}i\in\{1,\ldots,d\} and all t=1,…,Tt=1,\ldots,T, and summing over trials gives:

where we used ψ0,i(G0,i)=0\psi_{0,i}(G_{0,i})=0. By (3),

where in the last inequality we used Lemma C.1 for each ii with α=βT,i\alpha=\beta_{T,i} and γ=2S^T,i\gamma=2\hat{S}_{T,i}. To finish the proof, it suffices to show that βT,i≥ϵT\beta_{T,i}\geq\frac{\epsilon}{T}, which we do by induction on tt. For t=1t=1, we have by the definition βt,i=ϵ\beta_{t,i}=\epsilon. Now, assume βt−1,i≥ϵt−1\beta_{t-1,i}\geq\frac{\epsilon}{t-1}, and we will show βt,i≥ϵt\beta_{t,i}\geq\frac{\epsilon}{t}. If xt,i=0x_{t,i}=0, βt,i=βt−1,i≥ϵt−1>ϵt\beta_{t,i}=\beta_{t-1,i}\geq\frac{\epsilon}{t-1}>\frac{\epsilon}{t}; on the other hand, if xt,i≠0x_{t,i}\neq 0, from the definition of βt,i\beta_{t,i}:

where we used St−1,i2+Mt,i2≥Mt,i2=max⁡j≤txj,i2≥xt,i2S_{t-1,i}^{2}+M_{t,i}^{2}\geq M_{t,i}^{2}=\max_{j\leq t}x_{j,i}^{2}\geq x_{t,i}^{2}. ∎

Appendix D Proof of Theorem 3.2

Similarly as in the previous section, we proceed the proof of the theorem with several auxiliary results. Define:

The lower bound in (13) is clearly satisfied for ∣x∣<1|x|<1, while for ∣x∣≤1|x|\leq 1 we have h(x)−(∣x∣−12)=12(∣x∣−1)2≥0h(x)-(|x|-\frac{1}{2})=\frac{1}{2}(|x|-1)^{2}\geq 0. On the other hand, the upper bound in (13) is clearly satisfied for ∣x∣≤1|x|\leq 1, while for ∣x∣>1|x|>1 we have h(x)−12x2=−12(∣x∣−1)2≤0h(x)-\frac{1}{2}x^{2}=-\frac{1}{2}(|x|-1)^{2}\leq 0.

Let f(x)=αe∣x∣/γf(x)=\alpha e^{|x|/\gamma} with α,γ>0\alpha,\gamma>0. Its Fenchel conjugate f∗(u)=sup⁡x{ux−f(x)}f^{*}(u)=\sup_{x}\{ux-f(x)\} satisfies f∗(u)≤∣u∣γ(ln⁡(∣u∣γ/α)−1)f^{*}(u)\leq|u|\gamma(\ln(|u|\gamma/\alpha)-1) for all uu.

It suffices to prove the lemma for v≥0v\geq 0. Indeed, the inequality holds for some v≥0v\geq 0 and q∈q\in if and only if it holds for −v-v and −q-q. Denote:

In this notation and with the assumption v≥0v\geq 0, the inequality translates to:

because (15) together with q≤1q\leq 1 and inequality e−x−x2≤1−xe^{-x-x^{2}}\leq 1-x for x≤12x\leq\frac{1}{2} (see, e.g., (Cesa-Bianchi & Lugosi, 2006), Section A.1.2) implies (14).

We will split the proof of (15) into three sub-cases: (i) v≤1v\leq 1, (ii) v≥1v\geq 1 and v~≥1\widetilde{v}\geq 1, (iii) v≥1v\geq 1 and v~<1\widetilde{v}<1.

From the definition, h(v)=12v2h(v)=\frac{1}{2}v^{2} and by (13) we upper bound h(v~)≤12v~2h(\widetilde{v})\leq\frac{1}{2}\widetilde{v}^{2}. Using v~≤∣v−q∣\widetilde{v}\leq|v-q| we have:

and since min⁡{v,1}=v\min\{v,1\}=v, this implies (15).

Case (ii): v≥1𝑣1v\geq 1 and v~≥1~𝑣1\widetilde{v}\geq 1.

As q≤1≤vq\leq 1\leq v, we have ∣v−q∣=v−q|v-q|=v-q, and by the definition, h(v)=v−12h(v)=v-\frac{1}{2}, h(v~)=v~−12h(\widetilde{v})=\widetilde{v}-\frac{1}{2}. Therefore:

where in the first inequality we used v~≤∣v−q∣=v−q\widetilde{v}\leq|v-q|=v-q. As min⁡{v,1}=1\min\{v,1\}=1, this implies (15).

Case (iii): v≥1𝑣1v\geq 1 and v~<1~𝑣1\widetilde{v}<1.

where the last equivalence follows from solving a quadratic inequality with respect to v≥1v\geq 1 for fixed qq. We now note that function:

is convex in vv and hence it is maximized at the boundaries {1,q+1+q2}\{1,q+\sqrt{1+q^{2}}\} of the allowed range of vv. When v=1v=1, we have:

so that g(v)≤−q−12q2g(v)\leq-q-\frac{1}{2}q^{2} in the entire range of allowed values of vv. As min⁡{v,1}=1\min\{v,1\}=1, this implies (15). ∎

Before stating further results, we summarize the notation: for i=1,…,di=1,\ldots,d and t=1,…,Tt=1,\ldots,T,

with the convention M0,i=G0,i=S0,i2=0M_{0,i}=G_{0,i}=S^{2}_{0,i}=0 and η0,i=ϵ\eta_{0,i}=\epsilon. As before, we also use S^t,i2=St,i2+Mt,i2\hat{S}^{2}_{t,i}=S^{2}_{t,i}+M^{2}_{t,i}. The weight vector at trial tt is given by:

as long as Mt,i>0M_{t,i}>0; if Mt,i=0M_{t,i}=0, we set wt,i=0w_{t,i}=0.

with h(⋅)h(\cdot) defined in (12). For any i=1,…,di=1,\ldots,d, let τi\tau_{i} be the first trial in which xt,i≠0x_{t,i}\neq 0. We have for any =1,…,d=1,\ldots,d and any t=τi,…,Tt=\tau_{i},\ldots,T:

where δt,i=(gtxt,i)22(St−1,i2+Mt,i2)\delta_{t,i}=\frac{(g_{t}x_{t,i})^{2}}{2(S_{t-1,i}^{2}+M_{t,i}^{2})}

Fix ii and t≥τit\geq\tau_{i}, and define v=Gt−1,iSt−1,i2+Mt,i2v=\frac{G_{t-1,i}}{\sqrt{S_{t-1,i}^{2}+M_{t,i}^{2}}} and q=gtxt,iSt−1,i2+Mt,i2q=\frac{g_{t}x_{t,i}}{\sqrt{S_{t-1,i}^{2}+M_{t,i}^{2}}}. As ∣q∣≤∣gtxt,i∣Mt,i≤1|q|\leq\frac{|g_{t}x_{t,i}|}{M_{t,i}}\leq 1, we can apply Lemma D.2 to such vv and qq, which gives:

Using the definition of weight vector (16), we identify the right-hand side of (17) with 1−gtxt,iwt,iηt−1,i=ηt,iηt−1,i1-\frac{g_{t}x_{t,i}w_{t,i}}{\eta_{t-1,i}}=\frac{\eta_{t,i}}{\eta_{t-1,i}}. Since 12q2=δt,i\frac{1}{2}q^{2}=\delta_{t,i} and Gt,iS^t,i=v−q1+q2\frac{G_{t,i}}{\hat{S}_{t,i}}=\frac{v-q}{\sqrt{1+q^{2}}} (see the proof of Lemma C.3), we also identify the left-hand side of (17) with ψt,i(Gt,i)e−12h(v)e−δt,i\psi_{t,i}(G_{t,i})e^{-\frac{1}{2}h(v)}e^{-\delta_{t,i}}. Hence, (17) can be rewritten as:

and thus to prove the lemma, it suffices to show:

When t=τit=\tau_{i}, we have v=0v=0 as well as Gt−1,i=0G_{t-1,i}=0, and (18) holds as its both sides are equal to 11. For t>τit>\tau_{i}, (18) reduces to h(v)≤h(Gt−1,i/S^t−1,i)h(v)\leq h(G_{t-1,i}/\hat{S}_{t-1,i}), which holds because:

and h(x)=h(∣x∣)h(x)=h(|x|) is monotonic in ∣x∣|x|. ∎

We are now ready to prove Theorem 3.2, which we restate here for convenience:

where S^T,i=ST,i2+MT,i2\hat{S}_{T,i}=\sqrt{S_{T,i}^{2}+M_{T,i}^{2}} and τi=min⁡{t ⁣:∣xt,i∣≠0}\tau_{i}=\min\{t\colon|x_{t,i}|\neq 0\}.

Fixing i∈{1,…,d}i\in\{1,\ldots,d\}, applying Lemma (C.3) for t=τi,…,Tt=\tau_{i},\ldots,T, and multiplying over trials gives:

where we denoted ΔT,i=∑t=τiTδt,i\Delta_{T,i}=\sum_{t=\tau_{i}}^{T}\delta_{t,i}. From the definition of τi\tau_{i}, we have ητi−1,i=ϵ\eta_{\tau_{i}-1,i}=\epsilon and ψτi−1,i≡1\psi_{\tau_{i}-1,i}\equiv 1. Using ηT,i=ϵ−∑t≤Tgtxt,iwt,i\eta_{T,i}=\epsilon-\sum_{t\leq T}g_{t}x_{t,i}w_{t,i} we get:

where we used (12) to bound h(x)≥∣x∣−12h(x)\geq|x|-\frac{1}{2}. By (3),

where in the last inequality we used Lemma D.1 for each ii with α=ϵe−ΔT,i−14\alpha=\epsilon e^{-\Delta_{T,i}-\frac{1}{4}} and γ=2S^T,i\gamma=2\hat{S}_{T,i}. We will now show that

which, together with 2e1/4≤32e^{1/4}\leq 3 will finish the proof. To prove (19), we use Mt,i2≥xt,i2≥(gtxt,i)2=St,i2−St−1,i2M_{t,i}^{2}\geq x_{t,i}^{2}\geq(g_{t}x_{t,i})^{2}=S_{t,i}^{2}-S_{t-1,i}^{2} to get:

Using a−ba≤ln⁡ab\frac{a-b}{a}\leq\ln\frac{a}{b} for any a≥b>0a\geq b>0 (which follows from the concavity of the logarithm):

where for t=Tt=T, we define MT+1,i=MT,iM_{T+1,i}=M_{T,i}. Summing the above over trials t=τi,…,Tt=\tau_{i},\ldots,T:

Appendix E Datasets

MNIST dataset is available at Yann Lecun’s page. All other datasets are availableat the UCI repository. Scale is computed as a ratio of highest to lowest positive L2L_{2} norms of features.

Appendix F Experiment: classification accuracy plots

Appendix G Multivariate predictions

where σk(y^)=ey^k∑j=1Key^j\sigma_{k}(\widehat{\bm{y}})=\frac{e^{\widehat{y}_{k}}}{\sum_{j=1}^{K}e^{\widehat{y}_{j}}} is the soft-max transform.

The regret decouples into a sum over individual coordinates and dimensions of the prediction vector, and the extension of our algorithms is now straightforward (see Algorithm (3) and (4) below). Also, the analysis can be carried out in full analogy to the univariate loss case resulting in the following bounds (for L=1L=1):

where S^T;i,k=ST;i,k2+MT;i2\hat{S}_{T;i,k}=\sqrt{S_{T;i,k}^{2}+M_{T;i}^{2}}.

where S^T;i,k=ST;i,k2+MT;i2\hat{S}_{T;i,k}=\sqrt{S_{T;i,k}^{2}+M_{T;i}^{2}} and τi=min⁡{t ⁣:∣xt,i∣≠0}\tau_{i}=\min\{t\colon|x_{t,i}|\neq 0\}.