P ROVABLE G UARANTEES ON L EARNING H IERARCHICAL G ENERATIVE M ODELS WITH D EEP CNN S
Anonymous authors
Paper under double-blind review
A BSTRACT
Learning deep networks is computationally hard in the general case.
To show any positive theoretical results, one must make assumptions on the data distribution.
Current theoretical works often make assumptions that are very far from describing real data, like sampling from Gaussian distribution or linear separability of the data.
We describe an algorithm that learns convolutional neural network, assuming the data is sampled from a deep generative model that generates images level by level, where lower resolution images correspond to latent semantic classes.
We analyze the convergence rate of our algorithm assuming the data is indeed generated according to this model (as well as additional assumptions).
While we do not pretend to claim that the assumptions are realistic for natural images, we do believe that they capture some true properties of real data.
Furthermore, we show that on CIFAR-10, the algorithm we analyze achieves results in the same ballpark with vanilla convolutional neural networks that are trained with SGD.
I NTRODUCTION
The success of deep convolutional neural networks (CNN) has sparked many works trying to understand their behavior.
As various theoretical studies have shown, learning deep networks is computationally hard in the general case, when no assumptions on the distribution of the data are taken (see for example Livni et al.
In practice, learning CNNs is done successfully using simple gradient-based optimization algorithms like SGD.
Hence, to provide a theoretical analysis that will explain the practical success of deep learning, one must make assumptions on the distribution of the learned data.
Currently, theoretical works in the literature of deep learning make rather strong assumptions, that clearly do not capture the properties of natural data.
For example, many works assume that the examples are sampled from a Gaussian distribution, an assumption that is very far from describing distributions on natural images.
Other works assume linear separability of the data, which clearly does not hold for any rich enough dataset.
In this work, we assume the data is generated from a deep generative model.
According to this model, the examples are generated in a hierarchical manner: each example (image) is generated by ﬁrst drawing a high-level semantic image, and iteratively reﬁning the image, each time generating a lower-level image based on the higher-level semantics from the previous step.
Similar models were suggested in other works as good descriptions of natural images encountered in real world data.
While we do not claim that natural images actually come from such distribution, we believe that it captures some key properties of real world data.
Importantly, the problem we study is not trivially learned by simple “shallow” learning algorithms.
Our work analyzes the training of a CNN on data from this generative distribution.
In a shallow case, where the generative model has only two levels of hierarchy, we analyze the behavior of standard gradient-descent.
In the deep case, where our model can have many levels of hierarchy, we analyze a layerwise optimization algorithm, proving its convergence under the assumed generative model (as well as additional, admittedly strong, assumptions).
The algorithm we analyze is somewhat different than optimization algorithms that are commonly used in practice, and may seem “tailored” to solve the problem of learning our generative heirarchical model.
We show that implementing this algorithm to learn real-world data (CIFAR-10 dataset) achieves performance that are in the same ballpark as a vanilla CNN trained with SGD-based optimizer.
This result hints that our model and algorithm indeed capture properties of distributions and algorithms that are common in practice.
R ELATED W ORK
Any theoretical work that aims to give positive results on learning deep networks must make assumptions on the data distribution and on the learning algorithm.
We can roughly divide such works into three categories: (1) works that study practical algorithms (SGD) solving “simple” problems that can be otherwise learned with “shallow” algorithms.
(2) works that study problems with less restrictive assumptions, but using algorithms that are not applicable in practice.
(3) works that study a generative model similar to ours, but either give no theoretical guarantees, or otherwise analyze an algorithms that are not applicable for learning CNNs on image data.
Trying to study a practically useful algorithm, Daniely (2017) proves that SGD learns a function that approximates the best function in the conjugate kernel space derived from the network architecture.
Although this work provides guarantees for a wide range of deep architectures, there is no empirical evidence that the best function in the conjugate kernel space performs at the same ballpark as CNNs.
The work of Andoni et al.
(2014) shows guarantees on learning low-degree polynomials, which is learnable via SVM or direct feature mapping.
Other works study shallow (one-hidden-layer) networks under some signiﬁcant assumptions.
The works of Gori & Tesi (1992); Brutzkus et al.
(2017) study the convergence of SGD trained on linearly separable data, which could be learned with the Perceptron algorithm, and the works of Brutzkus & Globerson (2017); Tian (2017);
Li &
Yuan (2017); Zhong et al.
(2017) assume that the data is generated from Gaussian distribution, an assumption that clearly does not hold in real-world data.
The work of Du et al.
(2017) extends the results in Brutzkus & Globerson (2017), showing recovery of convolutional kernels without assuming Gaussian distribution, but is still limited to the regime of shallow two-layer network.
Another line of work aims to analyze the learning of deep architectures, in cases that exceed the capacity of shallow learning.
The works of Livni et al.
; Zhang et al.
(2015; 2016a) show polynomial-time algorithms aimed at learning deep models, but that seem far from performing well in practice.
The work of Zhang et al.
(2016b) analyses a method of learning a model similar to CNN which can be applied to learn multi-layer networks, but the analysis is limited to shallow two-layer settings, when the formulated problem is convex.
Finally, there have been a few works suggesting distributional assumptions on the data that are similar in spirit to the generative model that we analyze in this paper.
Again, these works can be largely categorized into two classes: works that provide algorithms that have theoretical guarantees but are not applicable for learning CNNs, and works that show practical results without theoretical guarantees.
The work of Arora et al.
(2014) shows a provably efﬁcient algorithm for learning a deep representation, but this algorithm seems far from capturing the behavior of algorithms used in practice.
Our approach can be seen as an extension of the work of Mossel (2016), who studies
Hierarchal Generative Models, focusing on algorithms and models that are applicable to biological data.
Mossel (2016) suggests that similar models may be used to deﬁne image reﬁnement processes, and our work shows that this is indeed the case, while providing both theoretical proofs and empirical evidence to this claim.
Finally, the works of Tang et al.
; Patel et al.
(2016); Van den Oord &
Schrauwen (2014) study generative models similar to ours, with promising empirical results when implementing EM inspired algorithms, but giving no theoretical foundations whatsoever.
D ISTRIBUTIONAL A SSUMPTIONS
In this paper, we are concerned with the problem of learning binary classiﬁcation of images.
Assume we are given a sample S
=
{ ( X 1 , y 1 ) , . . .
, ( X n , y n ) } from some distribution D on R m × m × Y , where Y = {± 1 } is our labels.
We wish to learn a CNN model that will classify the images correctly.
As noted, if we hope to give any guarantees on the success of learning such model, we must make strong assumptions on the distribution D .
One naive assumption on D is that it is linearly separable: there exists W ∗ ∈ R m × m such that y (cid:104) W ∗ , X (cid:105) ≥ 1 for ( X , y ) ∼ D , where we denote (cid:104) A , B (cid:105) =
tr( A (cid:62) B ) .
Clearly, such assumption does not hold for any rich enough distribution of natural images (as linear classiﬁers give poor results on natural image datasets).
To provide a more realistic assumption, we will instead assume the following:
Assumption 1 The images in D are generated from a latent distribution G 0 , such that G 0 is linearly separable.
(cid:32)
X (0) ∈C 5 × 4(cid:32)
X (1) ∈C 10 × 8(cid:32) · · · (cid:32)
X ∈ R 640 ×(cid:32) U { , , , . . . }
C
= { , , , , , . . .
} , C 1 = { , , , . . . }
Thus, sampling an image ( X , y ) ∼ D is equivalent to sampling a latent representation ( X (0) , y ) ∼
G 0 , and then sampling ( X , y ) ∼ G X (0) , where G X (0) is a distribution dependent on X (0) .
Note that in this case, the distribution D can be very complex, although the images sampled from it have a latent representation that is relatively simple.
To give a concrete description of the latent representation, we will assume that G 0 is a distribution over “semantic images”: images where each “pixel” represents a semantic class.
Formally, we will assume that X (0) ∈
C m 0 × m 0, where C 0 is some ﬁnite set of “semantic classes”.
Now, we want to describe the generative process of generating the image X from the semantic representation X (0) .
This process is done in a hierarchical manner:
Given the high-level semantic representation X (0) , where each “pixel” represents a semantic class (for example, background, sky, grass etc.), we generate a lower level image X (1) , where each patch comes from a distribution depending on each “pixel” of the high-level representation, generating a larger semantic image (lower level semantic classes for natural images could be: edges, corners, texture etc.).
We can repeat this process iteratively any number of times, each time creating a larger image of lower level semantic classes, thus generating a sequence of increasingly large semantic images X (0) , X (1) , . . .
, X ( d ) .
Since D is a distribution over greyscale images, we will assume that the last iteration of this process samples patches over R , i.e X = X ( d ) ∈ R m × m .
This model is described schematically in ﬁgure 1, with a formal description given in section 3.1.
In section 3.2 we describe a synthetic example of digit images generated according to this model.
3. F ORMAL D ESCRIPTION
Here, we will give a detailed description of the generative process described above.
To generate an example, we start by sampling the label y ∼ U ( Y ) , where U ( Y ) is the uniform distribution over the set of labels.
Given y , we generate a small image with m 0 × m 0 pixels, where each pixel belongs to a set C 0 .
Elements of C 0 corresponds to semantic entities (e.g. “sky”, “grass”, etc.).
The generated image, denoted X (0)
∈ C m 0 × m 0, is sampled according to some simple distribution D y .
Next, we generate a new image X (1) ∈
C m 0 s × m 0 sas follows.
Pixel i in X (0) corresponds to some c ∈ C 0 .
For every such c , let D c be the uniform distribution over a ﬁnite set of patches S (0) c ⊂ C s × s, where we refer to s as a “patch size”. We assume the following:
{+Assumption 
 The+} sets { S (0) c } c ∈C 0 are disjoint, and each one is of size k .
So, pixel i in X (0) whose value is c ∈ C 0 generates a patch of size s in X (1) by sampling the patch according to D c .
This process continues, yielding images X (2) , . . .
, X ( d ) whose sizes are m 0 s 2 × m 0 s 2 , . .
, m
s d × m 0 s d .
Each pixel in level i comes from C i , and each patch comes from S ( i − 1) c for some c ∈ C
i − 1 .
We assume that C d = R , so the ﬁnal image is over the reals.
The observed example is the pair ( X ( d ) , y ) .
We denote the distribution generating the image of level i by G i .
As noted, we assume that G 0 , the distribution that generates the high-level semantic images, is linearly separable.
As G 0 is a distribution over semantic images, i.e over C m ×
m× Y , we need to deﬁne what “linear separability” means in this case.
To do this, we assign to the i -th class in C 0 the unit vector e
i ∈
R
|C 0 | .
Then we represent X ∈ C m × mwith an equivalent tensor X ∈ R |C
|× m × m , and deﬁne linear separability with respect to the tensor representation.
Namely, there exists W ∗ such that for ( X , y ) ∼ G 0 it holds that y (cid:104) X , W ∗ (cid:105) ≥ 1 , where (cid:104) X , W ∗ (cid:105) :
= (cid:80) i,j,k X i,j,k · W ∗ i,j,k .
Notice that our semantic classes partition the patches in the image into disjoint sets.
There are various ways to partition the patches, some of which might in fact generate the same distribution.
For the analysis, we add an assumption that ensures that the semantic classes deﬁned in the model are different enough from each other.
We identify each class with a matrix that captures the frequency of its appearance in the image, with respect to the label of the image.
For this, we deﬁne the “labeled frequency matrix” of class c ∈ C i to be the matrix F c ∈ R m
s i × m
s i deﬁned as follows: for every c we denote by I c the operator that takes a matrix as its input and replaces every element of the input by the boolean that indicates whether it equals to c .
Then, we deﬁne: F c :=
E
( Z ,y ) ∼G i
[ y I c
( Z )] .
Notice that F c is the “mean” image over the distribution for every given semantic class c .
For example, semantic classes that tend to appear in the upper-left corner of the image for positive images will have positive values in the upper-left entries of F c .
We now assume: Assumption 3 The vectors { F c } c ∈C i are linearly independent in pairs.
For each c 1 , c 2 ∈ C i we denote the angle between F c 1 and F c 2 by: ∠ ( F c 1 , F c 2 ) :
= arccos (cid:16) (cid:104) F c 1 F c 2 (cid:105) (cid:107) F c 1 (cid:107) F (cid:107) F c 2 (cid:107) F (cid:17) .
Denote θ := min
i,c 1 ,c 2 ∈C i ∠ ( F c 1 , F c 2 ) and λ := min i,c ∈C i (cid:107) F c (cid:107) F .
From the linear independence assumption it follows that both θ and λ are strictly positive.
The runtime of the algorithms described in the next sections depend on 1 /θ and 1 /λ .
3. S YNTHETIC D IGITS E XAMPLE
To demonstrate our generative model, we use a small synthetic example to generate images of digits.
In this case, we use a three levels model, where semantic classes represent lines, corners etc.
In the notations above, we use:
{+C 
+}
= { , , , , , , , , } , C 1 = { , , , , , } , C 2 = R We deﬁne D even , D odd to be the uniform distributions over the even/odd digital representations:
D even =
U { , , , , } , D odd =
U { , , , , }
Now, in the second level of the generative model, each pixel in C 0 can generate one of four possible manifestations.
For example, for the pixel , we sample over: , , , .
Similarly, in the ﬁnal level we sample for each c ∈ C 1 from a distribution D c supported overelements.
For example, for the pixel , we sample over: , , , .
Notice that though this example is extremely simplistic, it can generate 4 9 examples per digit in the ﬁrst level, and 4 90 examples for each digit in the ﬁnal layer, amounting to 9 · 4 90 ≈ 1 .
38 · 10different examples.
Figure 2 shows the process output.
3. L INEAR S EPARABILITY
While the generative model described above seems complex, one might wonder whether this model, along with all the distributional assumptions given so far, is in fact an overly complicated fashion to describe a rather simple problem.
While generally speaking, it is not clear how to measure the “complexity” of the suggested distribution, we can at least address the question of whether this distribution is linearly separable or not.
It is immediate to show that when all the generated patches are orthogonal to each other, this distribution becomes linearly separable.
We analyze this case in the next section, and prove some results in this simplistic case. On the other hand, when such assumption is not taken, we argue that the model is typically far from being linearly separable. To show this, we generate examples using this Experiment θ λ
Linear
CNN
Ours k =0.
k
=1.
k =1.
generative distribution, where the generated patches are chosen randomly.
Recall that learning a linear separator is a convex problem.
Therefore, if the generated data was linearly separable, ﬁnding such a separator would be trivial, using the SGD algorithm.
Figure 3 shows the accuracy of the linear classiﬁer, compared to the performance of a simple CNN and our algorithm.
As is clear from these results, a linear separator achieves very poor results on this data.
Furthermore, to show that the generated distribution does not break Assumption 3, we show the values of θ and λ , as measured on the generated data.
The exact details of the experiment are given in appendix D.
T WO -L EVEL M ODEL
As a warm-up, we ﬁrst limit ourselves to observing distributions with only two levels in the hierarchy.
Hence, the process of generating examples is simply: (cid:32) G 0 ( X (0) , y ) (cid:32) G 1 ( X (1) , y ) .
Furthermore, in this section we add an important assumption on the data distribution:
Assumption 4 The set of patches that compose the images generated by G 1 is orthonormal.
Recall that we denoted S (0) c ⊂ C s × sthe set of patches that are sampled for each pixel of class c .
Our assumption means that ∀ P 1 , P 2 ∈ { S (0) c } c ∈C 0 we have (cid:104) P 1 , P 2 (cid:105) = 1 P 1 = P 2 .
Notice that this assumption implies the following lemma:
Lemma 1 Given assumptions 1, 2, 4, G 1 is linearly separable with margin √ k (cid:107) W ∗ (cid:107) , where W ∗ is the linear separator of G 0 (see section 3.1).
Consequently, running linear SVM ﬁnds a classiﬁer with zero classiﬁcation loss on this distribution in O ( k (cid:107) W ∗ (cid:107) 2 ) iterations.
While usually in classiﬁcation problems our goal is to minimize the training loss, in this case we would like to ﬁnd an algorithm that instead recovers the latent representation X (0) given the raw image
X (1) .
The reasons for this requirement will become clear in the next section.
We will prove that training a two layer linear CNN with gradient-descent (GD) on distribution G 1 implicitly recovers the latent representation, even if G 0 is not linearly separable.
Note that this is a rather surprising result, as we are only observing ( X (1) , y ) , and have no access to the latent representation
X (0) .
The following section will give the details of this result: in section 4.1 we describe the details of the GD algorithm, and in section 4.2 we describe the theoretical analysis of this algorithm.
4. A LGORITHM : GD ON T WO -L AYER CNN
Recall that for ( X , y ) ∼ G 1 , X is an image of size sm 0 ×
sm 0 , that is composed of s × s patches generated from a high-level semantic image of size m 0 × m 0 .
To simplify notation, we consider
X to be “reshaped” such that each column is a patch in the original image (the so called “im2col” operation), so X ∈ R s 2 × m 20 .
Given K ∈ R s 2 × n , W ∈ R m 20 × n , we deﬁne a convolutional subnet to be a function N K , W : R s 2 × m
→ R such that: N K , W ( X ) =
(cid:104) W (cid:62) , K (cid:62) X (cid:105) .
This is equivalent to a convolution operation on an image, followed by a linear weighted sum: multiplying X by K (cid:62) is equivalent to performing a non-overlapping convolution operation with kernels k 1 , . . .
, k n on the original image (where k i is the i -th vector of matrix K ).
Flattening the resulting matrix and multiplying by the weights in W yields the second linear layer.
The top linear layer of the network outputs a prediction for the label y ∈ Y .
The network is trained with respect to the loss L S K , W on a given set of examples S , deﬁned as the expected value of some label dependent loss function (cid:96)
y :
[Equation]
For the analysis, we use the loss (cid:96) y
(ˆ y )
= − y
ˆ
y .
This loss simpliﬁes the analysis, and seems to capture a similar behavior to other loss types used in practice.
Although in practice we perform a variant of SGD on a sample of the data to train the network, we perform the analysis with respect to the population loss: L K , W = E
( X ,y ) ∼G [ (cid:96) y
( N K , W ( X ))] .
We denote K t the weights of the ﬁrst layer of the network in iteration t , and denote W
the initial weights of the second layer.
For simplicity of the analysis, we assume that only the ﬁrst layer of the network is trained, while the weights of the second layer are ﬁxed.
Thus, we perform the following update step at each iteration of the gradient descent: K t =
K t − 1 − η ∂∂ K L K t − 1 , W 0 .
We initialize W 0 ∼ N (0 , 1) and each n -dimensional column of K 0 is sampled from the uniform distribution on the sphere of radius σ 2 √ n , where σ is a parameter of the algorithm.
4. T HEORETICAL A NALYSIS
In this section, we will consider a more general case, where we do not assume that G 0 is linearly separable (Assumption 1).
As noted, our main claim in this section is that training the two-layer Conv net implicitly recovers the latent semantic representation of the image.
Speciﬁcally, we show that gradient-descent ﬁnds an embedding of the observed patches into a space such that patches from the same semantic class are close to each other, while patches from different classes are far.
Note that this property is indeed enough to recover the latent representation, as running a trivial clustering algorithm on the embedded patches would reconstruct the latent image.
Recall that we do not have access to the latent distribution, and thus cannot possibly learn such embedding directly.
This surprising property of gradient descent is the key feature that allows our main algorithm (described in the next section) to learn the high-level semantics of the images.
Our claim is given in the following theorem:
Theorem 1 Suppose that assumptions 2, 3, 4 hold.
Let θ, λ as described in section 3.1.
Assume we train a two-layer network of size n > 2 π 0 .
23 θ log( |C| δ ) with respect to the population loss on distribution G 1 , with learning rate η , for T > ( γ +2 σ ) k ηλ iterations, for some γ > 0 .
Assume that the training is as described in section 4.1, where the parameter σ of the initialization is also described there.
Then with probability of at least 1 − δ :
for each c ∈ C 0 , for every x 1 , x 2 ∈ S (0) c we get (cid:107) K (cid:62) T · x 1 − K (cid:62) T · x 2 (cid:107) <
σ 2.
for c 1 , c 2 ∈ C 0 , if c 1 (cid:54) =
c 2 , for every x 1 ∈ S (0) c 1 , x 2 ∈ S (0) c 2 , we get (cid:107) K (cid:62) T · x 1 − K (cid:62) T · x 2 (cid:107) > γ
We give a similar analysis for the SGD algorithm in appendix B.
D EEP M ODEL
Now, assume we are given data from a deep generative distribution as described in section 3 (with d ≥ 2 ), and our goal is to learn a classiﬁer that predicts the label for each image.
A reasonable approach, given the properties of the above distribution, would be to try to infer from the raw image the higher-level semantic representations.
If given an example ( X , y ) we succeed to infer the sequence that generated it, X (0) , X (1) , . . .
, X ( d ) , we could then use SVM on the high-level representation, and learn to infer its label.
Given the results of the previous section, we can recover these semantic representations by training a two-layer Conv net and applying a trivial clustering on the resulting patches.
Note that in general we do not assume that all the patches are orthogonal (Assumption 4), as such a property will make the whole model linearly separable.
Thus, to apply the results of section 4.2, we would use the clustering algorithm both for standard clustering and also as an “orthogonalization” step, that will map different clusters to orthonormal vectors.
We next describe in details the full algorithm (section 5.1), and show that it ﬁnds a network that achieves zero loss in polynomial time (section 5.2).
5. A LGORITHM D ESCRIPTION
The algorithm we suggest is built from three building-blocks composed together to construct the full algorithm: (1) clustering algorithm, (2) gradient-based optimization of two-layer Conv net and (3) a simple classiﬁcation algorithm.
In order to expose the latent representation of each layer in the generative model, we perform the following iteratively:
(1) Run a k-means algorithm on patches of size s × s from the input images deﬁned by the previous step (or the original images in the ﬁrst step), w.r.t.
the cosine distance, to get k
i cluster centers.
(2) Run a convolution operation with the cluster centroids as kernels, followed by ReLU with a ﬁxed bias and a pooling operation.
This will result in mapping the patches in the input images to approximately) orthogonal vectors in an intermediate space R k i .
(3) Initialize a 1x1 convolution operation, that maps from k i channels into n channels, followed by a linear layer that predicts Y .
We train this two-layer subnet using gradient-descent.
As an immediate corollary of the analysis in the previous section, this step implicitly learns an embedding of the patches into a space where patches from the same semantic class are close to each other, while patches from different classes are far away.
This lays the groundwork for the clustering step of the next iteration
(4) “Throw” the last linear layer, thus leaving a trained block of Conv ( s × s ) -ReLU-Pool-Conv (1 × 1) which ﬁnds a “good” embedding of the patches of the input image, and repeat the process again, where
the output of this block is the input to step
Finally, after we perform this process for d times, we get a network of depth d composed from
Conv ( s × s ) -ReLU-Pool-Conv (1 × 1) blocks.
Then, we feed the output of this (already trained) network to an SVM algorithm that learns a linear classiﬁer, training it to infer the label y from the semantic representation that the convolution network outputs.
We now describe the building blocks for the algorithm, followed by the deﬁnition of the complete algorithm.
Clustering .
The ﬁrst block of the algorithm is the clustering step.
We denote KMEANS ( S, k ) to be the output of the k-means++ algorithm (Arthur & Vassilvitskii (2007)) running on sample S to ﬁnd k clusters, w.r.t the cosine similarity.
We assume the algorithm returns a mapping φ S : R s → R k , such that if x i , x j ∈ S are in the same cluster then φ S ( x i ) =
φ S ( x j ) , and otherwise φ S ( x i ) ⊥
φ S ( x j ) .
For the consistency with common CNN architecture, we can use the centroids of each cluster as kernels for a convolution operation.
Combining this with ReLU with a ﬁxed bias and a pooling operation gives an operation that maps each patch to a single vector, where vectors of different patches are approximately orthogonal.
Two-Layer Network Algorithm
We denote TLGD ( S, T, η, n, σ ) the GD algorithm, training a twolayer Conv net of width n , on sample S , with learning rate η for T interations.
This algorithm returns the weights of the ﬁrst layer K T .
The details of this algorithm are described in section 4.1.
Classiﬁcation Algorithm Finally, the last building block of the algorithm is a classiﬁcation stage, that is used on top of the deep convolution architecture learned in the previous steps.
As we show, at this stage the examples are linearly separated, so we can use the SVM algorithm to ﬁnd large margin linear separator.
We denote SVM ( S ) the output of running SVM on sample S .
Complete Algorithm Utilizing the building blocks described previously, our algorithm learns a deep CNN layer after layer.
This network is used to infer the label for each image.
The algorithm is described formally in algorithm 1.
In the description, we use the notation φ ∗ A to denote the operation of applying a map φ : K m 0→ K m 1on a tensor A , replacing patches of size m 0 by vectors in K m 1 1 .
Formally: φ ∗ A :=
[ φ ( A : ,i · m 0 ...
( i +1) · m 0 )]
i
Algorithm input : numbers η, T, n, σ, k 1 , . . .
, k d sample S =
{ ( X 1 , y 1 ) , . . .
( X N , y N ) } ⊆
R m 0 s d × m 0 s d × Y h d ← id for i =
d . . .
1 do set S
i ← { ( h i ( X 1 ) , y 1 ) , . . .
, ( h i ( X N ) , y N ) } // construct sample using the current network set P i ← { patches of size s × s from S i } // generate patches from the current sample set φ i ← KMEANS ( P i , k i ) //
cluster the sampled patches set ˆ S i ← { ( φ i ∗ h
i ( X 1 ) , y 1 ) , . . .
, ( φ i ∗ h
i ( X N ) , y N ) } // map patches to orthogonal vectors using φ i
if i > 1 then set K i − 1 ← TLGD ( ˆ S
i , T, η, n, σ ) // train a two-layer net to ﬁnd a “good” embedding for the patches set h
i − 1 ← K (cid:62)
5. T HEORETICAL A NALYSIS
In this section we show that, algorithm 1 learns in polynomial time (with high probability) a network model that correctly classiﬁes the examples according to their labels.
Recall that we have shown that training a two-layer network implicitly learns an embedding of the patches into a space where patches from the same semantic class are close to each other, while patches from different classes are far.
Using this, we show that performing clustering + two-layer network training iteratively, layer by layer, leads to revealing the underlying model, and hence the algorithm’s convergence.
We claim that algorithm 1 successfully learns a model that correctly classiﬁes the examples sampled from the observed distribution G d .
This is stated in the following theorem:
Theorem 2 Suppose that assumptions 1, 2, 3 hold. Fix δ > 0 , and let δ (cid:48)
=
δ 2 d .
Denote C := max i<
d |C i | the maximal number of semantic classes in any level i .
Choose σ = 1 s , n > [Equation]
[Equation]
= | [Equation]
| , . .
k [Equation]
= |C d − 2 | , k d = k |C d − 1 | .
Then w.p ≥ 1 − δ , running algorithm 1 with parameters γ, η, T, n, σ, k 1 , . .
k d on distribution G d returns hypothesis h s.t P ( X ,y ) ∼G
d ( h ( X ) (cid:54) =
y )
= 0 , and runs in time O (cid:0)
d ( C 2 k 2 + T ) + k (cid:107) W ∗ (cid:107) 2 (cid:1) .
E XPERIMENTS
A common criticism of theoretical results on deep learning is that they fail to account for the empirical success of deep networks.
Indeed, negative results show that learning deep networks is computationally hard, while in practice efﬁcient algorithms like SGD achieve remarkably good performance.
Positive results, on the other hand, often make very strong assumptions that clearly do not hold in practice, like assuming the inputs are sampled from Gaussian distribution, or that they are linearly separable.
Other positive results make less restrictive assumptions, but analyze algorithms that are very far from algorithms that are used in practice.
At ﬁrst glance, our work may seem to suffer from the same common drawbacks of positive theoretical results: we describe a distribution that is admittedly synthetic, and for deep models we analyze an algorithm that seems “tailored” to [Figure]
learn this distribution. To show that our model and algorithm do capture properties of distributions and algorithms used in practice, we implemented our algorithm to learn a CNN on the CIFARdataset, comparing it to a vanilla CNN trained with a common SGD-based optimization algorithm.
As our aim is to show that our algorithm achieves comparable result to a vanilla SGD-based optimization, and not to achieve state-of-the-art results on CIFAR-10, we do not use any of the common “tricks” that are widely used when training deep networks (such as data augmentation, dropout, batch normalization, scheduled learning rate, averaging of weights across iterations etc.).
We implemented our algorithm by repeating the following steps twice: (1) Sample N patches of size 3x uniformly from the dataset.
For some (cid:96) , run the K-means algorithm to ﬁnd (cid:96) cluster centers
[Equation]
At this step, we need to associate each cluster with a vector in R (cid:96) , such that the image of this mapping is a set of orthonormal vectors, and then map every patch in every image to the vector corresponding to the cluster it belongs to.
We do so by performing Conv3x3 operation with the (cid:96) kernels c 1 . . .
c (cid:96) , and then perform ReLU operation with a ﬁxed bias b .
This roughly maps each patch to the vector e i , where i is the cluster the patch belongs to.
(4) While our analysis corresponds to performing the convolution from the previous step with a stride of 3 , to make the architecture closer to the commonly used CNNs (speciﬁcally the one suggested in the Tensorﬂow implementation Google-Brain (2016)), we used a stride of 1 followed by a 2x2 max-pooling.
(5) Randomly initialize a two layered linear network, where the ﬁrst layer is Conv1x1 with (cid:96) (cid:48) output channels, and the second layer is a fully-connected Afﬁne layer that outputs 10 channels to predict theclasses of CIFAR-10.
(6) Train the two-layers with Adam optimization (Kingma & Ba (2014)) on the cross-entropy loss, and remove the top layer.
The output of this block is the output of these steps.
Repeating the above steps twice yields a network with two blocks of Conv3x3-ReLU-Pool-Conv1x1.
We feed the output of these steps to a ﬁnal classiﬁer that is trained with Adam on the cross entropy loss for 100k iterations, to output the ﬁnal classiﬁcation of this model.
We test two choices for this classiﬁer: a linear classiﬁer and a three-layers fully-connected neural network.
Note that in both cases, the output of our algorithm is a vanilla CNN.
The only difference is in the training algorithm.
To calibrate the various parameters that deﬁne the model, we ﬁrst perform random parameter search, where we use 10k examples from the train set as validation set (and the rest 40k as train set).
After we found the optimal parameters for all the setups we compare, we then train the model again with the calibrated parameters on all the train data, and plot the accuracy on the test data every 10k iterations.
The parameters found in the parameter search are listed in appendix E.
We compared our algorithm to several alternatives.
First, the standard CNN conﬁguration in the
Tensorﬂow implementation with two variants: CNN+(FC+ReLU) 3 is the Tensorﬂow architecture and CNN+Linear is the Tensorﬂow architecture where the last three fully connected layers were replaced by a single fully connected layer.
The goal of this comparison is to show that the performance of our algorithm is in the same ballpark as that of vanilla CNNs.
Second, we use the same two architectures mentioned before, but while using random weights for the CNN and training only the
FC layers.
Some previous analyses of the success of CNN claimed that the power of the algorithm comes from the random initialization (see Daniely (2017)), and only the training of the last layer matters.
As is clearly seen, random weights are far from the performance of vanilla CNNs.
Our last experiment aims at showing the power of the two layer training in our algorithm (step 6).
To do so, we compare our algorithm to a variant of it, in which step 6 is replaced by random projections (based on Johnson-Lindenstrauss lemma).
We denote this variant by Clustering+JL.
As can be seen, this variant gives drastically inferior results, showing that the training step of Conv1x1 is crucial, and ﬁnds a “good” embedding for the process that follows, as is suggested by our theoretical analysis.
A summary of all the results is given in ﬁgure 4.
A P ROOF OF L EMMA 1 AND T HEOREM
Denote m = m
s the size of the images sampled from G 1 (these images are in R m × m ).
As in section 4, we will consider the “reshaped” version of images sampled from G 1 , so we will have
X ∈ R s 2 × m 20 .
Equivalently, patches of the sampled images, that belong to sets { S (0) c } c ∈C , will be vectors in R s 2 .
Finally, we denote ( Z , y ) ∼ G 0 the latent images in the generative process, where
Z ∈ C m 0 × m 0.
Here we will instead consider these images as vectors in C m 20 0 .
Similarly, the labeled frequency matrix of class c is F c ∈ R m 0 × m 0 , and we will consider it to be a vector F c ∈ R m 20 .
In the proof we use the notations F c to denote the negative labeled frequency matrix:
[Equation]
We will start by proving Lemma 1:
Proof of Lemma 1: For simplicity, we can assume C
=
[ C ] , for some natural C .
Therefore, the linear separator of G 0 is a matrix W ∗ ∈ R C × m 20 .
For ( Z , y ) ∼ G 0 deﬁne (cid:104) W ∗ , Z (cid:105) =
(cid:80) c
∈ [ C ] (cid:104) W ∗ c , I c ( Z ) (cid:105) , where I c is the operator that replaces each entry of Z with the booleanif it equals c , or 0 otherwise.
Notice that the deﬁnition of linear separability in section 3 is equivalent to y (cid:104) W ∗ , Z (cid:105) ≥ 1 for every ( Z , y ) ∼ G 0 .
Denote P 1 , . . .
, P C ∈ R s 2 such that P
i
=
(cid:80) P ∈ S (0) i P .
From the orthonormality of the patches, for every P ∈ S (0) i we have P · P j =
i
=
j .
Now, denote T : R s 2 × m 20 → R such that:
[Equation]
P
[Equation]
X
[Equation]
For ( X , y ) ∼ G 1 , denote Z the latent representation of X , then by the deﬁnition of the generative distribution it is easy to verify that I j ( Z ) =
P (cid:62) j X , and therefore:
[Equation]
Since T is a linear function such that (cid:107) T (cid:107) 2 F = k (cid:107) W ∗ (cid:107) 2 F , and using standard results on the SVM algorithm, the conclusion of the lemma follows.
In the rest of this section, we will prove Theorem 2.
We use the notations w ( t ) i , k ( t ) i to denote the i -th columns of W t , K t respectively.
For some class c ∈ C 0 and for some patch x (cid:48) ∈ S (0) c , denote f x (cid:48) a function that takes a matrix X and returns a vector f x (cid:48) ( X ) such that the i ’th element of f x (cid:48)
( X ) is the 1 if the i ’th column of X , denoted x i , equals to x (cid:48) and 0 otherwise.
That is,
[Equation]

Notice that from the orthonormality of the observed columns of X it follows that: f x (cid:48)
( X ) =
X (cid:62) x (cid:48) .
We begin with proving the following technical lemma.
Lemma
For each c ∈ C 0 and for each x (cid:48) ∈ S (0) c we have:
[Equation]
Proof Denote D Z the distribution of ( X (1) , y ) ∼ G 1 conditioned on X (0) =
Z (the distribution of the images generated from the latent image Z ).
Observe that
[Equation]
Recall that for each c ∈ C 0 , we have | S (0) c | = k .
Therefore, for each j ∈ [ m 20 ] we have:
[Equation]
The next lemma reveals a surprising connection between the gradient and the vectors F c .
Lemma 3 for every c ∈ C 0 and for every x (cid:48) ∈ S (0) c :
[Equation]
Proof For a ﬁxed X and W , denote ˆ y ( K ) =
N K , W ( X ) .
Note that:
[Equation]
So for x (cid:48) ∈ S (0) c we have:
[Equation]
Combining the above with the deﬁnition of the loss function, (cid:96) y
(ˆ y )
=
− y
ˆ y , and with Lemma 2 we get:
[Equation]
As an immediate corollary we obtain that a gradient step does not change the projection of the kernel on two vectors that correspond to the same class (both are in the same S (0) c ).
Corollary 1 For every t ≥ 0 , i ∈ [ n ] , for every semantic class c ∈ C and for every x 1 , x 2 ∈ S (0) c it holds that: | k ( t +1)
i
[Equation]
Proof From Lemma 3 we can conclude that for a given c ∈ C , for every x 1 , x 2 ∈ S (0)
c we get:
[Equation]
From the gradient descent update rule:
[Equation]
And therefore:
[Equation]
Next we turn to show that a gradient step improves the separation of vectors coming from different semantic classes.
Lemma 4 Fix c 1 , c 2 ∈ C 0 .
Recall that we denote ∠ ( F c 1 , F c 2 ) to be the angle between the vectors
F c 1 , F c 2 .
Then, with probability ∠ ( F c 1 , F c 2 ) /π on the initialization of w (0)
i we get: sign( w (
[Equation]
i
[Equation]
Proof Observe the projection of w (0)
i on the plane spanned by F c 1 , F c 2 .
Then, the result is immediate from the symmetry of the initialization of w (0) i .
Lemma 5 Fix c 1 (cid:54) =
c 2 ∈ C 0 .
Then, with probability of at least 0 .
23 ∠ ( F c 1 , F c 2 ) π we get for every x 1 ∈ S (0) c 1 , x 2 ∈ S (0) c 2 :
[Equation]
Proof Notice that since w (0) i
[Equation]
, 1) , we get that w (0)
i · F c j ∼ N (0 , (cid:107) F c j (cid:107) 2 ) for j ∈ { 1 , 2 } .
Therefore, the probability that w (0) i · F c j deviates by at most 12 -std from the mean is erf( 12 √ 2 ) .
Thus, we get that:
[Equation]
And using the union bound:
[Equation]
Thus, using Lemma 4, we get that the following holds with probability of at least 0 .
23 ∠ ( F c 1 , F c 2 ) π :
• | w (0) i · F c 1 | > (cid:107) F c 1 (cid:107) • | w (0) i · F c 2 | > (cid:107) F c 2 (cid:107) • sign( w (0)
i · F c 1 ) (cid:54) = sign( w (0)
i · F c 2 )
Assume w.l.o.g that w (0) i · F c 1 < 0 < w
[Equation]
0) i · F c 2 , then using Lemma 3 we get:
[Equation]
In a similar fashion we can get:
[Equation]
And thus the conclusion follows:
[Equation]
Finally, we are ready to prove the main theorem.
Proof of Theorem 1.
We show two things:
Fix c ∈ C 0 .
By the initialization, we get that for every x 1 , x 2 ∈ S (0) c and for every i ∈ [ n ] :
[Equation]
Using Corollary 1, we get that:
[Equation]
And thus:
[Equation]
Let c 1 (cid:54) =
c 2 ∈ C 0 .
Assume T > ( γ +2 σ ) k ηλ .
For i ∈ [ n ] , from Lemma 5 we get that with probability of at least 0 .
23 ∠ ( F c 1 , F c 2 ) π > 0 .
23 θπ for every x 1 ∈ S (0) c 1 , x 2 ∈ S (0) c 2 :
[Equation]
For a given c 1 (cid:54) = c 2 ∈ C 0 , denote the event:
[Equation]
Then, from what we
have showed, it holds that:
[Equation]
Using the union bound, we get that:
[Equation]
Choosing n > 2 π 0 .
23 θ log( |C| δ )
we get P ( ∃ c 1 (cid:54) =
c 2 ∈ C 0 s.t A c 1 ,c 2 ) < δ .
Now, if for every c 1 (cid:54) =
c 2 ∈ C 0 the event
A c 1 ,c 2 doesn’t hold, then clearly for every x 1 ∈ S (0) c 1 , x 2 ∈ S (0) cwe would get (cid:107) K T · x 1 − K T · x 2 (cid:107) > γ , and this is what we wanted to show. B A NALYSIS OF SGD
We show a theorem equivalent to Theorem 1, when using the SGD algorithm on samples from distribution G 1 , instead of updating on the population gradient with the GD algorithm.
For this analysis, we ﬁx m 0 = 3 and take the columns of W to be initialized on the unit sphere. Theorem 3 Assume that assumptions 2, 3, 4 hold. Assume we train a two-layer network of size n > [Equation]
log
[Equation]
|
[Equation]
| δ ) with SGD with batch size of 1 on samples from distribution G 1 , for
T > max
[Equation]
log 2 (
[Equation]
|
[Equation]
|
[Equation]
) } iterations, with learning rate η = T − 3 / 4 , for some γ > 0 .
Then with probability of at least 1 − 2 δ : 1.
for each c ∈ C 0 , for every x 1 , x 2 ∈ S (0) c we get (cid:107) K (cid:62)
[Equation]
· x 1 − K (cid:62)
[Equation]
· x 2 (cid:107) < 2 σ 2.
for c 1 , c 2 ∈ C 0 , if c 1 (cid:54) =
c 2 , for every x 1 ∈ S (0) c 1 , x 2 ∈ S (0) c 2 , we get (cid:107) K (cid:62) T · x 1 − K (cid:62) T · x 2 (cid:107) > γ
Assume we are given a sample ( X 1 , y 1 ) , . . .
, ( X T , y T ) sampled i.i.d from distribution G 1 , and we run SGD with batch size of 1 (with respect to the same problem analyzed in the previous section).
Denote by ˆ y t the prediction of the network on iteration t .
Denote g ( t ) i the gradient with respect to the kernel k
i on iteration t .
Similar to Lemma 3, we get for every c ∈ C 0 and x (cid:48) ∈ S (0) c :
[Equation]
Using Lemma 3 along with the fact that ( X t , y t ) ∼ i.i.d G 1 we get that:
[Equation]
{+Since we assume (cid:107) w ( i ) 
+}
{+(cid:107) ≤ 
+}
, we get that:
[Equation]
Therefore, ﬁxing α > 0 , and using Hoeffding’s bound we get:
[Equation]
And taking η = T − 3 / 4 we get:
[Equation]
Denote by A the event where:
[Equation]
{+Taking T ≥ m 40 
+}
α 4 log 2 ( 2 |C 0 | kn δ ) and using union bound over all kernels
k i , i ∈ [ n ] and patches in ∪ c ∈C 0 S (0) c
we get:
Pr
[Equation]
δ
Using the above, we get the following:
Corollary 2 With probability at least 1 − δ , we get:
[Equation]
Proof With probability at least 1 − δ , for every c ∈ C 0 and for every x 1 , x 2 ∈ S (0)
c we get:
[Equation]
We repeat the proof of Lemma 5, now assuming the updates are of SGD.
Lemma 6 Assume event A does not occur.
Fix c 1 (cid:54) =
c 2 ∈ C 0 .
Then, with probability of at least 0 .
23 ∠ ( F c 1 , F c 2 ) π we get for every x 1 ∈ S (0) c 1 , x 2 ∈ S (0) c 2 :
[Equation]
( T
[Equation]
Proof Denote v := 12 ( (cid:104) w (0)
i , F c j (cid:105) / (cid:107) F c j (cid:107) + 1) .
The vector w (0) i is distributed uniformly on the sphere, and from spherical symmetry we can see that the distribution of v is independent of the value of F c j / (cid:107) F c j (cid:107) .
Therefore, we can see that the distribution of v is simply the distribution of the ﬁrst coordinate of w (0) i , normalized to [0 , 1] .
Since w (0) is of dimension m 20 , we get that v ∼ Beta(( m 20 − 1) / 2 , ( m 20 − 1) / 2))
=
Beta(4 , 4) .
Therefore, we get:
P (0 . 4 ≤ v ≤ 0 . 6) < 0 .
And from this we get:
[Equation]
[Equation]
And using the union bound:
[Equation]
Thus, using Lemma 4, we get that the following holds with probability of at least 0 .
12 ∠ ( F c 1 , F c 2 ) π :
• | w (0) i · F c 1 | > 0 .
2 (cid:107) F c 1 (cid:107) • | w (0) i · F c 2 | > 0 .
2 (cid:107) F c 2 (cid:107) • sign( w (0) i
· F c 1 ) (cid:54)
= sign( w (0)
i · F c 2 )
Assume w.l.o.g that w (0) i · F
[Equation]
1 < 0 < w
[Equation]
0) i · F c 2 , then using what we have shown:
[Equation]
In a similar fashion we can get:
[Equation]
And thus the conclusion follows:
[Equation]
We can now repeat the main theorem for the SGD case:
Proof of Theorem 3.
Assume event
A does not occur, and ﬁx α = σ 2 √ n .
We show two things: 1.
Using Corollary 2, we get that:
[Equation]
And thus:
[Equation]
Let c 1 (cid:54) =
c 2 ∈ C 0 .
Assume T > ( γ +4 σ ) 4 k 4 (0 . 4 λ ) 4 .
For i ∈ [ n ] , from Lemma 6 we get that with probability of at least 0 .
12 ∠ ( F c 1 , F c 2 ) π > 0 .
12 θπ for every x 1 ∈ S (0) c 1 , x 2 ∈ S (0) c 2 :
[Equation]
For a given c 1 (cid:54) = c 2 ∈ C 0 , denote the event:
[Equation]
Then, from what we have showed, it holds that:
[Equation]
[Equation]
Using the union bound, we get that:
[Equation]
Choosing n > 2 π 0 .
12 θ log( |C| δ ) we get P ( ∃ c 1 (cid:54) =
c 2 ∈ C 0 s.t A c 1 ,c 2 ) < δ .
Now, if for every c 1 (cid:54) =
c 2 ∈ C 0 the event
A c 1 ,c 2 doesn’t hold, then clearly for every x 1 ∈ S (0) c 1 , x 2 ∈ S (0) cwe would get (cid:107) K T · x 1 − K T · x 2 (cid:107) > γ , and this is what we wanted to show.
Since event A happens with probability at most δ , the conclusion follows.
C P ROOF OF T HEOREM
Our algorithm uses the k-means++ algorithm, which is a variant of Lloyd’s algorithm where the initial cluster centers are chosen with probability proportional to their distance to the closest cluster that was already chosen.
The algorithm ﬁrst chooses a cluster center c 1 uniformly on all examples.
Any new cluster is chosen in the following way: assume we already chose cluster centers c 1 , . . .
, c n , denote D ( x ) :=
min j ∈ [ n ] (cid:107) x − c j (cid:107) , the minimal distance from example x ∈ S to the closest cluster center.
Then, the algorithm chooses an example x ∈ S with probability
D ( x ) 2 (cid:80) x
(cid:48)∈ S D ( x (cid:48) ) 2 .
After the cluster centers are chosen, we run the standard Lloyd’s algorithm for k-means.
The following lemma shows that k-means++ ﬁnds an optimal solution with high probability on highly-clustered data:
Lemma {+
+} Fix δ > 0 .
Let S be a ﬁnite set that is “highly-clustered”: S is partitioned such that
S = ∪ j ∈
[ C ] B j , where the partition satisﬁes:
For every x , y ∈ B j it holds that (cid:107) x − y (cid:107) < 1 . 2.
For every x ∈ B i , y ∈ B j such that i (cid:54) =
j it holds that (cid:107) x − y (cid:107) >
C/ √ δ .
All B j -s are sets of ﬁxed size: ∀ i,j | B i | =
| B j | .
Assume we run the k-means++ algorithm on set S to ﬁnd C clusters.
Then with probability at least 1 − δ , the algorithm returns an “optimal clustering”: the centers returned by the algorithm ˆ x 1 , . . .
, ˆ x C satisfy that for every j ∈ [ C ] there exist
i ∈
[ C ] with ˆ x i ∈ B j .
Proof We will prove by induction that at the i -th step of choosing the centers, with probability at least 1 − iC δ , the chosen centers ˆ x 1 , . . .
, ˆ x i satisfy that there are no i 1 (cid:54) =
i 2 ∈ [ i ] such that ˆ x
i 1 , ˆ x i 2 ∈ B j :
• for i =
this is immediate.
• assume we chose ˆ x 1 , . .
, ˆ x i that satisfy the above condition, and w.l.o.g we can assume that for j ≤ i we have ˆ x j ∈ B j .
Then, for every x ∈ B j with j ≤ i we have D ( x ) < 1 , and for every x ∈ B j with j > i we have D ( x ) >
C/ √ δ .
Therefore, the
probability
of choosing x ∈ B j with j ≤ i in the next step is at most:
[Equation]
Now, using the union bound we get the required.
Taking i
= C proves the initialized center are already optimal.
Clearly, any step of Lloyd’s algorithm will maintain this property.
In fact, the algorithm will converge after one step, returning ˆ x 1 , . . .
, ˆ x C with ˆ x j = 1 C (cid:80) x ∈ B j x .
Before we complete the proof of the theorem, we remind a few notations that were used in the algorithm’s description.
We use φ i to denote the clustering of patches learned in the i -th iteration of the algorithm, and K i the weights of the kernels learned BEFORE the i -th step (thus, the patches mapped by K i are the input to the clustering algorithm that outputs φ i ).
Note that we do not learn a mapping in the last step, as from Lemma 1 as the distribution G 1 is linearly separable, so we could simply use SVM on the output of the network at that stage.
Finally, we use the notations φ ∗ A to indicate that we operate φ on every patch of the tensor A .
When we use operations on distributions, for example h ◦ G or φ ∗ G , we refer to the new distribution generated by applying these operation to every examples sampled from G .
The essence of the proof is the following lemma:
Lemma 8 Let G :=
G d be the distribution over pairs ( X , y ) , where X is the observed image over the reals, and recall that for i <
d , the distribution G i is over pairs ( X ( i ) , y ) where X ( i ) is in a space of latent semantic images over C i .
For every i ∈ [ d ] , with probability at least 1 − 2( d − i ) δ (cid:48) , there exists an orthonormal patch mapping ϕ
i : C s × s i → R k i such that φ i ∗ ( h i ◦ G ) =
ϕ i ∗ G i , where φ i and h
i are as deﬁned in algorithm 1.
The lemma tells us that the neural network at step i of the algorithm reveals (in some sense) the latent semantic structure.
We will again use a “reshaped” notation: in every level i (the i -th step of the induction), we treat patches P ∈ C s × s i as vectors P ∈ C s 2 i .
For a sub-image in the next level, denoted Z ∈ C s 2 × s
i +1 , we will denote Z j ∈ C s
i +1 to be the j -th patch of size s × s in the sub-image (generated by the class at the j -th coordinate of higher level patch P ∈ C s 2 i ).
We will prove by induction the following claim:
Lemma 9 Assume that for some i <
d the condition of the lemma holds for i + 1 , namely that there exists an orthonormal patch mapping ϕ
i +1 :
C s × s i +
→ R k i +1 such that φ i +1 ∗
( h i +1 ◦ G ) =
ϕ
i +1 ∗
G i +1 .
Then, with probability at least 1 − 2 δ (cid:48) this condition holds for i .
Proof Let ϕ i +1 be the mapping satisfying the condition of the claim for i
+ 1 .
Notice that the data that is fed to the two-layer training step comes from the distribution ϕ
i +1 ∗ G i +1 , and satisﬁes the conditions for the analysis of Theorem 1.
First, we will show that the set of patches S i , the set of all patches in the distribution h i ◦ G is “highly-clustered” with probability at least 1 − δ (cid:48) .
For every c ∈ C i , denote B c = { K (cid:62) i ϕ
i +1 ( P ) :
P ∈ S ( i ) c } .
Recall that from our assumption, h i ◦ G
= K (cid:62) i ( ϕ
i +1 ∗ G
i +1 ) .
Therefore, we have that S i
=
∪ c ∈C i B c .
Now, from Theorem 1, since we have T > k ( C/ √ δ (cid:48)
+2 σ ) ηλ and σ = 1 s , with probability at least 1 − δ (cid:48) , conditions 1 and 2 in the “highly-clustered” deﬁnition hold.
Since we assume that S ( i ) c are of the same size, conditionfollows.
From the above, using Lemma 7, with probability at least 1 − 2 δ (cid:48) the set S i is “highly-clustered” and k-means++ returns an optimal clustering.
We will now limit ourselves to the event that both of these hold.
Now, deﬁne the map
ϕ
i : C s × s i → R k in the following way: ﬁrst, for every patch P ∈ C s
i we take an arbitrary manifestation of the patch P in the next level, denoted Z ∈ C s
2 ×
s
i +1 .
In other words, Z could be any s 2 × s 2 sub-image in the next level that could be generated from the patch P .
Now, take ϕ
i
( P ) :
=
φ i ( K i · ( ϕ i +1 ∗ Z )) .
Then, the following holds:
ϕ i ( P ) does not depend on the choice of Z : if Z , Z (cid:48) are two different
manifestations of P , then, from the deﬁnition of the generative model, for every j ∈ [ s ] it holds that
Z j , Z (cid:48)
j ∈ S P j .
Thus from what we have shown:
[Equation]
Therefore:
[Equation]
and since we get an optimal clustering, we have:
[Equation]
for every two patches P (cid:54) =
P (cid:48)
we get ϕ κ ( P ) ⊥ ϕ κ ( P (cid:48) ) : let Z , Z (cid:48) be the manifestations of p, p (cid:48) respectively.
Since P (cid:54) =
P (cid:48) there exists j ∈
[ s 2 ] such that P j (cid:54) =
P (cid:48) j .
From the generative model it follows that Z j ∈ S ( i ) P j and Z (cid:48)
j ∈ S ( i ) P (cid:48)
j , and therefore from the behavior of the algorithm: (cid:107) K (cid:62) i · ϕ i +1 ( Z j ) − K (cid:62) i · ϕ i +
( Z (cid:48)
j ) (cid:107) >
C/ √ δ (cid:48) >
k i / √ δ (cid:48) .
Therefore, we get that (cid:107) K i · ϕ i +1 ∗
Z − K i · ϕ i +
[Equation]
Z
[Equation]
>
k
[Equation] [Equation]
δ
, and thus
from
the clustering optimality we get ϕ i ( P )
⊥ ϕ i ( P
(cid:48)
Now, recall that in the algorithm deﬁnition: h i =
K (cid:62) i · ( φ i +1 ∗
h i +1 ) .
Using the assumption for i + 1 , we get:
[Equation]
and from the deﬁnition of ϕ
i and what we have shown we get:
[Equation]
Proof [of Lemma 8] We prove by induction:
• Note that an immediate property of the k-means++ algorithm is that it doesn’t choose the same example twice.
Therefore, if we run k-means++ on sample S to ﬁnd | S | clusters,
we
get a single cluster center for each element of S .
From the deﬁnition of our model, there are |C d − 1 | k patches in the observed image, and since we run k-means++ to ﬁnd k d = |C d − 1 | k clusters, we get a cluster center for each patch.
Hence, k-means++ returns an orthogonal patch mapping φ d , and since h d = id we get the required.
• Assume the claim holds for i + 1 , then with probability at least 1 − 2( d − i − 1) δ (cid:48)
the condition holds for i + 1 .
In such event, from Lemma 9 with probability at least 1 − 2 δ (cid:48) , it holds for i .
Therefore, with probability (1 − 2( d − i − 1) δ (cid:48) )
(1 − 2 δ (cid:48) ) ≥ 1 − 2( d − i ) δ (cid:48) it holds for i .
Proof [ of Theorem 2] From Lemma 8, after performing d iterations of the algorithm, we observe that with probability at least 1 − 2 dδ (cid:48)
= 1 − δ distribution ϕ 1 ∗G 1 , where ϕ 1 is an orthonormal patch mapping.
Therefore, using Lemma 1, it is linearly separable with margin k (cid:107) W ∗ (cid:107) 2 .
Therefore, the
SVM algorithm ﬁnds an optimal separator in O ( k (cid:107) W ∗ (cid:107) 2 ) .
To count the overall amount of iterations, notice that the when running k-means++ on sample S to ﬁnd C clusters, the initialization step at most | S | C iterations and the algorithm itself converges after one iteration, so in our case its runtime is bounded by C 2 k 2 .
The runtime of the TLGD algorithm is T .
We perform d iterations of clustering and the TLGD algorithm, and ﬁnally run the SVM algorithm that converges in O ( k (cid:107) W ∗ (cid:107) 2 ) .
So the runtime of the whole algorithm is O (cid:0) d ( C 2 k 2 +
[Equation]
D S YNTHETIC D ATA E XPERIMENT
To conﬁrm that our model is typically not linearly separable, we generated synthetic examples using our model in the following way:
• We chose Y = {± 1 } .
{+• We ﬁxed C 
+}
= { 0 , 1 , 2 , 3 } , and chose 4 vectors for each class, uniformly over C 3 × 3.
Notice that overall there are 8 vectors labeled with ± 1 , and they are linearly independent with high probability (we also validated that they are indeed independent).
This process deﬁnes the distribution G 0 , and it is therefore indeed linearly separable.
{+• We ﬁx C 1 = { 0 , 1 , 2 , 3 } , and for each c ∈ C 
+}
we choose the set S (0) c be drawing k vectors uniformly over C 3 × 3.
This deﬁnes the distribution G 1 .
Finally, we choose C 2 = R 3 , and for each c ∈ C 1 we choose S (1) c by drawing k vectors from a normal distribution over C 3 × 3.
This deﬁnes the distribution G 2 , which is the observed distribution.
We run this model with different values of k ( 30 , 40 , 50 ).
We then measure the values of θ and λ , to show that Assumption 3 holds for this distribution.
We generate a sample of 50 , 000 examples from this distribution, taking 40 , 000 as train examples, and 10 , 000 as test.
We train a linear classiﬁer on this distribution, and display its performance on the test data.
For comparison, we also train a CNN with non-overlapping convolutions (convolutions of 3x3 and stride 3) with the ReLU activation.
We use an architecture of two layers of convolution, and a ﬁnal readout layer, and train with respect to the logistic loss.
This training is done with the Adam optimizer in a standard end-to-end fashion.
We also train the same architecture with our algorithm, where we the training is done layer-by-layer.
E P ARAMETERS FOR CIFAR-10 E XPERIMENTS
ﬁgure 5 below lists the parameters that were learned in the random parameter search for the different conﬁgurations of the algorithm, as described in 4.
The table lists the parameters used in each layer: (cid:96) 1 , (cid:96) 2 are the number of clusters for the ﬁrst and second layer, and (cid:96) (cid:48) 1 , (cid:96) (cid:48) 2 are the output channels of the Conv1x1 operation for each layer.
These parameters could be used to reproduce the results of our experiments.
Classiﬁer
N [Table]
Accuracy
[Table] [Table] [Table] [Table]
[Table] [Table]
Clustering
[Table] [Table]