Docsity

Insights into Neural Networks' Approximation & Generalization: Bounds, Lecture notes of Mathematical Statistics

Toggle sidebar
bg1
GEN ER AL IZ ATION BOUNDS FOR NEURAL NETWO RK S
1 IN TROD UCT ION
Hornik (1991) showed that neural networks with a single hidden layer and arbitrary bounded and
non-constant activation function are capable to approximate any continuous functions on compact
subsets of Rn.Besides their great approximation capabilities, neural networks also show great gen-
eralization ability on many tasks. However, a classical opinion is that a too capable model would
usually generalize poorly. A natural question to ask is that what is the generalization bound of neural
networks?
Thus, we study three generalization bounds for neural networks hoping to obtain more insights
about their generalization abilities. The three bounds that will be shown later are derived from
VC-dimension, PAC-Bayesian theorem and covering number respectively. In this paper we would
introduce the first two bounds in more detail and briefly present the third bound. To compare the
three bounds more conveniently, throughout this paper we only consider a L-layer neural network
with ReLU activations.
2 GE NER ALI ZATIO N BOUND D ERI VED F ROM VC -DIMENSION
From the fundamental theorem of concept learning, which gives a generalization bound based on
VC-dimension, one intuitive way to obtain a bound for neural networks is to find the VC-dimension
of the function class computed by them. Thus, in this section we first introduce some preliminar-
ies that we will use later. Then we present a generalization bound for neural networks based on
VC-dimension due to Bartlett et al. (2017b), which proved a nearly-tight VC-dimension bound for
networks with ReLU activations.
2.1 P REL IMI NARI ES
Definition 2.1. The growth function of F:X 7→ {−1,1}is defined as
Sm(F) := max
x1,...,xm∈X |{(f(x1), ..., f (xm)) : f∈ F}|.
The largest msuch that Sm(F)=2mis defined as the VC-dimension of F.
Theorem 2.1. Let f∈ F :X 7→ {−1,1}be the output of a concept learning algorithm, Lbe
the expected risk, ˆ
Lbe the empirical risk, nbe the number of training samples and V(F)be the
VC-dimension of a function class F.From the single version of the fundamental theorem of concept
learning we know that
L(f)≤ˆ
L(f) + e
O rV(F)
n!,
where we omit the term from McDiarmid inequality for simplicity.
Proof. The proof is based on the mismatched minimization lemma (Lemma 5.1) , the Rademacher
averages (Theorem 6.1.) and the Sauer-Shelah lemma (Lemma 7.2) introduced in class. See lecture
notes for the detailed proof.
2.2 G ENE RAL IZATIO N BOUN D
Lemma 2.2. Consider a neural network with ReLU activations, Llayers and Wparameters. Let
Fdenote all real-valued functions computed by the network. Let hidenote the number of units at
1
pf3
pf4
pf5

Partial preview of the text

Download Insights into Neural Networks' Approximation & Generalization: Bounds and more Lecture notes Mathematical Statistics in PDF only on Docsity!

GENERALIZATION BOUNDS FOR NEURAL NETWORKS

1 INTRODUCTION

Hornik (1991) showed that neural networks with a single hidden layer and arbitrary bounded and non-constant activation function are capable to approximate any continuous functions on compact subsets of Rn. Besides their great approximation capabilities, neural networks also show great gen- eralization ability on many tasks. However, a classical opinion is that a too capable model would usually generalize poorly. A natural question to ask is that what is the generalization bound of neural networks?

Thus, we study three generalization bounds for neural networks hoping to obtain more insights about their generalization abilities. The three bounds that will be shown later are derived from VC-dimension, PAC-Bayesian theorem and covering number respectively. In this paper we would introduce the first two bounds in more detail and briefly present the third bound. To compare the three bounds more conveniently, throughout this paper we only consider a L-layer neural network with ReLU activations.

2 GENERALIZATION BOUND DERIVED FROM VC-DIMENSION

From the fundamental theorem of concept learning, which gives a generalization bound based on VC-dimension, one intuitive way to obtain a bound for neural networks is to find the VC-dimension of the function class computed by them. Thus, in this section we first introduce some preliminar- ies that we will use later. Then we present a generalization bound for neural networks based on VC-dimension due to Bartlett et al. (2017b), which proved a nearly-tight VC-dimension bound for networks with ReLU activations.

2.1 PRELIMINARIES

Definition 2.1. The growth function of F : X 7 → {− 1 , 1 } is defined as

Sm(F) := max x 1 ,...,xm∈X

|{(f (x 1 ), ..., f (xm)) : f ∈ F}|.

The largest m such that Sm(F) = 2m^ is defined as the VC-dimension of F.

Theorem 2.1. Let f ∈ F : X 7 → {− 1 , 1 } be the output of a concept learning algorithm, L be

the expected risk, Lˆ be the empirical risk, n be the number of training samples and V (F) be the VC-dimension of a function class F. From the single version of the fundamental theorem of concept learning we know that

L(f ) ≤ Lˆ(f ) + O˜

V (F)

n

where we omit the term from McDiarmid inequality for simplicity.

Proof. The proof is based on the mismatched minimization lemma (Lemma 5.1) , the Rademacher averages (Theorem 6.1.) and the Sauer-Shelah lemma (Lemma 7.2) introduced in class. See lecture notes for the detailed proof.

2.2 GENERALIZATION BOUND

Lemma 2.2. Consider a neural network with ReLU activations, L layers and W parameters. Let F denote all real-valued functions computed by the network. Let hi denote the number of units at

the ith layer, U denote the total number of computation units and Wi denote the total number of parameters in all the layers up to layer i (i.e., in layers 1,2,...,i). Then, the growth function of F is bounded by

SV (F)(sgn(F)) ≤ 2 L

2 eV (F)

∑L

∑ i=1^ ihi Wi

)∑^ Wi

.

Proof. The proof is based on a bound on the growth function of a polynomially parameterized function class due to Goldberg & Jerrum (1995). See [Bartlett et al. (2017b)] for the detailed proof of this lemma.

Lemma 2.3. Suppose that 2 v^ ≤ (vr/w)w^ for some r ≥ 16 and v ≥ w ≥ 0. Then, v ≤ w log 2 (2r log 2 r).

Proof. It can be shown that if v > w log 2 (2r log 2 r) for any v ≥ w ≥ 0 and some r ≥ 16 , then 2 v^ > (vr/w)w. Thus, if 2 v^ ≤ (vr/w)w^ under the specified conditions, v ≤ w log 2 (2r log 2 r).

Theorem 2.4. Consider a neural network with ReLU activations, L layers and W parameters. Let F denote all real-valued functions computed by the network. Then, there exists a constant C such that V(F) ≤ C · W L log W.

Proof. By the definition of growth function of VC-dimension,

2 V^ (F)^ = SV (F)(sgn(F)).

According to Lemma 2.2. and the fact that L ≤

Wi and

hi = U, yield

2 V^ (F)^ = SV (F)(sgn(F))

≤ 2 L

2 eV (F)

∑L

∑ i=1^ ihi Wi

)∑^ Wi

(Lemma 2.2.)

4 eV (F)L

hi ∑ Wi

)∑^ Wi (L ≤

∑ Wi)

V (F) · 4 eLU ∑ Wi

)∑^ Wi (

∑ hi = U ).

Since LU ≥ 2 is usually the case for neural networks, this implies 4 eLU ≥ 16. Hence Lemma 2.3. gives

V (F) ≤

Wi log 2 (8eLU log 2 4 eLU )

= LW¯ log 2 (8eLU log 2 4 eLU ) = O( LW¯ log U ) (1) = O(LW log W ),

where L¯ := (^) W^1

∑L

i=1 Wi^ and is called^ effective depth^ or^ average depth.

Remark. By the definition of L,¯ it is always between 1 and L and it can capture how the pa- rameters are distributed in the network. For example, consider two networks both with three hidden layers. The numbers of hidden units of the first network are 1, 1 and 100 respectively,

then L¯ 1 = 1+(1+1)+(1+1+100) 102 ≈ 1. 03 ; The numbers of hidden units of the second network

are 100, 1 and 1 respectively, then L¯ 2 = 100+(100+1)+(100+1+1) 102 ≈ 2. 97. This shows that L¯ is close to 1 if parameters are concentrated near the output. Based on this observation and Eq. (1), V (F) ≤ O( LW¯ log U ), it implies that in a neural network nodes closer to the input have a larger effect in increasing the VC-dimension.

on F. The two-sided PAC-Bayesian theorem states that for any Q and a fixed P, with probability at least 1 − δ that

DKL

EQ[ Lˆ 0 (fQ)] || EQ[L 0 (fQ)]

DKL(Q||P ) + ln (^2) δn n − 1

where n denotes the sample size. This theorem implies that if DKL(Q||P ) is small, then

EQ[ Lˆ 0 (fQ)] is near EQ[L 0 (fQ)]. A one-sided version states that for any Q and a fixed P, with probability at least 1 − δ that

EQ[L 0 (fQ)] ≤ sup

 : DKL(EQ[ Lˆ 0 (fQ)] || ) ≤

DKL(Q||P ) + ln nδ n − 1

Proof. See [McAllester (2003)] for the proof.

Corollary 3.1.1. With the same setting in Theorem 3.1., for any Q and a fixed P, with probability at least 1 − δ that

EQ[L 0 (fQ)] ≤ EQ[ Lˆ 0 (fQ)] +

2 EQ Lˆ 0 (fQ) + ln nδ ) n − 1

2(DKL(Q||P ) + ln nδ ) n − 1

Proof. For q > p we have DKL(p||q) ≥ (q − p)^2 /(2q), which implies if DKL(p||q) ≤ x then q ≤ p +

2 px + 2x. Based on this, Eq. (5) is directly from Eq. (4).

Since the Q in Theorem 3.1. and Corollary 3.1.1. is a random variable, we can relate the PAC- Bayesian framework to the sharpness of neural networks by replacing it with the addition of a fixed w and a random variable u. Then we have the following theorem mentioned in [Neyshabur et al. (2017)].

Theorem 3.2. Let fw be any predictor learned from the training data and parametrized by fixed w. Consider the distribution over predictors of the form fw+u, where u is a random variable whose distribution may also depend on the training data. P is the prior distribution on the parameters that is independent of the training data. From the PAC-Bayesian Theorem 3.1., with probability at least 1 − δ, we have

Eu[L 0 (fw+u)] ≤ Eu[ Lˆ 0 (fw+u)] + 2

2(DKL(w + u||P ) + ln (^2) δn ) n − 1

Proof. This is directly from Corollary 3.1.1. and is a weaker form of it.

To turn the bound for the perturbed predictor fw+u in Theorem 3.2., to a bound that works for the unperturbed predictor fw, we need the following lemma.

Lemma 3.3. Let fw(x) : X 7 → Rk^ be any predictor with fixed parameters w, and P be any dis- tribution on the parameters that is independent of the training data. Then, for any γ, δ > 0 , with probability at least 1 − δ over the training set of size n, for any w, and any random perturbation u that satisfies Pu[maxx∈X |fw+u(x) − fw(x)|∞ < γ 4 ] ≥ 12 , we have

L 0 (fw) ≤ Lˆγ (fw) + 4

DKL(w + u||P ) + ln (^6) δn n − 1

Proof. See [Neyshabur et al. (2017)] for the proof.

3.3 GENERALIZATION BOUND

Neyshabur et al. (2017) proved a generalization bound for neural networks in a PAC-Bayesian frame- work that does not depend on the number of parameters in the network. The key of their proof is to apply Lemma 3.3. in the PAC-Bayesian framework. They first bound the KL divergence in the lemma by pre-defining the distribution of u and P. Then, they choose proper parameters for the two distributions u and P using the perturbation bound Lemma 3.4. such that it can satisfy the condition that Pu[maxx∈X |fw+u(x)−fw(x)|∞ < γ 4 ] ≥ 12 and therefore they can apply Lemma 3.3. to obtain a generalization bound for neural networks.

Thus, next we present a perturbation bound that bounds the change in the output of the network when the weights are perturbed, thereby bounds the sharpness of the network, in terms of the spectral norm of the layers. Then we use the perturbation bound Lemma 3.4. as well as the Lemma 3.3. to derive a generalization bound for neural networks.

Lemma 3.4. For any B, L > 0 , let fw : XB,n 7 → Rk^ be a L-layer neural network with ReLU activations. Then for any w, and x ∈ XB,n, and any perturbation u = vec({Ui})Li=1 such that ‖Ui‖ 2 ≤ (^) L^1 ‖Wi‖ 2 , the change in the output of the network can be bounded as follows:

|fw+u(x) − fw(x)| 2 ≤ eB

( L

i=

‖Wi‖ 2

∑^ L

i=

‖Ui‖ 2 ‖Wi‖ 2

Proof. Let’s define ∆i = |f (^) wi+u(x) − f (^) wi(x)| 2 for i from 0 to L, where f (^) wi denotes the output of layer i before activation given weights w. Thus ∆ 0 is the perturbation for the input x, which is zero since perturbation on weights will not influence inputs, and ∆L is the perturbation of the output of the neural networks; in other words, ∆L = |f (^) wL+u(x) − f (^) wL (x)| 2 = |fw+u(x) − fw(x)| 2. Then, by induction on ∆i, we obtain the upper bound of ∆L.

With Lemma 3.3. and Lemma 3.4. we can now present the following generalization bound for neural networks based on PAC-Bayesian theorem.

Theorem 3.5. For any B, L, h > 0 , let fw : XB,n 7 → Rk^ be a L-layer neural network with ReLU activations. Then, for any δ, γ > 0 , with probability ≥ 1 − δ over a training set of size n, for any w, we have

L 0 (fw) ≤ Lˆγ (fw) + O

B^2 L^2 h ln(Lh)

∏L

i=1 ‖Wi‖

2 2

∑L

i=

‖Wi‖^2 F ‖Wi‖^22 + ln^

Ln δ γ^2 n

Proof. Now, we first find a bound for the KL divergence in Lemma 3.3. by choosing the distribution of the prior P to be N (0, σ^2 I) and u ∼ N (0, σ^2 I) as well, where the value of σ will be determined later. Based on the fact that the KL-divergence between two Gaussian distributions with mean μ 1 , μ 2

and same variance σ^2 is (μ^1 −μ^2 )

2 2 σ^2 and^ w^ is fixed, we get the following bound:^ DKL(w^ +^ u||P^ )^ ≤ |w|^2 2 σ^2.^ Thus, if we can find a proper value for^ σ, then we can plugin it in the Lemma 3.3. and get a generalization bound for neural networks.

It is obvious that to apply Lemma 3.3., the σ should be chosen in a way that the condition Pu[maxx∈X |fw+u(x) − fw(x)|∞ < γ 4 ] ≥ 12 will be satisfied. Hence, next we choose the value of σ based on Lemma 3.4.

Let’s assume the spectral norm is equal across layers, i.e. for any layer i, ‖Wi‖ 2 = β. This can be assumed without loss of generality since using ReLU as the activation function, the output of a network will not change with weights to be normalized or not and therefore we can assume w.l.o.g. the norms are all equal to β. However, β here is related to the learned w of the predictor and σ is the parameter of the prior distributions. Since the prior cannot depend on the learned predictor, we

will set σ based on an approximation β,˜ which satisfies that |β − β˜| ≤ (^) L^1 β, and hence (^1) e βL−^1 ≤

β^ ˜L−^1 ≤ eβL−^1.

the bound not that useful since many deep neural networks are over-parameterized. However, one intermediate result from the proof of the VC-dimension of neural networks shows that nodes in the network contribute unevenly in increasing the VC-dimension of the network and nodes closer to the input would have a larger effect. Since the bound for the VC-dimension is nearly-tight, this might give us a insight that increasing the number of nodes of the early layers would increase the approximation ability of neural networks more significantly.

To obtain more meaningful bounds that do not depend on the number of parameters in the net- work, we then introduced two spectrally-normalized margin bounds. We observe that the term ∑L i=

‖Wi‖^2 F ‖Wi‖^22 in the second bound and the term^ (

∑L

i=1(^

‖Wi‖ 2 , 1 ‖Wi‖ 2 )

2 / (^3) ) 3 / (^2) in the third bound may sug-

gest that regularization on L 2 norm of weights might have limited influence on generalization since these two terms are relatively small compared with the product of the spectral norms. In addition,

the factor O( (^) γ^12 B^2

∏L

i=1 ‖Wi‖

2 2 )^ appears in both bounds. It may suggest that (1) data normaliza- tion could help generalization; (2) the product of the spectral norms of weight matrices could play an important role for generalization. This might indicate that although usually one would do L 1 or L 2 regularization when training neural networks, what we really need might be a regularization on the spectral norm of the weight matrices. Thus, it might be worth trying to develop some regulariza- tion technique based on the spectral norm to see if there will be improvements on the generalization ability of networks.

In conclusion, these bounds give us more insights about the neural networks and they help us to understand and interpret how neural networks work. Although these bounds cannot tell us everything about neural networks, we now at least know a little aspects about them instead of viewing them completely as black boxes. Maybe in future we could have a even tighter bound and then we might be able to better understand why neural networks are so powerful.

REFERENCES

Peter L Bartlett, Dylan J Foster, and Matus J Telgarsky. Spectrally-normalized margin bounds for neural networks. In Advances in Neural Information Processing Systems, pp. 6240–6249, 2017a.

Peter L Bartlett, Nick Harvey, Chris Liaw, and Abbas Mehrabian. Nearly-tight vc-dimension and pseudodimension bounds for piecewise linear neural networks. arXiv preprint arXiv:1703.02930, 2017b.

Paul W Goldberg and Mark R Jerrum. Bounding the vapnik-chervonenkis dimension of concept classes parameterized by real numbers. Machine Learning, 18(2-3):131–148, 1995.

Kurt Hornik. Approximation capabilities of multilayer feedforward networks. Neural networks, 4 (2):251–257, 1991.

David McAllester. Simplified pac-bayesian margin bounds, pp. 203–215. Lecture notes in computer science, 2003.

Behnam Neyshabur, Srinadh Bhojanapalli, and Nathan Srebro. A pac-bayesian approach to spectrally-normalized margin bounds for neural networks. arXiv preprint arXiv:1707.09564,

Joel A Tropp. User-friendly tail bounds for sums of random matrices. Foundations of computational mathematics, 12(4):389–434, 2012.