# Online Learning with Ensembles

## Abstract

Supervised online learning with an ensemble of students randomized by the choice of initial conditions is analyzed. For the case of the perceptron learning rule, asymptotically the same improvement in the generalization error of the ensemble compared to the performance of a single student is found as in Gibbs learning. For more optimized learning rules, however, using an ensemble yields no improvement. This is explained by showing that for any learning rule $`f`$ a transform $`\stackrel{~}{f}`$ exists, such that a single student using $`\stackrel{~}{f}`$ has the same generalization behaviour as an ensemble of $`f`$-students.

Online learning, where each training example is presented just once to the student, has proved to be a very successful paradigm in the study of neural networks using methods from statistical mechanics . On the one hand, it makes it possible to rigorously  analyze a wide range of learning algorithms. On the other hand, online algorithms can in some cases yield a performance which equals that of the Bayes optimal inference procedure, e.g. asymptotically, when the probability of the data is a smooth function of the parameters of the network .

Some problems, however, do remain. For nonsmooth cases, which arise e.g. in classification tasks, the Bayes optimal procedure yields a superior generalization performance, even asymptotically, to that of online algorithms . Also even for smooth problems, the online dynamics often has suboptimal stationary points arising from symmetries in the network architecture. Then the sample size needed to reach the asymptotic regime will scale faster than linearly with the number of free parameters if no prior knowledge is built into the initial conditions of the dynamics .

It thus seems of interest to ask which extensions of the online framework make sense. Here we shall consider using an ensemble of students randomized by the choice of initial condition and classifying a new input by a majority vote. This may be motivated by the fact that in the batch case the Bayes optimal inference procedure can be implemented by an ensemble picked from the posterior (given the training set) distribution on the set of all students. We shall consider an ensemble of $`K`$ students; at time step $`\mu `$ the $`i`$-th student is characterized by a weight vector $`J_i^\mu IR^N`$. The learning dynamics is based on a training set of $`\alpha N`$ input/output pairs $`(\xi ^\mu ,\tau ^\mu )`$ where $`\xi ^\mu IR^N`$. We shall consider realizable learning in a perceptron, so $`\tau ^\mu =\text{sign}(B^T\xi ^\mu )`$ where $`B`$ is the $`N`$-dimensional weight vector defining the teacher and it is convenient to assume that $`|B|=1`$ holds for the Euclidean norm. The dynamics of the $`i`$-th student then takes the form

$$J_i^{\mu +1}=J_i^\mu +\xi ^\mu N^1f(\mu /N,|J_i^\mu |,B^T\xi ^\mu ,J_{i}^{\mu }{}_{}{}^{T}\xi ^\mu )$$
(1)   
and the choice of the real valued function $`f`$ defines the learning rule. Reasonably $`f`$ may only depend on the third argument $`B^T\xi ^\mu `$ via its sign $`\tau ^\mu `$, but it is not helpful to make this explicit in the notation. Note that all of the members of the ensemble learn from the same training examples, and these are presented in the same order.

Assuming that the components of the example inputs are independent random variables picked from the normal distribution on $`IR`$, the state of the ensemble can be described by the order parameters $`R_i(\alpha )=B^TJ_i^{\alpha N}`$ and $`Q_{ij}(\alpha )=J_{i}^{\alpha N}{}_{}{}^{T}J_j^{\alpha N}`$. For a reasonable choice of $`f`$  the order parameters will be nonfluctuating for large $`N`$ and satisfy the differential equations:

$`\dot{R_i}`$ $`=`$ $`yf_i^\alpha _{x_i,y}`$   
$`\dot{Q}_{ij}`$ $`=`$ $`x_if_j^\alpha +x_jf_i^\alpha +f_i^\alpha f_j^\alpha _{x_i,x_j,y}`$   
$`f_i^\alpha `$ $``$ $`f(\alpha ,Q_{ii}^{\frac{1}{2}},y,x_i),`$ (2)   
where $`y`$ and the $`x_i`$ are zero mean Gaussian random variables with covariances $`x_iy=R_i`$ and $`x_ix_j=Q_{ij}`$. We shall only consider the case where the initial values $`J_i^0`$ are picked independently from the uniform distribution on a sphere with radius $`\sqrt{P(0)}`$. Then for large $`N`$ the initial conditions for (2) are $`R_i(0)=Q_{ij}(0)=0`$ for $`ij`$ and $`Q_{ii}(0)=P(0)`$. These conditions are invariant under permutations of the site indices $`i`$ and this also holds for the system of differential equations (2). Thus this site symmetry will be preserved for all times and we need only consider the three order parameters $`R(\alpha )=R_i(\alpha )`$, $`P(\alpha )=Q_{ii}(\alpha )`$ and $`Q(\alpha )=Q_{ij}(\alpha )`$ for $`ij`$. Since the length of the students is of little interest, it will often be convenient to consider the normalized overlaps $`r(\alpha )=R(\alpha )/\sqrt{P(\alpha )}`$ and $`q(\alpha )=Q(\alpha )/P(\alpha )`$.

A new input $`\xi `$, picked from the same distribution as the training inputs, will be classified by the ensemble using a majority vote, that is by:

$$\sigma (\xi )=\text{sign}(\underset{i=1}{\overset{K}{}}\text{sign}(J_{i}^{\alpha N}{}_{}{}^{T}\xi )).$$
(3)   
As an alternative to using a majority vote, one might consider constructing a new classifier by averaging the weight vectors of the students, setting $`\overline{J}^{\alpha N}=K^1_iJ_i^{\alpha N}`$. As in Gibbs theory  a simple application of the law of large numbers yields that the two classifiers are equivalent in the large $`K`$ limit if $`q(\alpha )=𝒪(1)`$, that is $`\sigma (\xi )=\text{sign}(\overline{J}^{\alpha N}\xi )`$ for almost all inputs. In the sequel we shall only consider the large $`K`$ limit, assuming that $`KN`$ so that the fluctuations in the site symmetry of the initial conditions can be ignored. The generalization error $`ϵ_\mathrm{e}`$ of the ensemble, that is the probability of misclassifying $`\xi `$, is then given by $`ϵ_\mathrm{e}=ϵ(r(\alpha )/\sqrt{q(\alpha )})`$ where

$$ϵ(x)=\frac{1}{\pi }\mathrm{arccos}x.$$
(4)   
Similarly, the generalization error of a single student in the ensemble is $`ϵ_\mathrm{s}=ϵ(r(\alpha ))`$.

We shall first consider a soft version of the perceptron learning rule:

$$f=\eta |J_i^\mu |H\left(\tau ^\mu \frac{k}{\sqrt{1k^2}}\frac{J_{i}^{\mu }{}_{}{}^{T}\xi ^\mu }{|J_i^\mu |}\right)\tau ^\mu ,$$
(5)   
where $`H(x)=\frac{1}{2}\mathrm{erfc}(x/\sqrt{2})`$ and $`\eta `$ is a time dependent learning rate. For $`k=0`$ this reduces to Hebbian learning whereas $`k=1`$ yields the perceptron learning rule. Note, however, that the $`|J_i^\mu |`$ prefactor makes the dynamics invariant with respect to the scaling of the student weight vectors. From (2) one obtains for the order parameters:

$`\dot{r}`$ $`=`$ $`{\displaystyle \frac{\eta }{\sqrt{2\pi }}}(1r^2){\displaystyle \frac{\eta ^2}{2}}r\left(ϵ(kr){\displaystyle \frac{1}{2}}ϵ(k^2)\right)`$   
$`\dot{q}`$ $`=`$ $`{\displaystyle \frac{2\eta }{\sqrt{2\pi }}}r(1q)+\eta ^2\left((1q)ϵ(kr){\displaystyle \frac{1}{2}}ϵ(k^2q)+{\displaystyle \frac{q}{2}}ϵ(k^2)\right).`$ (6)   
We first consider the perceptron learning rule i.e. $`k=1`$. In the limit $`r,q1`$ one finds $`\dot{r}\eta \sqrt{2/\pi }(1r)\eta ^2ϵ(r)/2`$ and $`\dot{q}\eta \sqrt{2/\pi }(1q)\eta ^2ϵ(q)/2`$, that is $`r`$ and $`q`$ satisfy the same differential equation. If the learning rate schedule is such that this limit is reached, this means that that $`(1r)/(1q)`$ will approach $`1`$ for large $`\alpha `$. Hence asymptotically $`ϵ_\mathrm{e}ϵ(\sqrt{r(\alpha )})`$, and the same improvement by a factor of $`1/\sqrt{2}`$ in the generalization error of the ensemble compared to single student performance is found as in Gibbs learning. (Interestingly the same asymptotic relationship between $`ϵ_\mathrm{e}`$ and $`ϵ_\mathrm{s}`$ also holds for the Adatron learning rule $`f=\mathrm{\Theta }(\tau ^\mu J_{i}^{\mu }{}_{}{}^{T}\xi ^\mu )J_{i}^{\mu }{}_{}{}^{T}\xi ^\mu `$). The optimal asymptotics of the learning rate schedule is $`\eta 2\sqrt{2\pi }/\alpha `$ and this yields an $`ϵ_\mathrm{e}\frac{2\sqrt{2}}{\pi \alpha }0.90/\alpha `$ decay of the ensemble generalization error. This is very close to the $`0.88/\alpha `$ decay found for the optimal single student algorithm .

We next consider improving the performance by tuning $`k`$. From (6) one easily sees that single student performance is optimized when $`k=r`$. Asymptotically this may be achieved by setting $`k14/\alpha ^2`$ and choosing the optimal learning schedule which is asymptotically the same as for the standard perceptron learning rule. Then already a single student achieves $`ϵ_\mathrm{s}\frac{2\sqrt{2}}{\pi \alpha }`$, that is the same large $`\alpha `$ behaviour as the ensemble in the $`k=1`$ case. Unfortunately $`r`$ and $`q`$ now have a different asymptotics and one finds $`1q1r`$. So for all practical purposes the ensemble collapses to a single point and for large $`\alpha `$ to leading order $`ϵ_\mathrm{e}ϵ_\mathrm{s}`$.

It is of course not clear that optimizing single student performance is a good idea, and we thus analyze more generic schedules, setting $`k1(\lambda /\alpha )^2`$. Figure 1 then, however, shows that the two case considered above are optimal for ensemble and respectively single student performance.

The above analysis of the soft perceptron rule suggests that while for some rules using an ensemble does significantly improve on single student performance, for more optimized rules this may no longer be the case. We shall now prove that the generalization error of the optimal single student learning rule is also a lower bound of the ensemble performance for any learning rule $`f`$. To achieve this, a learning rule $`\stackrel{~}{f}`$ will be given which for each pattern yields the ensemble average of $`f`$. Then a single student $`\stackrel{~}{J}^\mu `$ using $`\stackrel{~}{f}`$ will have generalization behaviour equal to that of a large ensemble of students using $`f`$. The dynamics for $`\stackrel{~}{J}^\mu `$ may be written as

$$\stackrel{~}{J}^{\mu +1}=\stackrel{~}{J}^\mu +\xi ^\mu N^1\stackrel{~}{f}(\mu /N,B^T\xi ^\mu ,\stackrel{~}{J}_{}^{\mu }{}_{}{}^{T}\xi ^\mu )$$
(7)   
where $`\stackrel{~}{f}`$ is the following integral transform of $`f`$:

$$\stackrel{~}{f}(\alpha ,y,\stackrel{~}{x})=f(\alpha ,P(\alpha )^{\frac{1}{2}},y,\stackrel{~}{x}+(P(\alpha )Q(\alpha ))^{\frac{1}{2}}z)_z.$$
(8)   
Here the distribution of $`z`$ is normal. The entire procedure is quite intuitive: $`\stackrel{~}{J}^\mu `$ represents the center of mass of the ensemble and $`\stackrel{~}{J}_{}^{\mu }{}_{}{}^{T}\xi ^\mu +(P(\alpha )Q(\alpha ))^{\frac{1}{2}}z`$ is a guess for the value of the hidden field $`J_{i}^{\mu }{}_{}{}^{T}\xi ^\mu `$ of one of the ensemble members. For large $`K`$ the distribution of the last two quantities will be the same, and the ensemble average of $`f`$ can be reliably predicted. Further, note that the class of soft perceptron rules (5) is invariant under the integral transform (8) since $`H(a+bz)_z=H(a/\sqrt{1+b^2})`$. This explains why optimizing single student and optimizing ensemble performance within this class yields the same generalization behaviour.

To demonstrate that $`\stackrel{~}{J}^\mu `$ does indeed emulate the large ensemble consider the order parameters $`\stackrel{~}{R}(\alpha )=B^T\stackrel{~}{J}^{\alpha N}`$ and $`\stackrel{~}{Q}(\alpha )=|\stackrel{~}{J}^{\alpha N}|^2`$. We shall start with $`\stackrel{~}{J}^0=0`$ , thus $`\stackrel{~}{R}(0)=R(0)=\stackrel{~}{Q}(0)=Q(0)=0`$, and it will suffice to show that the pair $`\stackrel{~}{R},\stackrel{~}{Q}`$ satisfies an identical differential equation as the pair $`R,Q`$. From (2) we obtain for Q:

$$\dot{Q}=2x_if(\alpha ,P(\alpha )^{\frac{1}{2}},y,x_j)+f(\alpha ,P(\alpha )^{\frac{1}{2}},y,x_i)f(\alpha ,P(\alpha )^{\frac{1}{2}},y,x_j)_{y,x_i,x_j}$$
(9)   
where $`i`$ and $`j`$ are any two different indices. The Gaussians $`x_i`$ and $`x_j`$ may be rewritten in terms of normal random variables $`z_i,z_j`$ and $`z`$, independent of each other and of $`y`$, as

$$x_i=\sqrt{PQ}z_i+\sqrt{QR^2}z+Ry\text{ and }x_j=\sqrt{PQ}z_j+\sqrt{QR^2}z+Ry.$$
(10)   
Carrying out the integrations over $`z_i`$ and $`z_j`$ in (9) yields

$$\dot{Q}=2\stackrel{~}{x}\stackrel{~}{f}(\alpha ,y,\stackrel{~}{x})+\stackrel{~}{f}(\alpha ,y,\stackrel{~}{x})^2_{y,z},$$
(11)   
where $`\stackrel{~}{x}\sqrt{QR^2}z+Ry`$. The variance of $`\stackrel{~}{x}`$ is $`Q`$ and its covariance with $`y`$ is $`R`$. Applying (2) to $`\stackrel{~}{J}^\mu `$ yields $`\dot{\stackrel{~}{Q}}=2\stackrel{~}{x}\stackrel{~}{f}(\alpha ,y,\stackrel{~}{x})+\stackrel{~}{f}(\alpha ,y,\stackrel{~}{x})^2_{y,\stackrel{~}{x}}`$, where the variance of $`\stackrel{~}{x}`$ is $`\stackrel{~}{Q}`$ and its covariance with $`y`$ is $`\stackrel{~}{R}`$. Thus $`Q`$ and $`\stackrel{~}{Q}`$ satisfy the same differential equation and an analogous argument shows that the same holds for $`R`$ and $`\stackrel{~}{R}`$.

It is interesting to ask whether the above equivalence between ensemble and single student behaviour carries over to more general situations. Let us first consider allowing interactions between the ensemble members. In this case much more complicated scenarios can arise. However, if one only considers global and symmetric interactions between the ensemble members, an equivalent single student rule will often exist. To be specific assume that $`f`$ may in addition depend on the output of the entire ensemble (3). This just amounts to allowing $`f`$ to depend on the random variable $`\stackrel{~}{x}`$, and with only minor modifications the above construction will again yield an equivalent single student rule.

Next consider more general architectures than the simple perceptron. It is straightforward to generalize the construction to the case of a tree committee machine: one just has to carry out an integration analogous to (8) per branch of the tree. The case of the tree parity machine, however, is more involved since due to a gauge symmetry, students with differing weight vectors can implement the same function. Thus averaging the output of the ensemble members (3) may no longer be equivalent to averaging the weight vectors. But it is straightforward to break the symmetry in a formal way by adding a small deterministic drift term of the form $`B\delta N^1`$ to the update equations (1) of each branch. Then for $`\delta >0`$ the same procedure as for the tree committee will yield an equivalent single student rule. In the end, one will of course want to take the limit $`\delta 0`$. In this limit, however, for a training set size which is on the order of the number of free parameters in a single student, only a trivial generalization behaviour will result . So this procedure does not allow us to make any statement about the equivalence between ensemble and single student performance for the large training sets needed to achieve a nontrivial behaviour. It does, however, show that the pathological divergence of the training times which results from the symmetry, cannot be overcome by the use of an ensemble. Similar remarks as for the tree parity machine apply to fully connected architectures.

So in sharp contrast to batch learning where ensemble performance is often superior to single student performance, in online learning one cannot improve on optimal single student performance through an ensemble. But obviously if the state space of the learning system where large enough to store the entire training set, online learning would reduce to the batch case. So an ensemble may simply not be an effective way making use of a state space which is larger than in the case of a single student, and future research should investigate more efficient strategies of utilizing a large state space.

It is a pleasure to acknowledge helpful discussions with Manfred Opper and David Saad.