W HY RESAMPLING OUTPERFORMS REWEIGHTING FOR CORRECTING SAMPLING BIAS
Anonymous authors
Paper under double-blind review
A BSTRACT
A data set sampled from a certain population is biased if the subgroups of the population are sampled at proportions that are signiﬁcantly different from their underlying proportions.
Training machine learning models on biased data sets requires correction techniques to compensate for the bias.
We consider two commonlyused techniques, resampling and reweighting, that rebalance the proportions of the subgroups to maintain the desired objective function.
Though statistically equivalent, it has been observed that reweighting outperforms resampling when combined with stochastic gradient algorithms.
By analyzing illustrative examples, we explain the reason behind this phenomenon using tools from dynamical stability and stochastic asymptotics.
We also present experiments from regression, classiﬁcation, and off-policy prediction to demonstrate that this is a general phenomenon.
We argue that it is imperative to consider the objective function design and the optimization algorithm together while addressing the sampling bias.
I NTRODUCTION
A data set sampled from a certain population is called biased if the subgroups of the population are sampled at proportions that are signiﬁcantly different from their underlying population proportions.
Applying machine learning algorithms naively to biased training data can raise serious concerns and lead to controversial results (Sweeney, 2013; Kay et al., 2015; Menon et al., 2020).
In many domains such as demographic surveys, fraud detection, identiﬁcation of rare diseases, and natural disasters prediction, a model trained from biased data tends to favor oversampled subgroups by achieving high accuracy there while sacriﬁcing the performance on undersampled subgroups.
Although one can improve by diversifying and balancing during the data collection process, it is often hard or impossible to eliminate the sampling bias due to historical and operational issues.
In order to mitigate the biases and discriminations against the undersampled subgroups, a common technique is to preprocess the data set by compensating the mismatch between population proportion and the sampling proportion .
Among various approaches, two commonly-used choices are reweighting and resampling .
In reweighting, one multiplies each sample with a ratio equal to its population proportion over its sampling proportion.
In resampling, on the other hand, one corrects the proportion mismatch by either generating new samples for the undersampled subgroups or selecting a subset of samples for the oversampled subgroups.
Both methods result in statistically equivalent models in terms of the loss function (see details in Section 2).
However, it has been observed in practice that resampling often outperforms reweighting signiﬁcantly, such as boosting algorithms in classiﬁcation (Galar et al., 2011; Seiffert et al., 2008), off-policy prediction in reinforcement learning (Schlegel et al., 2019) and so on.
The obvious question is why.
Main contributions.
Our main contribution is to provide an answer to this question: resampling outperforms reweighting because of the stochastic gradient-type algorithms used for training.
To the best of our knowledge, our explanation is the ﬁrst theoretical quantitative analysis for this phenomenon.
With stochastic gradient descent (SGD) being the dominant method for model training, our analysis is based on some recent developments for understanding SGD.
We show via simple and explicitly analyzable examples why resampling generates expected results while reweighting performs undesirably.
Our theoretical analysis is based on two points of view, one from the dynamical stability perspective and the other from stochastic asymptotics.
In addition to the theoretical analysis, we present experimental examples from three distinct categories (classiﬁcation, regression, and off-policy prediction) to demonstrate that resampling outperforms reweighting in practice.
This empirical study illustrates that this is a quite general phenomenon when models are trained using stochastic gradient type algorithms.
Our theoretical analysis and experiments show clearly that adjusting only the loss functions is not sufﬁcient for ﬁxing the biased data problem.
The output can be disastrous if one overlooks the optimization algorithm used in the training.
In fact, recent understanding has shown that objective function design and optimization algorithm are closely related, for example optimization algorithms such as SGD play a key role in the generalizability of deep neural networks.
Therefore in order to address the biased data issue, we advocate for considering data, model, and optimization as an integrated system.
Related work.
In a broader scope, resampling and reweighting can be considered as instances of preprocessing the training data to tackle biases of machine learning algorithms.
Though there are many well-developed resampling (Mani & Zhang, 2003; He & Garcia, 2009; Maciejewski &
Stefanowski, 2011) and reweighting (Kumar et al., 2010; Malisiewicz et al., 2011; Chang et al., 2017) techniques, we only focus on the reweighting approaches that do not change the optimization problem.
It has been well-known that training algorithms using disparate data can lead to algorithmic discrimination (Bolukbasi et al., 2016; Caliskan et al., 2017), and over the years there have been growing efforts to mitigate such biases, for example see (Amini et al., 2019; Kamiran & Calders, 2012; Calmon et al., 2017;
Zhao et al., 2019; L ´ opez et al., 2013).
We also refer to (Haixiang et al., 2017;
He & Ma, 2013; Krawczyk, 2016) for a comprehensive review of this growing research ﬁeld.
Our approaches for understanding the dynamics of resampling and reweighting under SGD are based on tools from numerical analysis for stochastic systems.
Connections between numerical analysis and stochastic algorithms have been rapidly developing in recent years.
The dynamical stability perspective has been used in (Wu et al., 2018) to show the impact of learning rate and batch size in minima selection.
The stochastic differential equations (SDE) approach for approximating stochastic optimization methods can be traced in the line of work (Li et al., 2017; 2019; Rotskoff & VandenEijnden, 2018; Shi et al., 2019), just to mention a few.
P ROBLEM SETUP
Let us consider a population that is comprised of two different groups, where a proportion a 1 of the population belongs to the ﬁrst group, and the rest with the proportion a 2 = 1 − a 1 belongs to the second (i.e., a 1 , a 2 > 0 and a 1 + a 2 = 1 ).
In what follows, we shall call a 1 and a 2 the population proportions .
Consider an optimization problem for this population over a parameter θ .
For simplicity, we assume that each individual from the ﬁrst group experiences a loss function
V 1 ( θ ) , while each individual from the second group has a loss function of type V 2 ( θ ) .
Here the loss function V 1 ( θ ) is assumed to be identical across all members of the ﬁrst group and the same for
V 2 ( θ ) across the second group, however it is possible to extend the formulation to allow for loss function variation within each group.
Based on this setup, a minimization problem over the whole population is to ﬁnd
[Equation]
For a given set Ω of N individuals sampled uniformly from the population, the empirical minimization problem is
[Equation]
where i r ∈ { 1 , 2 } denotes which group an individual r belongs to.
When N grows, the empirical loss in (2) is consistent with the population loss in (1) as there are approximately a 1 fraction of samples from the ﬁrst group and a 2 fraction of samples from the second.
However, the sampling can be far from uniformly random in reality.
Let n 1 and n 2 with n 1 + n 2 = N denote the number of samples from the ﬁrst and the second group, respectively.
It is convenient to deﬁne f
i , i = 1 , 2 as the sampling proportions for each group, i.e., f 1 = n 1 /N and f 2 = n 2 /N with f 1 + f 2 = 1 .
The data set is biased when the sampling proportions f 1 and f 2 are different from the population proportions a 1 and a 2 .
In such a case, the empirical loss is f 1 V 1 ( θ ) + f 2 V 2 ( θ ) , which is clearly wrong when compared with (1).
Let us consider two basic strategies to adjust the model: reweighting and resampling.
In reweighting, one assigns to each sample r ∈ Ω a weight a i r /f
i r and the reweighting loss function is
[Equation]
In resampling, one either adds samples to the minority group (i.e., oversampling) or removing samples from the majority group (i.e., undersampling).
Although the actual implementation of oversampling and undersampling could be quite sophisticated in order to avoid overﬁtting or loss of information, mathematically we interpret the resampling as constructing a new set of { s } samples of size M , among which a 1 M samples are of the ﬁrst group and a 2 M samples of the second.
The resampling loss function is
[Equation]
Notice that both V w ( θ ) and V s ( θ ) are consistent with the population loss function V (
[Equation]
This means that, under mild conditions on V 1 ( θ ) and V 2 ( θ ) , a deterministic gradient descent algorithm from a generic initial condition converges to similar solutions for V w ( θ ) and V s ( θ ) .
However, as we shall explain below, the behavior can be drastically different when a stochastic gradient algorithm is used.
The key reason is that the variances experienced can be very different.
S TABILITY ANALYSIS
Let us use a simple example to illustrate why resampling outperforms reweighting under SGD, from the viewpoint of stability.
Consider two loss functions V 1 and V 2 with disjoint supports,
[Equation]
each of which is quadratic on its support.
The population loss function is V ( θ ) =
a 1 V 1 ( θ )+ a 2 V 2 ( θ ) , with two local minima at θ = − 1 and θ = 1 .
The gradients for V 1 and V 2 are
[Equation]
Suppose that the population proportions satisfy a 2 > a 1 , then θ = 1 is the global minimum and it is desired that SGD should be stable near it.
However, as shown in Figure 1, when the sampling proportion f 2 is signiﬁcantly less than the population proportion a 2 , for reweighting θ = 1 can easily become unstable: even if one starts near the global minimum θ = 1 , the trajectories for reweighting always gear towards θ = − 1 after a few steps (see Figure 1(1)).
On the other hand, for resampling θ = 1 is quite stable (see Figure 1(2)).
The expectations of the stochastic gradient are the same for both methods.
It is the difference in the second moment that explains why trajectories near the two minima exhibit different behaviors.
Our explanation is based on the stability analysis framework used in (Wu et al., 2018).
By deﬁnition, a stationary point θ ∗ is stochastically stable if there exists a uniform constant C > 0 such that E [ (cid:107) θ k − θ ∗ (cid:107) 2 ] ≤ C (cid:107) θ 0 − θ ∗ (cid:107) 2 , where θ k is the k -th iterate of SGD.
The stability conditions for resampling and reweighting are stated in the following two lemmas.
Lemma 1.
For resampling, the conditions for the SGD to be stochastically stable around θ =
−and θ
= 1 are respectively
[Equation]
Lemma 2.
For reweighting, the condition for the SGD to be stochastically stable around θ =
−and θ
= 1 are respectively
[Equation]
V ( ) - - -    3 -0.
V ( )
[Figure]
Note that the stability conditions for resampling are independent of the sampling proportions ( f 1 , f 2 ) , while the ones for reweighting clearly depend on ( f 1 , f 2 ) .
We refer the detailed computations to Appendix A.
Lemma 2 shows that reweighting makes problems stiffer in terms of the stability criterion.
Let us consider the case a 1 = 12 − (cid:15), a 2 = 12 + (cid:15) with a small constant (cid:15) > 0 and f 2 /f 1 (cid:28) 1 .
For reweighting, the global minimum θ = 1 is stochastically stable only if η (1 + f 1 /f 2 ) ≤ 4 + O ( (cid:15) ) .
This condition becomes rather stringent in terms of the learning rate η since f 1 /f
(cid:29) 1 .
On the other hand, the local minimizer θ = − 1 is stable if η (1 + f 2 /f 1 ) ≤ 4 + O ( (cid:15) ) , which could be satisﬁed for a broader range of η because f 2 /f 1 (cid:28) 1 .
In other words, for a ﬁxed learning rate η , when the ratio f 2 /f 1 between the sampling proportions is sufﬁciently small, the desired minimizer θ = 1 is no longer statistically stable with respect to SGD.
SDE ANALYSIS
The stability analysis can only be carried for a learning rate η of a ﬁnite size.
However, even for a small learning rate η , one can show that the reweighting method is still unreliable from a different perspective.
This section applies stochastic differential equation analysis to demonstrate it.
Let us again use a simple example to illustrate the main idea.
Consider the following two loss functions,
[Equation]
with 0 < (cid:15) (cid:28) 1 .
The population loss function is V ( θ ) =
a 1 V 1 ( θ ) + a 2 V 2 ( θ ) with local minimizers θ = − 1 and θ = 1 .
Note that the O ( (cid:15) ) terms are necessary.
Without it, if the SGD starts in ( −∞ , 0) , all iterates will stay in this region because there is no drift from V 2 ( θ ) .
Similarly, if the SGD starts in (0 , ∞ ) , no iterates will move to ( −∞ , 0) .
That means the result of SGD only depends on the initialization when O ( (cid:15) ) term is absent.
In Figure 2, we present numerical simulations of the resampling and reweighting methods for the designed loss function V ( θ ) .
If a 2 > a 1 , then the global minimizer of V ( θ ) is θ = 1 (see the Figure 2(1)).
Consider a setup with population proportions a 1 /a 2 = 0 .
6 along sampling proportions f 1 /f 2 = 0 .
9 / 0 . 1 , which are quite different.
Figures 2(2) and (3) show the dynamics under the reweighting and resampling methods, respectively.
The plots show that, while the trajectory for resampling is stable across all the time, the trajectory for reweighting quickly escapes to the (nonglobal) local minimizer θ = − 1 even when it starts near the global minimizer θ = 1 .
When the learning rate is sufﬁciently small, one can approximate the SGD by an SDE, which in this piece-wise linear loss example is approximately a Langevin dynamics with a piecewise constant mobility.
In particular when the dynamics reaches equilibrium, the stationary distribution of the
[Figure]
stochastic process is approximated by a Gibbs distribution, which gives the probability densities at the stationary points.
Let us denote p s ( θ ) and p w ( θ ) as the stationary distribution over θ under resampling and reweighting, respectively.
Suppose that a 2 > a 1 and hence V (1) < V ( − 1) .
The following lemmas quantitatively summarize the results.
Lemma 3.
When a 2 > a 1 , V (1) <
V ( − 1) .
The stationary distribution for resampling satisﬁes the relationship p s (
[Equation]
Lemma 4.
With a 2 > a 1 , V (1) <
V ( − 1) < 0 .
Under the condition f 2 f 1 ≤ a 2 a 1 (cid:113) V ( − 1) V (1) for the sampling proportions, the stationary distribution for reweighting satisﬁes the relationship
[Equation]
The proofs of the above two lemmas can be found in Appendix B. Lemma 3 shows that for resampling it is always more likely to ﬁnd θ at the global minimizer 1 than at the local minimizer − 1 .
Lemma 4 states that for reweighting it is more likely to ﬁnd θ at the local minimizer − 1 when f 2 f 1 ≤ a 2 a 1 (cid:113) V ( − 1) V (1) .
Together, they explain the phenomenon shown in Figure 2.
To better understand the condition in Lemma 4, let us consider the case a 1 = 12 − (cid:15), a 2 = 12 + (cid:15) with a small constant (cid:15) > 0 .
Under this setup, V ( − 1) /V
(1) ≈ 1 .
Whenever the ratio of the sampling proportions f 2 /f 1 is signiﬁcantly less than the ratio of the population proportions a 2 /a 1 ≈ 1 , reweighting will lead to the undesired behavior.
The smaller the ratio f 2 /f 1 is, the less likely the global minimizer will be visited.
General results.
Let us now consider the minimization of V ( θ )
= a 1 V 1 ( θ ) + a 2 V 2 ( θ ) for more general V 1 , V 2 and also θ in high dimensions.
It is in fact not clear how to extend the above stochastic analysis to more general functions V ( θ ) .
Instead we focus on the transition time from one stationary point to another in order to understand the behavior of resampling and reweighting.
For this purpose, we again resort to the SDE approximation of the SGD in the continuous time limit.
Such a SDE approximation, ﬁrst introduced in (Li et al., 2017), involves a data-dependent covariance coefﬁcient for the diffusion term and is justiﬁed in the weak sense with an error of order O ( √ η ) .
More speciﬁcally, the dynamics can be approximated by
[Equation]
where Θ( t = kη )
≈ θ k for the step k parameter θ k , η is the learning rate, and Σ(Θ) is the covariance of the stochastic gradient at location Θ .
In the SDE theory, the drift term ∇ V ( · ) is usually assumed to be Lipschitz.
However, in machine learning (for example neural network training with nonsmooth activation functions), it is common to encounter not-Lipschitz gradients of loss functions (as in the example presented in Section 3).
To ﬁll this gap, we provide in Appendix C a justiﬁcation of
SDE approximation for the drift with jump discontinuities, based on the proof presented in (M¨ullerGronbach et al., 2020).
The following two lemmas summarize the transition times between the two local minimizers.
Lemma 5.
Assume that there are only two local minimizers θ ∗ 1 , θ ∗ 2 for the objective function V ( θ ) .
Let τ θ ∗ 1 → θ ∗ 2 be the transition time for Θ( t ) in (6) from the (cid:15) -neighborhood of θ ∗ 1 (a closed ball of radius (cid:15) centered at θ ∗ 1 ) to the (cid:15) -neighborhood of θ ∗ 2 and τ θ ∗ 2 → θ ∗ 1 be the transition time in the opposite direction.
Then
[Equation]
Here det( ∇ 2 L ( θ ∗ 1 )) and det( ∇ 2 L ( θ ∗ 2 )) are the determinants of the Hessians at θ ∗ 1 and θ ∗ 2 , respectively.
δV ( θ ∗ k ) ≡ V ( θ ∗ ) − V ( θ ∗ k ) for k = 1 , 2 where θ ◦ is the saddle point between θ ∗ 1 , θ ∗ 2 .
This lemma is known in the diffusion process literature as the Eyring-Kramers formula; see, e.g., (Berglund, 2011;
Bovier et al., 2004; 2005).
Using the above lemma, we obtain the following result for the transition times for resampling and reweighting.
Lemma 6.
Assume that there are only two local minimizers θ ∗ 1 , θ ∗ 2 for the objective function V ( θ ) .
Also assume that the loss function V 1 ( · ) for the ﬁrst group is O ( (cid:15) ) in the (cid:15) -neighborhood of θ ∗and the loss function V 2 ( · ) for the second group is O ( (cid:15) ) in the (cid:15) -neighborhood of θ ∗ 1 .
In addition, assume that the determinants of the Hessian at two local minimizers are the same.
Then the ratio of the transition times between the two local minimizers for resampling is
[Equation]
and the ratio for reweighting is
[Equation]
See Appendix B for the proof.
When the ratio is larger than 1 , it means that θ ∗ 1 is more stable than θ ∗ 2 .
This result shows that for reweighting the relative stability of the two minimizers highly depends on the sampling proportions ( f 1 , f 2 ) .
On the other hand, for resampling it is independent of ( f 1 , f 2 ) .
To see how the sampling proportions affect the behavior of reweighting, let us consider a simple case where θ ∗ 1 is the global minimizer, ∇ V 1 ( θ ∗ 1 ) ∇ V 1 ( θ ∗ 1 ) (cid:62) =
∇ V 2 ( θ ∗ 2 ) ∇ V 2 ( θ ∗ 2 ) (cid:62) , a 1 = 12 + (cid:15), a 2 = 12 − (cid:15) , and f 1 (cid:28) f 2 .
This ensures that δV ( θ ∗ 1 ) > δV ( θ ∗ 2 ) and the above ratio for resampling is larger than 1 , which is the desired result.
However, f 1 (cid:28) f 2 implies that f 1 a 21 (cid:28) 1 , f 2 a 22 (cid:29) 1 , and the above ratio for reweighting is much smaller than 1 , which means that the local minimizer θ ∗ 2 is more stable than the global minimizer θ ∗ 1 .
E XPERIMENTS
This section examines the empirical performance of resampling and reweighting for problems from classiﬁcation, regression, and reinforcement learning.
Classiﬁcation.
This experiment uses the Porto Seguros safe driver prediction data set 2 to predict the probability of a driver to ﬁle a claim.
One issue of the provided training data set after preprocessing is that the data distribution under the column “target”, which indicates whether a claim is ﬁled, is already highly skewed: the ratio of unﬁled claims and ﬁled claims is a 1 /a 2 = 26 .
Assuming this as the underlying population distribution since ﬁling a claim can be considered as a rare event, https://www.kaggle.com/c/porto-seguro-safe-driver-prediction/data we create biased data sets with different sampling proportions f 1 /f 2 (see Figure 3) by extracting samples uniformly randomly.
The code from the imbalanced-learn package 3 is adapted to compare the performance between resampling (including both oversampling and undersampling methods) and reweighting.
The neural network used to train the data is implemented in Keras with 4 layers.
As we discussed in Section 2, the resampling methods adjust sample size to make the population proportions close to a 1 /a 2 , and reweighting multiplies each sample by a i /f i along with a normalizing factor.
To estimate the performance, rather than using the classiﬁcation accuracy that can be misleading for biased data, we use the metric that computes the area under the receiver operating characteristic curve (ROC-AUC) from the prediction scores.
The ROC curves plots the true positive rate on the y -axis versus the false positive rate on the x -axis.
As a result, a larger area under the curve indicates a better performance of a classiﬁer.
As shown in Figure 3, resampling outperforms reweighting in terms of the ROC-AUC scores for different sampling proportions f 1 /f 2 .
[Figure]
Nonlinear regression.
Using the Labeled
Faces in the Wild (LFW) dataset, we compare the performance of resampling and reweighting for the facial recognition problem.
Two celebrities are picked from the LFW dataset: the majority group among selected samples consists of 530 photos of President George W. Bush, while the minority group contains 29 photos of President Bill Clinton.
The sampling proportions are f 1 /f 2 = 18 .
3 / 1 and the underlying population proportions are a 1 /a 2 = 1 / 1 .
We again adapt the code from the imbalancedlearn package and experiment on several oversampling methods (ADASYN, ROS, SMOTE) and undersampling methods (RUS, NearMiss), as well as reweighting, by conducting SGDClassiﬁer using logistic regression.
Figureplots the ROC curves for all these methods mentioned above.
We emphasize that this is not a claim that SGDClassiﬁer gives the best prediction score.
Instead, our motivation is to illustrate that the performance of SGD deteriorates when reweighting is used.
Off-policy prediction.
In the off-policy prediction problem in reinforcement learning, the objective is to ﬁnd the value function of police π using the trajectory { ( a t , s t , s t +1 ) }
Tt =1 generated by a behavior policy µ .
To achieve this, the standard approach is to update the value function based on the behavior policy’s temporal difference (TD) error δ µ ( s t ) =
R ( s t ) + γV ( s t +1 )
− V ( s t ) with an importance weight E [ δ π | s t =
s ]
= (cid:80)
a ∈
A π ( a | s ) µ ( a | s ) E [ δ π | s t = s, a t = a ] µ ( a | s ) , where the summation is taken over the action space A .
The resulting reweighting TD learning for policy π is
[Equation]
where η is the learning rate.
This update rule is an example of reweighting.
On the other hand, the expected TD error can also be written in the resampling form, E
[ δ π | s t = s ] = (cid:80)
a ∈ A E [ δ π | s t = s, a t = a ] π ( a | s )
= (cid:80) a ∈ A (cid:80) π ( a | s ) N j =
E [ δ jπ | s t = s, a t = a ] , where N is the total number of samples for s t = s .
This results to a resampling TD learning algorithm:
at step t ,
[Equation]
where ( a k , s k , s k +1 ) is randomly chosen from the data set { ( a j , s j , s j +1 ) } s j = s t with probability π ( a k | s t ) .
Consider a simple example with discrete state space S
= { i } n − 1 i =0 , action space
A = {± 1 } , and transition dynamics s t +1 =
mod ( s t + a t , n ) , where the operator mod ( m, n ) gives the remainder of m divided by n .
Figure 5 shows the results of the off-policy TD learning by these two approaches, with the choice of n = 32 and r ( s )
= 1 + sin(2 πs/n ) .
The target policy is π ( a i | s )
= 12 while the behavior policy is µ ( a i | s )
=
12 + ca i .
The difference between the two policies becomes larger as the constant c ∈ [0 , 1 / 2] increases.
From the previous analysis, if one group has much fewer samples as it should have, then the minimizer of the reweighting method is highly affected by the sampling bias.
This is veriﬁed in the plots: as c becomes larger, the performance of reweighting deteriorates, while resampling is rather stable and almost experiences no difference with the on-policy prediction in this example.
[Figure]
The value function obtained from resampling is fairly close to the exact value function, while the results of reweighting gets worse as the behavior policy gets further from the
D ISCUSSIONS
This paper examines the different behaviors of reweighting and resampling for training on biasedly sampled data with the stochastic gradient descent.
From both the dynamical stability and stochastic asymptotics viewpoints, we explain why resampling is numerically more stable and robust than reweighting.
Based on this theoretical understanding, we advocate for considering data, model, and optimization as an integrated system, while addressing the bias.
An immediate direction for future work is to apply the analysis to more sophisticated stochastic training algorithms and understand their impact on resampling and reweighting.
Another direction is to extend our analysis to unsupervised learning problems.
A P ROOFS IN SECTIONA. P ROOF OF L EMMA
Proof.
In resampling near θ = − 1 the gradient is θ + 1 with probability a 1 and 0 with probability a 2 .
Let us denote the random gradient at each step by W ( θ + 1) where W is a Bernoulli random variable with mean E ( W )
=
a 1 and variance V ( W ) =
a 1 a 2 .
At the learning rate η , the iteration can be written as
[Equation]
The ﬁrst and second moments of the iterates are
[Equation]
According to the deﬁnition of the stochastic stability, SGD is stable around θ = − 1 if the multiplicative factor of the second equation is bounded by 1 , i.e.
[Equation]
Consider now the stability around θ = 1 , the iteration can be written as
[Equation]
where W is again a Bernoulli random variable with E ( W )
= a 2 and V ( W ) =
a 1 a 2 .
The same computation shows that the second moment follows
[Equation]
Therefore, the condition for the SGD to be stable around θ = 1 is
[Equation]
A. P ROOF OF L EMMA
Proof.
In reweighting, near θ = − 1 the gradient is a 1 f 1 ( θ + 1) with probability f 1 and 0 with probability f 2 .
Let us denote the random gradient at each step by W ( θ + 1) , where W is a Bernoulli random variable with E ( W )
=
a 1 and V ( W ) =
f 1 f 2 (cid:16) a 1 f 1 (cid:17) 2 .
At the learning rate η , the iteration can be written as
[Equation]
Hence the second moments of the iterates are given by
[Equation]
Therefore, the condition for the SGD to be stable around θ = − 1 is
[Equation]
Consider now the stability around θ = 1 , the gradient is 0 with probability f 1 and a 2 f 2 ( θ − 1) with probability f 2 .
An analysis similar to the case θ = − 1 shows that the condition for the SGD to be stable around θ = 1 is
[Equation]
B P ROOFS IN SECTIONB. P ROOF OF L EMMA
Proof.
In resampling, with probability a 1 the gradients over the four intervals ( −∞ , − 1) , ( − 1 , 0) , (0 , 1) , and (1 , ∞ ) are − 1 , 1 , (cid:15) , and (cid:15) .
With probability a 2 , they are − (cid:15) , − (cid:15) , − 1 , and 1 across these four intervals.
The variances of the gradients are a 1 a 2 (1 − (cid:15) ) 2 , a 1 a 2 (1 + (cid:15) ) 2 , a 1 a 2 (1 + (cid:15) ) 2 , a 1 a 2 (1 − (cid:15) ) 2 , respectively, across the same intervals.
Since (cid:15) (cid:28) 1 , the variance can be written as a 1 a 2 + O ( (cid:15) ) across all intervals.
Then the SGD dynamics with learning rate η can be approximated by
[Equation]
where Z ∼ N (0 , 1) is a normal random variable.
When η is small, one can approximate the dynamics by a stochastic differential equation of form
[Equation]
by identifying θ k ≈ Θ( t = kη ) (see Appendix C for details).
The stationary distribution of this stochastic process is
[Equation]
Plugging in θ = − 1 , 1 results in
[Equation]
Under the assumption that (cid:15) (cid:28) 1 , the last term is negligible.
When a 2 > a 1 , V ( θ ) is minimized at θ = 1 , which implies − ( V (1) − V ( − 1)) > 0 .
Hence, this ratio is larger than 1.
B. P ROOF OF L EMMA
Proof.
In reweighting, with probability f 1 the gradients are − a 1 f 1 , a 1 f 1 , a 1 f 1 (cid:15) , and a 1 f 1 (cid:15) over the four intervals ( −∞ , − 1) , ( − 1 , 0) , (0 , 1) , and (1 , ∞ ) , respectively.
With probability f 2 , they are − a 2 f 2 (cid:15) , − a 2 f 2 (cid:15) , − a 2 f 2 , and a 2 f 2 .
The variances of the gradients are f 1 f 2 ( a 1 f 1 −
[Equation]
f
[Equation]
(cid:15) ) 2 , f 1 f 2 (
[Equation]
1 + a 2 f 2 (cid:15) ) 2 , f 1 f 2 ( a 1 f 1 (cid:15) + a 2 f 2 ) 2 , and f 1 f 2 ( a 1 f 1 (cid:15) − a 2 f 2 ) 2 , respectively, across the same intervals.
Since (cid:15) (cid:28) 1 , the variance can be written as f 1 f 2 a 21 f 21 + O ( (cid:15) ) for θ < 0 and f 1 f 2 a 22 f 22 + O ( (cid:15) ) for θ > 0 .
With θ k ≈ Θ( kη ) , the approximate SDE for θ < 0 is given by
[Equation]
while the one for θ > 0 is
[Equation]
(see Appendix C for the SDE derivations).
The stationary distributions for θ < 0 and θ > 0 are, respectively,
[Equation]
Plugging in θ = − 1 , 1 results in
[Equation]
The next step is to ﬁgure out the relationship between Z 1 and Z 2 .
Consider an SDE with non-smooth diffusion d Θ = − V (cid:48)
(Θ) dt + σdB .
The Kolmogorov equation for the stationary distribution is
[Equation]
This suggests that σ 2 p is continuous at the discontinuity θ = 0 .
In our setting, since V (0) = 0 , this simpliﬁes to
[Equation]
This simpliﬁes to
[Equation]
Inserting this into (10) results in p
[Equation]
By the assumption f 2 f 1 ≤ a 2 a 1 (cid:113) V ( − 1) V (1) and V (1) <
V ( − 1) < 0 , one has (cid:16) a 1 a 2 (cid:17) 2 (cid:16) f 2 f 1 (cid:17) 2 ≤ V ( − 1) V (1) <and − f 2 /f 1 a 22 V (1) ≤ − f 1 /f 2 a 21 V ( − 1) .
Hence the above ratio is less than 1 .
B. P ROOF OF L EMMA
Proof.
The variances of gradients for resampling and reweighting are respectively,
[Equation]
Given that at the stationary point E [ ∇ V ( θ ∗ 1 )]
=
E [ ∇ V ( θ ∗ 2 )]
= 0 , one can omit the last term in the variance.
In addition, since ∇ V 1 ( θ ∗ 2 ) , ∇ V 2 ( θ ∗ 1 )
=
O ( (cid:15) ) (cid:28) ∇ V 1 ( θ ∗ 1 ) , ∇ V 2 ( θ ∗ 2 ) by assumption, all the higher order terms are included in an O ( √ (cid:15) ) term.
One can then derive Lemma 6 from Lemma 5.
C A J USTIFICATION OF THE SDE APPROXIMATION
The stochastic differential equation approximation of SGD involving data-dependent covariance coefﬁcient Gaussian noise was ﬁrst introduced in (Li et al., 2017) and justiﬁed in the weak sense.
Consider the SDE
[Equation]
The Euler-Maruyama discretization with time step η results in
[Equation]
In our case, b ( · ) = − V (cid:48) ( · ) .
When b satisﬁes Lipschitz continuity and some technical smoothness conditions, according to (Li et al., 2017) for any function g from a smooth class M , there exists
C > 0 and α > 0 such that for all k = 0 , 1 , 2 , · · · , N ,
[Equation]
However, as the loss function considered in this paper has jump discontinuous in the ﬁrst derivative, the classical approximation error results for SDE do not apply.
In fact, the problem V / ∈ C 1 ( R n ) is a common issue in machine learning and deep neural networks, as many loss functions involves non-smooth activation functions such as ReLU and leaky ReLU.
In our case, we need to justify the SDE approximation adopted in Section 3.
It turns out that strong approximation error can be obtained if
• the noise coefﬁcient σ is Lipschitz continuous and non-degenerate, and • the drift coefﬁcient b is piece-wise Lipschitz continuous, in the sense that b has ﬁnitely many discontinuity points −∞ = ξ 0 < ξ 1 < · · · < ξ m < ξ m +1 = ∞ and in each interval ( ξ i − 1 , ξ i ) , b is Lipschitz continuous.
Under these conditions, the following approximation result holds: for all k = 0 , 1 , 2 , · · · , N , there exists C > 0 such that
[Equation]
Here Θ kη is the solution to SDE at time kη .
The proof strategy closely follows from (M¨ullerGronbach et al., 2020).
The key is to construct a bijective mapping G : R → R that transforms (12) to SDE with Lipschitz continuous coefﬁcients.
With such a bijection G , one can deﬁne a stochastic process Z : [0 , T ] × Ω → R by Z t =
G (Θ t ) and the transformed SDE is
[Equation]
with ˜
[Equation]
=
[Equation]
and ˜ σ =
[Equation] [Equation]
As the SGD updates can essentially be viewed as data from the Euler-Maruyama scheme, considering Z k as updates from Euler-Maruyama scheme leads to
[Equation]
To control the second item, we introduce
[Equation]
where t ∈ [0 , kη ] .
Then as shown in (M¨uller-Gronbach et al., 2020),
[Equation]
with B being the set of pairs ( y 1 , y 2 ) ∈ R 2 where the joint Lipschitz estimate | b ( y 1 ) − b ( y 2 ) | does not apply due to at least one discontinuity.
In (M ¨ uller-Gronbach et al., 2020), it is estimated by
[Equation]
which leads us to (14).