Deep Neural Networks with Random Gaussian Weights: A Universal Classification Strategy?

Raja Giryes, Guillermo Sapiro, Alex M. Bronstein

I Introduction

Deep neural networks (DNN) have led to a revolution in the areas of machine learning, audio analysis, and computer vision, achieving state-of-the-art results in numerous applications . In this work we formally study the properties of deep network architectures with random weights applied to data residing in a low dimensional manifold. Our results provide insights into the outstanding empirically observed performance of DNN, the role of training, and the size of the training data.

Our motivation for studying networks with random weights is twofold. First, a series of works empirically showed successful DNN learning techniques based on randomization. Second, studying a system with random weights rather than learned deterministic ones may lead to a better understanding of the system even in the deterministic case. For example, in the field of compressed sensing, where the goal is to recover a signal from a small number of its measurements, the study of random sampling operators led to breakthroughs in the understanding of the number of measurements required for achieving a stable reconstruction . While the bounds provided in this case are universally optimal, the introduction of a learning phase provides a better reconstruction performance as it adapts the system to the particular data at hand . In the field of information retrieval, random projections have been used for locality-sensitive hashing (LSH) scheme capable of alleviating the curse of dimensionality for approximate nearest neighbor search in very high dimensions . While the original randomized scheme is seldom used in practice due to the availability of data-specific metric learning algorithms, it has provided many fruitful insights. Other fields such as phase retrieval, gained significantly from a study based on random Gaussian weights .

Notice that the technique of proving results for deep learning with assumptions on some random distribution and then showing that the same holds in the more general case is not unique to our work. On the contrary, some of the stronger recent theoretical results on DNN follow this path. For example, Arora et al. analyzed the learning of autoencoders with random weights in the range $$, showing that it is possible to learn them in polynomial time under some restrictions on the depth of the network . Another example is the series of works that study the optimization perspective of DNN.

In a similar fashion, in this work we study the properties of deep networks under the assumption of random weights. Before we turn to describe our contribution, we survey previous studies that formally analyzed the role of deep networks.

Hornik et al. and Cybenko proved that neural networks serve as a universal approximation for any measurable Borel functions. However, finding the network weights for a given function was shown to be NP-hard.

Bruna and Mallat proposed the wavelet scattering transform– a cascade of wavelet transform convolutions with nonlinear modulus and averaging operators . They showed for this deep architecture that with more layers the resulting features can be made invariant to increasingly complex groups of transformations. The study of the wavelet scattering transform demonstrates that deeper architectures are able to better capture invariant properties of objects and scenes in images

Anselmi et al. showed that image representations invariant to transformations such as translations and scaling can considerably reduce the sample complexity of learning and that a deep architecture with filtering and pooling can learn such invariant representations . This result is particularly important in cases that training labels are scarce and in totally unsupervised learning regimes.

Montúfar and Morton showed that the depth of DNN allows representing restricted Boltzmann machines with a number of parameters exponentially greater than the number of the network parameters . Montúfar et al. suggest that each layer divides the space by a hyper-plane . Therefore, a deep network divides the space into an exponential number of sets, which is unachievable with a single layer with the same number of parameters.

As the former example teaches, the scaling of the data introduced by M{\bf{M}} may drastically deform the distances throughout each layer, even in the case where mm is very close to nn, which makes it unclear whether it is possible to recover the input of the network (or of each layer) from its output. In this work, the main question we focus on is: What happens to the metric of the input data throughout the network? We focus on the above mentioned setting, assuming that the network has random i.i.d. Gaussian weights. We prove that DNN preserve the metric structure of the data as it propagates along the layers, allowing for the stable recovery of the original data from the features calculated by the network.

This type of property is often encountered in the literature . Notice, however, that the recovery of the input is possible if the size of the network output is proportional to the intrinsic dimension of the data at the input (which is not the case at the very last layer of the network, where we have class labels only), similarly to data reconstruction from a small number of random projections . However, unlike random projections that preserve the Euclidean distances up to a small distortion , each layer of DNN with random weights distorts these distances proportionally to the angles between its input points: the smaller the angle at the input, the stronger the shrinkage of the distances. Therefore, the deeper the network, the stronger the shrinkage we get. Note that this does not contradict the fact that we can recover the input from the output; even when properties such as lighting, pose and location are removed from an image (up to certain extent), the resemblance to the original image is still maintained.

As random projection is a universal sampling strategy for any low dimensional data , deep networks with random weights are a universal system that separates any data (belonging to a low dimensional model) according to the angles between its points, where the general assumption is that there are large angles between different classes . As training of the projection matrix adapts it to better preserve specific distances over others, the training of a network prioritizes intra-class angles over inter-class ones. This relation is alluded by our proof techniques and is empirically manifested by observing the angles and the Euclidean distances at the output of trained networks, as demonstrated later in the paper in Section VI.

The rest of the paper is organized as follows: In Section II, we start by utilizing the recent theory of 1-bit compressed sensing to show that each DNN layer preserves the metric of its input data in the Gromov-Hausdorff sense up to a small constant δ\delta, under the assumption that these data reside in a low-dimensional manifold denoted by KK. This allows us to draw conclusions on the tessellation of the space created by each layer of the network and the relation between the operation of these layers and local sensitive hashing (LSH) . We also show that it is possible to retrieve the input of a layer, up to certain accuracy, from its output. This implies that every layer preserves the important information of the data.

In Section III, we proceed by analyzing the behavior of the Euclidean distances and angles in the data throughout the network. This section reveals an important effect of the ReLU. Without the ReLU, we would just have random projections and Euclidean distance preservation. Our theory shows that the addition of ReLU makes the system sensitive to the angles between points. We prove that networks tend to decrease the Euclidean distances between points with a small angle between them (“same class”), more than the distances between points with large angles between them (“different classes”).

Then, in Section IV we prove that low-dimensional data at the input remain such throughout the entire network, i.e., DNN (almost) do not increase the intrinsic dimension of the data. This property is used in Section V to deduce the size of data needed for training DNN.

We conclude by studying the role of training in Section VI. As random networks are blind to the data labels, training may select discriminatively the angles that cause the distance deformation. Therefore, it will cause distances between different classes to increase more than the distances within the same class. We demonstrate this in several simulations, some of which with networks that recently showed state-of-the-art performance on challenging datasets, e.g., the network by for the ImageNet dataset . Section VII concludes the paper by summarizing the main results and outlining future research directions.

It is worthwhile emphasizing that the assumption that classes are separated by large angles is common in the literature (see ). This assumption can further refer to some feature space rather than to the raw data space. Of course, some examples might be found that contradict this assumption such as the one of two concentric spheres, where each sphere represents a different class. With respect to such particular examples two things should be said: First, these cases are rare in real life signals, typically exhibiting some amount of scale invariance that is absent in this example. Second, we prove that the property of discrimination based on angles holds for DNN with random weights and conjecture in Section VI that a potential role (or consequence) of training in DNN is to favor certain angles over others and to select the origin of the coordinate system with respect to which the angles are calculated. We illustrate in Section VI the effect of training compared to random networks, using trained DNN that have achieved state-of-the-art results in the literature. Our claim is that DNN are suitable for models with clearly distinguishable angles between the classes if random weights are used, and for classes with some distinguishable angles between them if training is used.

For the sake of simplicity of the discussion and presentation clarity, we focus only on the role of the ReLU operator , assuming that our data are properly aligned, i.e., they are not invariant to operations such as rotation or translation, and therefore there is no need for the pooling operation to achieve invariance. Combining recent results for the phase retrieval problem with the proof techniques in this paper can lead to a theory also applicable to the pooling operation. In addition, with the strategy in , it is possible to generalize our guarantees to sub-Gaussian distributions and to random convolutional filters. We defer these natural extensions to future studies.

II Stable Embedding of a Single Layer

We assume that the input data belong to a manifold KK with the Gaussian mean width

where the expectation is taken over a random vector g{\bf g} with normal i.i.d. elements. To better understand this definition, note that sup⁡x,y∈K⟨g,x−y⟩\sup_{{\bf x},{\bf y}\in K}\langle{\bf g},{\bf x}-{\bf y}\rangle is the width of the set KK in the direction of g{\bf g} as illustrated in Fig. 1. The mean provides an average over the widths of the set KK in different isotropically distributed directions, leading to the definition of the Gaussian mean width ω(K)\omega(K).

The Gaussian mean width is a useful measure for the dimensionality of a set. As an example we consider the following two popular data models:

Sparsely representable signals

Similar results can be shown for other models such as union of subspaces and low dimensional manifolds. For more examples and details on ω(K)\omega(K), we refer the reader to .

We now show that each standard DNN layer performs a stable embedding of the data in the Gromov-Hausdorff sense , i.e., it is a δ\delta-isometry between (K,dK)(K,d_{K}) and (K′,dK′)(K^{\prime},d_{K^{\prime}}), where KK and K′K^{\prime} are the manifolds of the input and output data and dKd_{K} and dK′d_{K^{\prime}} are metrics induced on them. A function h:K→K′h:K\rightarrow K^{\prime} is a δ\delta-isometry if

with δ≤C m−1/6 ω1/3(K)\delta\leq C\,m^{-1/6}\,\omega^{1/3}(K).

Theorem 1 is important as it provides a better understanding of the tessellation of the space that each layer creates. This result stands in line with that suggested that each layer in the network creates a tessellation of the input data by the different hyper-planes imposed by the rows in M{\bf{M}}. However, Theorem 1 implies more than that. It implies that each cell in the tessellation has a diameter of at most δ\delta (see also Corollary 1.9 in ), i.e., if x{\bf{x}} and y{\bf{y}} fall to the same side of all the hyperplanes, then ∥x−y∥2≤δ\left\|{\bf{x}}-{\bf{y}}\right\|_{2}\leq\delta. In addition, the number of hyperplanes separating two points x{\bf{x}} and y{\bf{y}} in KK contains enough information to deduce their distance up to a small distortion. From this perspective, each layer followed by the sign function acts as locality-sensitive hashing , approximately embedding the input metric into the Hamming metric.

Having a stable embedding of the data, it is natural to assume that it is possible to recover the input of a layer from its output. Indeed, Mahendran and Vedaldi demonstrate that it is achievable through the whole network . The next result provides a theoretical justification for this, showing that it is possible to recover the input of each layer from its output:

Under the assumptions of Theorem 1 there exists a program A\mathcal{A} such that ∥x−A(f(Mx))∥2≤ϵ\left\|{\bf x}-\mathcal{A}(f({\bf M}{\bf x}))\right\|_{2}\leq\epsilon, where ϵ=O(ω(K)m)\epsilon=O\left(\frac{\omega(K)}{\sqrt{m}}\right).

The proof follows from Theorem 1.3 in . If KK is a cone then one may use also Theorem 2.1 in to get a similar result.

III Distance and Angle Distortion

So far we have focused on the metric preservation of the deep networks in terms of the Gromov-Hausdorff distance. In this section we turn to look at how the Euclidean distances and angles change within the layers. We focus on the case of ReLU as the activation function. A similar analysis can also be applied for pooling. For the simplicity of the discussion we defer it to future study.

Normalization, which is also useful in shallow representations , can be interpreted as a transformation making the inner products between the data vectors coincide with the cosines of the corresponding angles. While the bounds we provide in this section do not require normalization, they show that the operations of each layer rely on the angles between the data points.

where 0≤∠(x,y)≜cos⁡−1(xTy∥x∥2∥y∥2)≤π0\leq\angle({\bf{x}},{\bf{y}})\triangleq\cos^{-1}\left(\frac{{\bf{x}}^{T}{\bf{y}}}{\left\|{\bf{x}}\right\|_{2}\left\|{\bf{y}}\right\|_{2}}\right)\leq\pi and

We leave the proof of these theorems to Appendices A and B, and dwell on their implications.

Note that if ψ(x,y){\psi}({\bf{x}},{\bf{y}}) were equal to zero, then theorems 3 and 4 would have stated that the distances and angles are preserved (in the former case, up to a factor of 0.50.5More specifically, we would have ∥ρ(Mx)−ρ(My)∥22≅12∥x−y∥22\left\|\rho({\bf M}{\bf x})-\rho({\bf M}{\bf y})\right\|_{2}^{2}\cong\frac{1}{2}\left\|{\bf x}-{\bf y}\right\|_{2}^{2}. Notice that this is the expectation of the distance ∥ρ(Mx−My)∥22\left\|\rho({\bf M}{\bf x}-{\bf M}{\bf y})\right\|_{2}^{2}.) throughout the network. As can be seen in Fig. 2, ψ(x,y){\psi}({\bf{x}},{\bf{y}}) behaves approximately like 0.5(1−cos⁡∠(x,y))0.5(1-\cos\angle({\bf{x}},{\bf{y}})). The larger is the angle ∠(x,y)\angle({\bf{x}},{\bf{y}}), the larger is ψ(x,y){\psi}({\bf{x}},{\bf{y}}), and, consequently, also the Euclidean distance at the output. If the angle between x{\bf{x}} and y{\bf{y}} is close to zero (i.e., cos⁡∠(x,y)\cos\angle({\bf{x}},{\bf{y}}) close to 1), ψ(x,y){\psi}({\bf{x}},{\bf{y}}) vanishes and therefore the Euclidean distance shrinks by half throughout the layers of the network. We emphasize that this is not in contradiction to Theorem 1 which guarantees approximately isometric embedding into the Hamming space. While the binarized output with the Hamming metric approximately preserves the input metric, the Euclidean metric on the raw output is distorted.

Considering this effect on the Euclidean distance, the smaller the angle between x{\bf{x}} and y{\bf{y}}, the larger the distortion to this distance at the output of the layer, and the smaller the distance turns to be. On the other hand, the shrinkage of the distances is bounded as can be seen from the following corollary of Theorem 3.

Under the same conditions of Theorem 3, with high probability

The proof follows from the inequality of arithmetic and geometric means and the behavior of ψ(x,y){\psi}({\bf{x}},{\bf{y}}) (see Fig. 2). We conclude that DNN with random Gaussian weights preserve local structures in the manifold KK and enable decreasing distances between points away from it, a property much desired for classification.

The influence of the entire network on the angles is slightly different. Note that starting from the input of the second layer, all the vectors reside in the non-negative orthant. The cosine of the angles is translated from the range inthefirstlayertotherangein the first layer to the range in the subsequent second layers. In particular, the range $istranslatedtotherangeis translated to the range[0,1/\pi],andintermsoftheangle, and in terms of the angle\angle({\bf{x}},{\bf{y}})fromtherangefrom the range[\pi/2,\pi]toto[\cos^{-1}(1/\pi),\pi/2]$. These angles shrink approximately by half, while the ones that are initially small remain approximately unchanged.

The action of the network preserves the order between the angles. Generally speaking, the network affects the angles in the range [0,π/2][0,\pi/2] in the same way. In particular, in the range [0,π/4][0,\pi/4] the angles in the output of the layer behave like 0.95∠(x,y)0.95\angle({\bf{x}},{\bf{y}}) and in the wider range [0,π/2][0,\pi/2] they are bounded from below by 0.8∠(x,y)0.8\angle({\bf{x}},{\bf{y}}) (see Fig. 3). Therefore, we conclude that the DNN distort the angles in the input manifold KK similarly and keep the general configuration of angles between the points.

To see that our theory captures the behavior of DNN endowed with pooling, we test how the angles change through the state-of-the-art 1919-layers deep network trained in for the ImageNet dataset. We randomly select 3⋅1043\cdot 10^{4} angles (pairs of data points) in the input of the network, partitioned to three equally-sized groups, each group corresponding to a one of the ranges [0,π/4][0,\pi/4], [π/4,π/2][\pi/4,\pi/2] and [π/2,π][\pi/2,\pi]. We test their behavior after applying eight and sixteen non-linear layers. The latter case corresponds to the part of the network excluding the fully connected layers. We denote by xˉ\bar{\bf{x}} the vector in the output of a layer corresponding to the input vector x{\bf{x}}. Fig. 4 presents a histogram of the values of the angles ∠(xˉ,yˉ)\angle(\bar{\bf{x}},\bar{\bf{y}}) at the output of each of the layers for each of the three groups. It shows also the ratio ∠(xˉ,yˉ)/∠(x,y)\angle(\bar{\bf{x}},\bar{\bf{y}})/\angle({\bf{x}},{\bf{y}}) and difference ∠(xˉ,yˉ)−∠(x,y)\angle(\bar{\bf{x}},\bar{\bf{y}})-\angle({\bf{x}},{\bf{y}}), between the angles at the output of the layers and their original value at the input of the network.

As Theorem 4 predicts, the ratio ∠(xˉ,yˉ)/∠(x,y)\angle(\bar{{\bf{x}}},\bar{{\bf{y}}})/\angle({\bf{x}},{\bf{y}}) corresponding to ∠(x,y)∈[π/2,π]\angle({\bf{x}},{\bf{y}})\in[\pi/2,\pi] is half the ratio corresponding to input angles in the range [0,π/2][0,\pi/2]. Furthermore, the ratios in the ranges [0,π/4][0,\pi/4] and [π/4,π/2][\pi/4,\pi/2] are approximately the same, where in the range [π/4,π/2][\pi/4,\pi/2] they are slightly larger. This is in line with Theorem 4 that claim that the angles in this range decrease approximately in the same rate, where for larger angles the shrink is slightly larger. Also note that according to our theory the ratio corresponding to input angles in the range [0,π/4][0,\pi/4] should behave on average like 0.95q0.95^{q}, where qq is the number of layers. Indeed, for q=8q=8, 0.958=0.660.95^{8}=0.66 and for q=16q=16, 0.9516=0.440.95^{16}=0.44; the centers of the histograms for the range [0,π/4][0,\pi/4] are very close to these values. Notice that we have a similar behavior also for the range [π,π/2][\pi,\pi/2]. This is not surprising, as by looking at Fig. 3 one may observe that these angles also turn to be in the range that has the ratio 0.950.95. Remarkably, Fig. 4 demonstrates that the network keeps the order between the angles as Theorem 4 suggests. Notice that the shrinkage of the angles does not cause large angles to become smaller than other angles that were originally significantly smaller than them. Moreover, small angles in the input remain small in the output as can be seen in Fig. 4(right).

We sketch the distortion of two sets with distinguishable angle between them by one layer of DNN with random weights in Fig. 5. It can be observed that the distance between points with a smaller angle between them shrinks more than the distance between points with a larger angle between them. Ideally, we would like this behavior, causing points belonging to the same class to stay closer to each other in the output of the network, compared to points from different classes. However, random networks are not selective in this sense: if a point x{\bf{x}} forms the same angle with a point z{\bf z} from its class and with a point y{\bf y} from another class, then their distance will be distorted approximately by an equal amount. Moreover, the separation caused by the network is dependent on the setting of the coordinate system origin with respect to which the angles are calculated. The location of the origin is dependent on the bias terms b{\bf b} (in this case each layer is of the form ρ(Mx+b)\rho({\bf M}{\bf x}+{\bf b})), which are set to zero in the random networks here studied. These are learned by the training of the network, affecting the angles that cause the distortions of the Euclidean (and angular) distances. We demonstrate the effect of training in Section VI.

IV Embedding of the Entire Network

Proof: We divide the proof into two parts. In the first one, we consider the effect of the activation function ff on the size of the covering, while in the second we examine the effect of the linear transformation M{\bf{M}}. Starting with the activation function, let x0∈K{\bf{x}}_{0}\in K be a center of a ball in the covering of KK and x∈K{\bf{x}}\in K be a point that belongs to the ball of x0{\bf{x}}_{0} of radius ϵ\epsilon, i.e., ∥x−x0∥2≤ϵ\left\|{\bf{x}}-{\bf{x}}_{0}\right\|_{2}\leq\epsilon. It is not hard to see that since a semi-truncated linear activation function shrinks the data, then ∥f(x)−f(x0)∥2≤∥x−x0∥2≤ϵ\left\|f({\bf{x}})-f({\bf{x}}_{0})\right\|_{2}\leq\left\|{\bf{x}}-{\bf{x}}_{0}\right\|_{2}\leq\epsilon and therefore the size of the covering does not increase (but might decrease).

For the linear part we have that [49, Theorem 1.4]

Therefore, after the linear operation each covering ball with initial radius ϵ\epsilon is not bigger than (1+ω(K)m)ϵ(1+\frac{\omega(K)}{\sqrt{m}})\epsilon. Since the activation function does not increase the size of the covering, we have that after a linear operation followed by an activation function, the size of the covering balls increases by a factor of (1+ω(K)m)(1+\frac{\omega(K)}{\sqrt{m}}). Therefore, the size of a covering with balls of radius ϵ\epsilon of the output data f(MK)f({\bf{M}}K) is bounded by the size of a covering with balls of radius ϵ/(1+ω(K)m)\epsilon/(1+\frac{\omega(K)}{\sqrt{m}}). □\Box

Theorem 6 generalizes the results in theorems 2, 3 and 4 such that they can be used for the whole network: there exists an algorithm that recovers the input of the DNN from its output; the DNN as a whole distort the Euclidean distances based on the angels of the input of the network; and the angular distances smaller than π\pi are not altered significantly by the network.

As an implication of Theorem 6, consider low-dimensional data admitting a Gaussian mixture model (GMM) with LL Gaussians of dimension kk or a kk-sparse represention in a given dictionary with LL atoms. For GMM, the covering number is Nϵ(K)=L(1+2ϵ)kN_{\epsilon}(K)=L\left(1+\frac{2}{\epsilon}\right)^{k} for ϵ<1\epsilon<1 and 11 otherwise (see ). Therefore we have that ω(K)≤Ck+log⁡L\omega(K)\leq C\sqrt{k+\log{L}} and that at each layer the Gaussian mean width grows at most by a factor of 1+O(k+log⁡Lm)1+O\left(\frac{\sqrt{k}+\log{L}}{\sqrt{m}}\right). In the case of sparsely representable data, Nϵ(K)=(Lk)(1+2ϵ)kN_{\epsilon}(K)={L\choose k}\left(1+\frac{2}{\epsilon}\right)^{k}. By Stirling’s approximation we have (Lk)≤(eLk)k{L\choose k}\leq\left(\frac{eL}{k}\right)^{k} and therefore ω(K)≤Cklog⁡(L/k)\omega(K)\leq C\sqrt{k\log(L/k)}. Thus, at each layer the Gaussian mean width grows at most by a factor of 1+O(klog⁡(L/k)m)1+O\left(\frac{\sqrt{k\log(L/k)}}{\sqrt{m}}\right).

V Training Set Size

An important question in deep learning is what is the amount of labeled samples needed at training. Using Sudakov minoration , one can get an upper bound on the size of a covering of KK, Nϵ(K)N_{\epsilon}(K), which is the number of balls of radius ϵ\epsilon that include all the points in KK. We have demonstrated that networks with random Gaussian weights realize a stable embedding; consequently, if a network is trained using the screening technique by selecting the best among many networks generated with random weights as suggested in , then the number of data points needed in order to guarantee that the network represents all the data is O(exp⁡(ω(K)2/ϵ2))O(\exp(\omega(K)^{2}/\epsilon^{2})). Since ω(K)2\omega(K)^{2} is a proxy for the intrinsic data dimension as we have seen in the previous sections (see for more details), this bound formally predicts that the number of training points grows exponentially with the intrinsic dimension of the data.

The exponential dependency is too pessimistic, as it is often possible to achieve a better bound on the required training sample size. Indeed, the bound developed in requires much less samples. As the authors study the data recovery capability of an autoencoder, they assume that there exists a ‘ground-truth autoencoder’ generating the data. A combination of the data dimension bound here provided, with a prior on the relation of the data to a deep network, should lead to a better prediction of the number of needed training samples. In fact, we cannot refrain from drawing an analogy with the field of sparse representations of signals, where the combined use of the properties of the system with those of the input data led to works that improved the bounds beyond the naïve manifold covering number (see and references therein).

The following section presents such a combination, by showing empirically that the purpose of training in DNN is to treat boundary points. This observation is likely to lead to a significant reduction in the required size of the training data, and may also apply to active learning, where the training set is constructed adaptively.

VI The Role of Training

The proof of Theorem 3 provides us with an insight on the role of training. One key property of the Gaussian distribution, which allows it to keep the ratio between the angles in the data, is its rotational invariance. The phase of a random Gaussian vector with i.i.d. entries is a random vector with a uniform distribution. Therefore, it does not prioritize one direction in the manifold over the other but treats all the same, leading to the behavior of the angles and distances throughout the net that we have described above.

In general, points within the same class would have small angles within them and points from distinct classes would have larger ones. If this holds for all the points, then random Gaussian weights would be an ideal choice for the network parameters. However, as in practice this is rarely the case, an important role of the training would be to select in a smart way the separating hyper-planes induced by M{\bf{M}} in such a way that the angles between points from different classes are ‘penalized more’ than the angles between the points in the same class.

Theorem 3 and its proof provide some understanding of how this can be done by the learning process. Consider the expectation of the Euclidean distance between two points x{\bf{x}} and y{\bf{y}} at the output of a given layer. It reads as (the derivation appears in Appendix A)

Note that the integration in this formula is done uniformly over the interval [0,π−∠(x,y)][0,\pi-\angle({\bf{x}},{\bf{y}})], which contains the range of directions that have simultaneously positive inner products with x{\bf{x}} and y{\bf{y}}. With learning, we have the ability to pick the angle θ\theta that maximizes/minimizes the inner product based on whether x{\bf{x}} and y{\bf{y}} belong to the same class or to distinct classes and in this way increase/decrease their Euclidean distances at the output of the layer.

Optimizing over all the angles between all the pairs of the points is a hard problem. This explains why random initialization is a good choice for DNN. As it is hard to find the optimal configuration that separates the classes on the manifold, it is desirable to start with a universal one that treats most of the angles and distances well, and then to correct it in the locations that result in classification errors.

To validate this hypothesized behavior, we trained two DNN on the MNIST and CIFAR-10 datasets, each containing 1010 classes. The training of the networks was done using the matconvnet toolbox . The MNIST and CIFAR-10 networks were trained with four and five layers, respectively, followed by a softmax operation. We used the default settings provided by the toolbox for each dataset, where with CIFAR-10 we also used horizontal mirroring and 6464 filters in the first two layers instead of 3232 (which is the default in the example provided with the package) to improve performance. The trained DNN achieve 1%1\% and 18%18\% errors for MNIST and CIFAR-10 respectively.

For each data point we calculate its Euclidean and angular distances to its farthest intra-class point and to its closest inter-class point. We compute the ratio between the distances at the output of the last convolutional layer (the input of the fully connected layers) and the ones at the input. Let x{\bf{x}} be the point at the input, y{\bf{y}} be its farthest point from the same class, xˉ\bar{{\bf{x}}} be the point at the output, and zˉ\bar{{\bf{z}}} be its farthest point from the same class (it should not necessarily be the output of y{\bf{y}}), then we calculate ∥xˉ−zˉ∥2∥x−y∥2\frac{\left\|\bar{{\bf{x}}}-\bar{{\bf{z}}}\right\|_{2}}{\left\|{\bf{x}}-{\bf{y}}\right\|_{2}} for Euclidean distances and ∠(xˉ,zˉ)/∠(x,y)\angle(\bar{\bf{x}},\bar{\bf{z}})/\angle({\bf{x}},{\bf{y}}) for the angles. We do the same for the distances between different classes, comparing the shortest ones. Fig. 6 presents histograms of these distance ratios for CIFAR-10. In Fig. 7 we present the histograms of the differences of the Euclidean and angular distances, i.e., ∥xˉ−zˉ∥2−∥x−y∥2{\left\|\bar{{\bf{x}}}-\bar{{\bf{z}}}\right\|_{2}}-{\left\|{\bf{x}}-{\bf{y}}\right\|_{2}} and ∠(xˉ,zˉ)−∠(x,y)\angle(\bar{\bf{x}},\bar{\bf{z}})-\angle({\bf{x}},{\bf{y}}). We also compare the behavior of all the inter and intra-class distances by computing the above ratios for all pairs of points (x,y)({\bf{x}},{\bf{y}}) in the input with respect to their corresponding points (xˉ,yˉ)(\bar{\bf{x}},\bar{\bf{y}}) at the output. These ratios are presented in Fig. 8. We present also the differences ∥xˉ−yˉ∥2−∥x−y∥2{\left\|\bar{{\bf{x}}}-\bar{{\bf{y}}}\right\|_{2}}-{\left\|{\bf{x}}-{\bf{y}}\right\|_{2}} and ∠(xˉ,yˉ)−∠(x,y)\angle(\bar{\bf{x}},\bar{\bf{y}})-\angle({\bf{x}},{\bf{y}}) in Fig. 9. We present the results for three trained networks, in addition to the random one, denoted by Net1, Net2 and Net3. Each of them corresponds to a different amount of training epochs, resulting with a different classification error.

Considering the random DNN, note that all the histograms of the ratios are centered around 11 and the ones of the differences around , implying that the network preserves most of the distances as our theorems predict for a network with random weights. For the trained networks, the histograms over all data point pairs (Figs. 8 and 9) change only slightly due to training. Also observe that the trained networks behave like their random counterparts in keeping the distance of a randomly picked pair of points. However, they distort the distances between points on class boundaries “better” than the random network (Figs. 6 and 7), in the sense that the farthest intra class distances are shrunk with a larger factor than the ones of the random network, and the closest inter class distances are set farther apart by the training. Notice that the shrinking of the distances within the class and enlargement of the distances between the classes improves as the training proceeds. This confirms our hypothesis that a goal of training is to treat the boundary points.

A similar behavior can be observed for the angles. The closest angles are enlarged more in the trained network compared to the random one. However, enlarging the angles between classes also causes the enlargement of the angles within the classes. Notice though that these are enlarged less than the ones which are outside the class. Finally, observe that the enlargement of the angles, as we have seen in our theorems, causes a larger distortion in the Euclidean distances. Therefore, we may explain the enlargement of the distances in within the class as a means for shrinking the intra-class distances.

Similar behavior is observed for the MNIST dataset. However, the gaps between the random network and the trained network are smaller as the MNIST dataset contains data which are initially well separated. As we have argued above, for such manifolds the random network is already a good choice.

We also compared the behavior of the validation data, of the ImageNet dataset, in the network provided by and in the same network but with random weights. The results are presented in Figs. 10, 11, 12 and 13. Behavior similar to the one we observed in the case of CIFAR-10, is also manifested by the ImageNet network.

VII Discussion and Conclusion

We have shown that DNN with random Gaussian weights perform a stable embedding of the data, drawing a connection between the dimension of the features produced by the network that still keep the metric information of the original manifold, and the complexity of the data. The metric preservation property of the network provides a formal relationship between the complexity of the input data and the size of the required training set. Interestingly, follow-up studies found that adding metric preservation constraints to the training of networks also leads to a theoretical relation between the complexity of the data and the number of training samples. Moreover, this constraint is shown to improve in practice the generalization error, i.e., improves the classification results when only a small number of training examples is available.

While preserving the structure of the initial metric is important, it is vital to have the ability to distort some of the distances in order to deform the data in a way that the Euclidean distances represent more faithfully the similarity we would like to have between points from the same class. We proved that such an ability is inherent to the DNN architecture: the Euclidean distances of the input data are distorted throughout the networks based on the angles between the data points. Our results lead to the conclusion that DNN are universal classifiers for data based on the angles of the principal axis between the classes in the data. As these are not the angles we would like to work with in reality, the training of the DNN reveals the actual angles in the data. In fact, for some applications it is possible to use networks with random weights at the first layers for separating the points with distinguishable angles, followed by trained weights at the deeper layers for separating the remaining points. This is practiced in the extreme learning machines (ELM) techniques and our results provide a possible theoretical explanation for the success of this hybrid strategy.

Our work implies that it is possible to view DNN as a stagewise metric learning process, suggesting that it might be possible to replace the currently used layers with other metric learning algorithms, opening a new venue for semi-supervised DNN. This also stands in line with the recent literature on convolutional kernel methods (see ).

In addition, we observed that a potential main goal of the training of the network is to treat the class boundary points, while keeping the other distances approximately the same. This may lead to a new active learning strategy for deep learning .

Acknowledgments- Work partially supported by NSF, ONR, NGA, NSSEFF, and ARO. A.B. is supported by ERC StG 335491 (RAPID). The authors thank the reviewers of the manuscript for their suggestions which greatly improved the paper.

Appendix A Proof of Theorem 3

Before we turn to prove Theorem 3, we present two propositions that will aid us in its proof. The first is the Gaussian concentration bound that appears in [48, Equation 1.6].

Let g{\bf g} be an i.i.d. Gaussian random vector with zero mean and unit variance, and η\eta be a Lipschitz-continuous function with a Lipschitz constant cηc_{\eta}. Then for every α>0\alpha>0, with probability exceeding 1−2exp⁡(−α2/2cη)1-2\exp(-\alpha^{2}/2c_{\eta}),

Proof: First, notice that from the properties of the ReLU ρ\rho, it holds that

with probability exceeding (1−2exp⁡(−α2/4))(1-2\exp(-\alpha^{2}/4)). Clearly, (15) implies

where we set α=ω(K)\alpha=\omega(K). Combining (16) and (14) with the fact that

Dividing both sides by mm completes the proof. □\Box

Proof of Theorem 3: Our proof of Theorem 3 consists of three keys steps. In the first one, we show that the bound in (4) holds with high probability for any two points x,y∈K{\bf{x}},{\bf{y}}\in K. In the second, we pick an ϵ\epsilon-cover for KK and show that the same holds for each pair in the cover. The last generalizes the bound for any point in KK.

Bound for a pair x,y∈K{\bf{x}},{\bf{y}}\in K: Denoting by mi{\bf{m}}_{i} the ii-th column of M{\bf{M}}, we rewrite

Notice that since all the mi{\bf{m}}_{i} have the same distribution, the random variables (ρ(miTx)−ρ(miTy))2\left(\rho({\bf{m}}_{i}^{T}{\bf{x}})-\rho({\bf{m}}_{i}^{T}{\bf{y}})\right)^{2} are also equally-distributed. Therefore, our strategy would be to calculate the expectation of these random variables and then to show, using Bernstein’s inequality, that the mean of these random variables does not deviate much from their expectation.

We start by calculating their expectation

For calculating the first term at the right hand side (rhs) note that miTx{\bf{m}}_{i}^{T}{\bf{x}} is a random Gaussian vector with variance ∥x∥22/m\left\|{\bf{x}}\right\|_{2}^{2}/m. Therefore, from the symmetry of the Gaussian distribution we have that

Having the expectation of all the terms in (19) calculated, we define the following random variable, which is the difference between (ρ(miTx)−ρ(miTy))2\left(\rho({\bf{m}}_{i}^{T}{\bf{x}})-\rho({\bf{m}}_{i}^{T}{\bf{y}})\right)^{2} and its expectation,

Clearly, the random variable ziz_{i} is zero-mean. To finish the first step of the proof, it remains to show that the sum ∑i=1mzi\sum_{i=1}^{m}z_{i} does not deviate much from zero (its mean). First, note that

and therefore it is enough to bound the term on the rhs of (23). By Bernstein’s inequality, we have

The type of formula in (25), which is similar to the one in (21), provides an insight into the role of training. As random layers ‘integrate uniformly’ on the interval [0,π−∠(x,y)][0,\pi-\angle({\bf{x}},{\bf{y}})], learning picks the angle θ\theta that maximizes/minimizes the inner product based on whether x{\bf{x}} and y{\bf{y}} belong to the same class or to distinct classes.

where we included the probability of Proposition 8 in the above bound. Since by the assumption of the theorem m=O(δ−4ω(K)4)m=O(\delta^{-4}\omega(K)^{4}), we can write

Bound for all x,y∈Nϵ(K){\bf{x}},{\bf{y}}\in N_{\epsilon}(K): Let Nϵ(K)N_{\epsilon}(K) be an ϵ\epsilon cover for KK. By using a union bound we have that for every pair in Nϵ(K)N_{\epsilon}(K),

By Sudakov’s inequality we have log⁡∣Nϵ(K)∣≤cϵ−2w(K)2\log\left|N_{\epsilon}(K)\right|\leq c\epsilon^{-2}w(K)^{2}. Plugging this inequality into (28) leads to

Setting ϵ≥150δ\epsilon\geq\frac{1}{50}\delta, we have by the assumption m≥Cδ−4ω(K)2m\geq C\delta^{-4}\omega(K)^{2} that the term in the exponent at the rhs of (29) is negative and therefore the probability decays exponentially as mm increases.

Appendix B Proof of Theorem 4

Proof: Instead of proving Theorem 4 directly, we deduce it from Theorem 3. First we notice that (4) is equivalent to

As E∥ρ(Mx)∥22=12∥x∥22E\left\|\rho({\bf M}{\bf x})\right\|_{2}^{2}=\frac{1}{2}\left\|{\bf{x}}\right\|_{2}^{2}, we also have that with high probability (like the one in Theorem 3),

(The proof is very similar to the one of Theorem 3). Applying the reverse triangle inequality to (30) and then using (31), followed by dividing both sides by ∥x∥2∥y∥22\frac{\left\|{\bf{x}}\right\|_{2}\left\|{\bf{y}}\right\|_{2}}{2}, lead to

Using the reverse triangle inequality with (32) leads to

To complete the proof it remains to bound the rhs of (33). For the second term in it, we have

Dividing by (∥ρ(Mx)∥2+12∥x∥2)∥ρ(Mx)∥2\left(\left\|\rho({\bf{M}}{\bf{x}})\right\|_{2}+\frac{1}{\sqrt{2}}\left\|{\bf{x}}\right\|_{2}\right)\left\|\rho({\bf{M}}{\bf{x}})\right\|_{2} both sides of (31) and then using (35) and the fact that ∥x∥2≥β\left\|{\bf{x}}\right\|_{2}\geq\beta, provide

where the last inequality is due to simple arithmetics. Using the triangle inequality and then the fact that the inequality in (36) holds ∀x∈K\forall{\bf{x}}\in K, we have

Plugging (38) and (37) into (34) and then the outcome into (33) lead to the bound (1+3δβ2)3δβ2−2δ+3δβ2≤15δβ2−2δ\left(1+\frac{3\delta}{\beta^{2}}\right)\frac{3\delta}{\beta^{2}-2\delta}+\frac{3\delta}{\beta^{2}}\leq\frac{15\delta}{\beta^{2}-2\delta} □\Box

References