Risk and parameter convergence of logistic regression
Ziwei Ji, Matus Telgarsky
Introduction
Despite the simplicity of this setting, a general characterization of the gradient descent path has escaped the literature for a variety of reasons. It is possible for the data to be configured so that is strongly convex, in which case standard convex optimization tools grant the existence of a unique bounded optimum, and moreover a rate at which gradient descent iterates converge to it. It is also possible, however, that data is linearly separable, in which case has an infimum of 0 despite being positive everywhere; the optimum is off at infinity, and convergence analyses operate by establishing a maximum margin property of the normalized iterates (Soudry et al., 2017), just as in the analysis of AdaBoost (Schapire and Freund, 2012; Telgarsky, 2013).
In general, data can fail to induce a strongly convex risk or a linearly separable problem. Despite this, there is still a unique characterization of the gradient descent path. Specifically, gradient descent is biased to follow an optimal ray , which is constructed as follows. First, as detailed in Section 2, the data uniquely determines (via a greedy procedure) a linearly separable subset, with a corresponding maximum margin predictor ; gradient descent converges to in direction, meaning . The remaining data span a space ; the empirical risk of the remaining data is strongly convex over bounded subsets of , and possesses a unique optimum , to which the projected gradient descent iterates converge, meaning .
(Convergence in risk.) For any step sizes and any ,
where hides problem-dependent constants.
(Convergence in parameters; implicit bias and regularization.) The data uniquely determines a subspace and a vector , such that if and , letting denote orthogonal projection onto and denote the solution to the constrained optimization problem, then
If there are examples outside , their projection onto is linearly separable with maximum margin predictor , and
In particular, and .
This theorem captures implicit bias by showing that gradient descent follows the unique ray , even though the risk itself may be minimized by any vector which lies in the relative interior of a convex cone defined by the problem. Similarly, the theorem captures implicit regularization by showing that the gradient descent iterates also track the sequence of constrained optima .
This section first builds up the case of general data with a few illustrative examples, including strongly convex and linearly separable cases. Thereafter, a complete construction and characterization of the optimal ray and related objects is provided in Theorem 2.1.
Risk convergence (Section 3).
The preceding section on problem structure reveals that the (bounded) point achieves low risk; plugging this into a modified smoothness argument yields converge in risk with no apparent dependence on the optimum at infinity.
Parameter convergence (Section 4).
The preceding problem structure reveals is strongly convex over bounded subsets of , which gives convergence to via standard convex optimization tools.
To prove , the first key to the analysis is to study not but instead , which more conveniently captures local smoothness (extreme flattening) of . To complete the proof, a number of technical issues must be worked out, including bounds on , which rely upon an adaptation of the perceptron convergence proof. This proof goes through much more easily for the exponential loss, which is the main reason for its appearance in Theorem 1.1.
Related work (Section 5).
The paper closes with a discussion of related work.
1 Notation
which has made use of at varying input dimensions.
Gradient descent here will always start with , and thereafter set . It is convenient to define and , whereby
Moreover, let denote the solution to the corresponding constrained optimization problem.
Problem structure
This section culminates in Theorem 2.1, which characterizes the unique ray . To build towards this, first consider the following examples.
Strong convexity.
An intermediate setting.
The general case.
Combining elements from the preceding examples, the general case may be characterized as follows; it appears in Figure 4, with all relevant objects labeled. In the general case, the dataset consists of a maximal linearly separable subset , with the remaining data falling into a subset over which the empirical risk is strongly convex. Specifically, is constructed with the following greedy procedure: for each example , include it in if there exists with and . The aggregate satisfies for and otherwise. Therefore can be strictly separated by some vector orthogonal to ; let denote the maximum margin separator of which is orthogonal to .
Turning now to , any vector which is correct on some (i.e., ) must also be incorrect on some other example in (i.e., ); otherwise, would have been included in ! Consequently, as in Figure 2 above, the empirical risk restricted to is strongly convex, with a unique optimum . The gradient descent iterates follow the ray , which means they are globally optimal along , and achieve zero risk and follow the maximum margin direction .
Turning back to the construction in Figure 4, the linearly separable data is the two red and blue circles, while consists of data points on the vertical axis. The points in do not affect , and have been adjusted to move away from 0, where it rested in Figure 3.
Now using the notation , for , the vector is collected into , while for , the vector is put into . The above constructions are made rigorous in the following theorem. The proof of Theorem 2.1, presented in the appendix, follows the intuition above.
The rows of can be uniquely partitioned into matrices , with a corresponding pair of orthogonal subspaces where satisfying the following properties.
(Separable part.) If is nonempty (and thus so is ), then is linearly separable. The maximum margin is given by
Risk convergence
Gradient descent decreases the risk as follows.
This proof relies upon three essential steps.
A slight generalization of standard smoothness-based gradient descent bounds (cf. Section 3).
A useful comparison point to feed into the preceding gradient descent bound (cf. Section 3): the choice , made possible by Theorem 2.1.
In more detail, the first step, a refined smoothness-based gradient descent guarantee, is as follows. While similar bounds are standard in the literature (Bubeck, 2015; Nesterov, 2004), this version has a short proof and no issue with unbounded domains.
Suppose is convex, and there exists so that and gradient iterates with satisfy
The proof is similar to the standard ones, and appears in the appendix.
The second step, as above, is to produce a reference point to plug into Section 3.
Lastly, the smoothness guarantee on . Even though the logistic loss is smooth, this proof gives a refined smoothness inequality where the step is -smooth; this refinement will be essential when proving parameter convergence. This proof is based on the convergence guarantee for AdaBoost (Schapire and Freund, 2012). Recall the definitions and .
Additionally, .
This proof mostly proceeds in a usual way via recursive application of a Taylor expansion
A direct but important consequence is obtained by applying to both sides:
It follows that is smooth, but moreover has constant smoothness unlike above.
Combining these pieces now leads to a proof of Theorem 3.1, given in full in the appendix. As a final remark, note that step size led to a rate, whereas leads to a rate.
Parameter convergence
As in Theorem 1.1, the parameter convergence guarantee gives convergence to over the strongly convex part (that is, and ), and convergence in direction (convergence of the normalized iterates) to over the separable part ( and ). In more detail, the convergence rates are as follows.
(General case.) Suppose , and , and where . Then
and if is nonempty, then , and
Establishing rates of parameter convergence not only relies upon all previous sections, but also is much more involved, and will be split into multiple subsections.
The easiest place to start the analysis is to dispense with the behavior over . For convenience, define
and note .
Convergence over is a consequence of strong convexity and risk convergence (cf. Theorem 3.1).
By Theorem 2.1, . Thus, by strong convexity, for (whereby ),
The bound follows by noting , and alternatively invoking in Theorem 3.1. ∎
If is empty, the proof is complete by plugging into Section 4. The rest of this section establishes convergence to .
Before getting into the guts of Theorem 4.1, this section will establish bounds on . These bounds are used in Theorem 4.1 in two ways. First, as will be clear in the next section, it is natural to prove rates with in the denominator, thus lower bounding with a function of gives the desired bound.
Note that this section focuses on behavior within ; suppose that is nonempty, since otherwise and Theorem 4.1 follows from Section 4. When is nonempty, the solution is off at infinity, and grows without bound. For this reason, these bounds will be on rather than , since by Section 4.
On one hand, is upper bounded by , whose upper bound is given by the following lemma, which is a modification of Section 3 with replaced with .
The proof is similar to that of Section 3, but inserts in a few key places.
On the other hand, to lower bound , notice that
To show that is close to in direction, it is essential to lower bound , since
To control this, recall the representation , where is a dual optimum (cf. Theorem 2.1). With this in hand, and an appropriate choice of convex function , the Fenchel-Young inequality gives for any , , and any such that ,
The significance of working with with is to allow the proof to handle both and simultaneously.
The other key idea is to use . With this choice, both preceding numerator terms can be bounded: for any probability vector , whereas can be upper bounded by applying to both sides of Section 3, as eq. 3.2, yielding an expression which will cancel with the denominator since .
To simplify this further, note and Section 3 also imply
and moreover the definition (cf. Theorem 2.1) implies
To finish, invoke the preceding inequality with , noting that . To produce a rate depending on and not , the lower bound on in Section 4.1 is applied with and thanks to separability. The following proposition summarizes this derivation.
where .
The scheme from the separable case does not directly work: for instance, the proofs relied upon , but now . This term arose by applying Section 3 to control , which in the separable case decreased to , in the general case, however, it can be bounded below.
The fix is to replace with , or rather ; this quantity goes to 0, and there is again a hope of exhibiting the fortuitous cancellations which proved parameter convergence. More abstractly, by subtracting , the proof is again trying to work in the separable case, though there will be cross-terms to contend with.
The first step, then, is to replace the appearance of in earlier Fenchel-Young approach (cf. Section 4.2) with .
Note the appearance of the additional cross term ; by Section 4, this term is bounded.
The next difficulty is to replace the separable case’s use of Section 3 to control with something controlling .
Moreover, if there exists a sequence such that the above condition holds, then
The proof of Section 4.3 is quite involved, but boils down to the following case analysis. The first case is that there is more error over , whereby a strong convexity argument gives a lower bound on the gradient. Otherwise, the error is larger over , which leads to a big step in the direction of .
A key property of the upper bound in Section 4.3 is that it has replaced in Section 3 with . Plugging this bound into the Fenchel-Young scheme in Section 4.3 will now fortuitously cancel , which leads to the following promising bound.
As in the separable case, an extended amount of careful massaging, together with Section 3 and Section 4.1 to control the warm start, is sufficient to establish the parameter convergence of Theorem 4.1 in the general case.
Related work
The technical basis for this work is drawn from the literature on AdaBoost, which was originally stated for separable data (Freund and Schapire, 1997), but later adapted to general instances (Mukherjee et al., 2011; Telgarsky, 2012). This analysis revealed not only a problem structure which can be refined into the used here, but also the convergence to maximum margin solutions (Telgarsky, 2013). Since the structural analysis is independent of the optimization method, the key structural result, Theorem 2.1 in Section 2, can be partially found in prior work; the present version provides not only an elementary proof, but moreover differs by providing and (and not just a partition of the data) and the subsequent construction of a unique and its properties.
The remainder of the analysis has some connections to the AdaBoost literature, for instance when providing smoothness inequalities for (cf. Section 3). There are also some tools borrowed from the convex optimization literature, for instance smoothness-based convergence proofs of gradient descent (Nesterov, 2004; Bubeck, 2015), and also from basic learning theory, namely an adaptation of ideas from the perceptron convergence proof in order to bound (Novikoff, 1962).
Another close line of work is an analysis of gradient descent for logistic regression when the data is separable (Soudry et al., 2017; Gunasekar et al., 2018; Nacson et al., 2018). The analysis is conceptually different (tracking in all directions, rather than the Fenchel-Young and smoothness approach here), and (assuming linear separability) achieves a better rate than the one here, although it is not clear if this is possible in the nonseparable case. Other work shows that not just gradient descent but also steepest descent with other norms can lead to margin maximization (Gunasekar et al., 2018; Telgarsky, 2013), and that constructing loss functions with an explicit goal of margin maximization can lead to better rates (Nacson et al., 2018). Another line of work uses condition numbers to analyze these problems with a different parameterization (Freund et al., 2017).
There is some work in online learning on optimization over unbounded sets, for instance bounds where the regret scales with the norm of the comparator (Orabona and Pal, 2016; Streeter and McMahan, 2012). By contrast, as the present work is not adversarial and instead has a fixed training set, part of the work (a consequence of the structural result, Theorem 2.1) is the existence of a good, small comparator.
The authors are grateful for support from the NSF under grant IIS-1750051.
References
Appendix A Omitted proofs from Section 2
Before proving Theorem 2.1, note the following result characterizing margin maximization over .
Suppose has rows and there exists with . Then
Moreover there exists a unique nonzero primal optimum , and every dual optimum satisfies .
To start, note since there exists with .
Combining this with the Fenchel-Rockafellar duality theorem (Borwein and Lewis, 2000, Theorem 3.3.5, Exercise 3.3.9.f),
and moreover every primal-dual optimal pair satisfies , which means .
It only remains to show that is unique. Since , necessarily any primal optimum has unit length, since the objective value will only decrease by increasing the length. Consequently, suppose and are two primal optimal unit vectors. Then would satisfy
but then the unit vector would have when , which implies , a contradiction. ∎
(of Theorem 2.1) Partition the rows of into and as follows. For each row , put it in if there exists so that (coordinate-wise) and ; otherwise, when no such exists, add this row to . Define , the linear span of the rows of . This has the following consequences.
To start, .
which again is in fact a chain of equalities.
For every with , there exists a row of such that . To see this, suppose contradictorily that . It cannot hold that , since and . this means and moreover for some . But since and , then for a sufficiently large , and , which means row of should have been in , a contradiction.
Consequently, has compact sublevel sets over (Hiriart-Urruty and Lemaréchal, 2001, Proposition B.3.2.4).
the final inequality since the minimization is of a continuous function over a compact set, thus attained at some point, and the infimand is positive over the domain. Consequently, is strongly convex over compact subsets of .
Since is strongly convex over and moreover has bounded sublevel sets over , it attains a unique optimum over .
Appendix B Omitted proofs from Section 3
To start, note how the three key lemmas provided in the main text lead to a proof of Theorem 3.1.
Consequently, by the choice and Section 3,
To fill out the proof, first comes the smoothness-based risk guarantee.
(of Section 3) Define . For any ,
Summing this inequality over and rearranging gives the bound. ∎
Define and suppose ; then and
Combining this, the choice of , and Appendix B,
a contradiction. Therefore , which in turn implies
Together, these pieces prove the desired smoothness inequality.
(of Section 3) For any , by Appendix B and the definition of ,
Applying this recursively gives the bound.
Appendix C Omitted proofs from Section 4
This section will be split into subsections paralleling those in Section 4.
To start, the proof of the smoothness-based convergence guarantee, but with sensitivity to .
(of Section 4.1) Fix any . Expanding the square,
the last inequality making use of smoothness, namely Section 3. Therefore
Applying to both sides and canceling terms yields
Proving Section 4.1 is now split into upper and lower bounds.
(of upper bound in Section 4.1) For a fixed , define
where the last inequality comes from Section 4.
Proceeding with this plan, first note (similarly to the main text)
(of lower bound in Section 4.1) First note
Combining these steps, and invoking Theorem 2.1,
C.2 Parameter convergence when separable
(of Theorem 4.1 when (separable case)) Let be arbitrary, and select so that . By Section 3, since , the loss decreases at each step, and thus for any , . Now let and with arbitrary and . By Section 4.2 and Section 3,
For , by Section 4.2 and (cf. Theorem 2.1),
Invoking eq. C.1 and eq. C.2 with or (notice that in both cases ) gives
Next, and are tuned as follows. First, set ; this is possible if the corresponding , or equivalently . This in turn is true as long as and
because then , and since , given by Section 4.1, Theorem 3.1 gives
By Theorem 3.1, if
By Section 4.1, . Together with eq. C.3,
where the constants hidden in the do not depend on the problem. Combining this with the lower and upper bounds on in Section 4.1,
C.3 Parameter convergence in general
For convenience in these proofs, define .
The general application of Fenchel-Young is as follows.
Next, the adjustment of Section 3 to upper bounding , which leads to an upper bound with rather than , and the necessary cancellation.
(of Section 4.3) The first inequality implies the second via the same direct induction in Section 3, so consider the first inequality.
Making use of Appendices B and B and proceeding as in Appendix B,
Next it will be shown, by analyzing two cases, that
In the following, for notational simplicity let denote .
Suppose . Consequently,
Then, since ,
Otherwise, suppose . Using an expression inspired by a general analysis of AdaBoost (Mukherjee et al., 2011, Lemma 16 of journal version), and introducing by invoking Section 4.2 as in the separable case,
Next, the proof of the intermediate inequality by combining Section 4.3 and Section 4.3.
(of Section 4.3) By Section 3, since , the loss decreases at each step, and thus for any , . Combining Section 4.3 and Section 4.3,
The pieces are in place to prove parameter convergence in general.
(of general case in Theorem 4.1) The guarantee on and the case have been discussed in Section 4, therefore assume . The proof will proceed via invocation of the Fenchel-Young scheme in Section 4.3, applied to since .
It is necessary to first control the warm start parameter . Fix an arbitrary , set , and let be large enough such that
By Theorem 3.1 and the choice of step sizes, it is enough to require
Therefore, choosing suffices.
Invoking Section 4.3 with the above choice for ,
Suppose and , where is introduced in Section 4.1. As will be shown momentarily, satisfies (C.6) with for some constant , and therefore this choice of can be plugged into (C.7). To see this, note that Theorem 3.1 gives
where the last line uses Section 4.1. It can be shown similarly that other parts of (C.6) hold.
Continuing with Equation C.7 but using and upper bounding via Section 4.1,
Lastly, controlling the denominator with the lower bound on in Section 4.1,