# Difference between revisions of "stat946w18/Self Normalizing Neural Networks"

Line 84: | Line 84: | ||

Using the above property, the exact form for <math display="inline">g</math> can be obtained using the definitions for mean and variance of continuous random variables: | Using the above property, the exact form for <math display="inline">g</math> can be obtained using the definitions for mean and variance of continuous random variables: | ||

− | [[File:gmapping.png| | + | [[File:gmapping.png|600px]] |

Analytical solutions for the integrals can be obtained as follows: | Analytical solutions for the integrals can be obtained as follows: | ||

− | [[File:gintegral.png| | + | [[File:gintegral.png|600px]] |

The authors are interested in the fixed point <math display="inline">(\mu, \nu) = (0, 1)</math> as these are the parameters associated with the common standard normal distribution. The authors also proposed using normalized weights such that <math display="inline">\omega = \sum_{i = 1}^n = 0</math> and <math display="inline">\tau = \sum_{i = 1}^n w_i^2= 1</math> as it gives a simpler, cleaner expression for <math display="inline">\widetilde{\mu}</math> and <math display="inline">\widetilde{\nu}</math> in the calculations in the next steps. This weight scheme can be achieved in several ways, for example, by drawing from a normal distribution <math display="inline">\mathcal{N}(0, \frac{1}{n})</math> or from a uniform distribution <math display="inline">U(-\sqrt{3}, \sqrt{3})</math>. | The authors are interested in the fixed point <math display="inline">(\mu, \nu) = (0, 1)</math> as these are the parameters associated with the common standard normal distribution. The authors also proposed using normalized weights such that <math display="inline">\omega = \sum_{i = 1}^n = 0</math> and <math display="inline">\tau = \sum_{i = 1}^n w_i^2= 1</math> as it gives a simpler, cleaner expression for <math display="inline">\widetilde{\mu}</math> and <math display="inline">\widetilde{\nu}</math> in the calculations in the next steps. This weight scheme can be achieved in several ways, for example, by drawing from a normal distribution <math display="inline">\mathcal{N}(0, \frac{1}{n})</math> or from a uniform distribution <math display="inline">U(-\sqrt{3}, \sqrt{3})</math>. | ||

Line 130: | Line 130: | ||

From the mean value theorem, we know that for a <math display="inline">t \in [0, 1]</math>, | From the mean value theorem, we know that for a <math display="inline">t \in [0, 1]</math>, | ||

− | [[File:seq.png| | + | [[File:seq.png|600px]] |

Therefore, the distance of the singular value at <math display="inline">S(\mu, \omega, \nu, \tau, \lambda_{\mathrm{01}}, \alpha_{\mathrm{01}})</math> and at <math display="inline">S(\mu + \Delta\mu, \omega + \Delta\omega, \nu + \Delta\nu, \tau \Delta\tau, \lambda_{\mathrm{01}}, \alpha_{\mathrm{01}})</math> can be bounded above by | Therefore, the distance of the singular value at <math display="inline">S(\mu, \omega, \nu, \tau, \lambda_{\mathrm{01}}, \alpha_{\mathrm{01}})</math> and at <math display="inline">S(\mu + \Delta\mu, \omega + \Delta\omega, \nu + \Delta\nu, \tau \Delta\tau, \lambda_{\mathrm{01}}, \alpha_{\mathrm{01}})</math> can be bounded above by | ||

− | [[File:seq2.png| | + | [[File:seq2.png|600px]] |

An upper bound was obtained for each partial derivative term above, mainly through algebraic reformulations and by making use of the fact that many of the functions are monotonically increasing or decreasing on the variables they depend on in <math display="inline">\Omega</math> (see pages 17 - 25 in the supplementary materials). | An upper bound was obtained for each partial derivative term above, mainly through algebraic reformulations and by making use of the fact that many of the functions are monotonically increasing or decreasing on the variables they depend on in <math display="inline">\Omega</math> (see pages 17 - 25 in the supplementary materials). | ||

Line 189: | Line 189: | ||

'''Proof:''' According to the mean value theorem, for a <math display="inline">t \in [0, 1]</math>, | '''Proof:''' According to the mean value theorem, for a <math display="inline">t \in [0, 1]</math>, | ||

− | [[File:th3.png| | + | [[File:th3.png|700px]] |

Similar to the proof for Theorem 2 (except we are interested in the smallest <math display="inline">\widetilde{\nu}</math> instead of the biggest), the lower bound for <math display="inline">\frac{\partial }{\partial \nu} \widetilde{\xi}(\mu,\omega,\nu+t(\nu_{\mathrm{min}}-\nu),\tau,\lambda_{\rm 01},\alpha_{\rm 01})</math> can be derived, and substituted into the relationship <math display="inline">\widetilde{\nu} = \widetilde{\xi}(\mu,\omega,\nu,\tau,\lambda_{\rm 01},\alpha_{\rm 01}) - (\widetilde{\mu}(\mu,\omega,\nu,\tau,\lambda_{\rm 01},\alpha_{\rm 01}))^2</math>. The lower bound depends on <math display="inline">\tau</math> and <math display="inline">\nu</math>, and in the <math display="inline">\Omega^{-1}</math> listed, it is slightly above <math display="inline">\nu</math>. | Similar to the proof for Theorem 2 (except we are interested in the smallest <math display="inline">\widetilde{\nu}</math> instead of the biggest), the lower bound for <math display="inline">\frac{\partial }{\partial \nu} \widetilde{\xi}(\mu,\omega,\nu+t(\nu_{\mathrm{min}}-\nu),\tau,\lambda_{\rm 01},\alpha_{\rm 01})</math> can be derived, and substituted into the relationship <math display="inline">\widetilde{\nu} = \widetilde{\xi}(\mu,\omega,\nu,\tau,\lambda_{\rm 01},\alpha_{\rm 01}) - (\widetilde{\mu}(\mu,\omega,\nu,\tau,\lambda_{\rm 01},\alpha_{\rm 01}))^2</math>. The lower bound depends on <math display="inline">\tau</math> and <math display="inline">\nu</math>, and in the <math display="inline">\Omega^{-1}</math> listed, it is slightly above <math display="inline">\nu</math>. |

## Revision as of 00:49, 2 March 2018

## Contents

- 1 Introduction and Motivation
- 2 Notations
- 3 Key Concepts
- 4 Proving the Self-Normalizing Property
- 5 Implementation Details
- 6 Experimental Results
- 7 Future Work
- 8 Critique
- 9 Conclusion
- 10 References
- 11 Online Resources
- 12 Footnotes

## Introduction and Motivation

While neural networks have been making a lot of headway in improving benchmark results and narrowing the gap with human-level performance, success has been fairly limited to visual and sequential processing tasks through advancements in convolutional network and recurrent network structures. Most data science competitions outside of those domains are still being won by algorithms such as gradient boosting and random forests. The traditional (densely connected) feed-forward neural networks (FNNs) are rarely used competitively, and when they do win on the rare occasions, they are won with very shallow networks with just up to four layers [10].

The authors, Klambauer et al., believe that what prevents FNNs from becoming more useful is the inability to train a deeper FNN structure, which would allow the network to learn more levels of abstract representations. To have a deeper network, oscillations in the distribution of activations need to be kept under control so that stable gradients can be obtained during training. Several techniques are available to normalize activations, including batch normalization[6], layer normalization [1] and weight normalization[8]. These methods work well with CNNs and RNNs, but not so much with FNNs because backpropagating through normalization parameters introduces additional variance to the gradients, and regularization techniques like dropout further perturb the normalization effect. CNNs and RNNs are less sensitive to such perturbations, presumably due to their weight sharing architecture, but FNNs do not have such property, and thus suffer from high variance in training errors, which hinders learning. Furthermore, the aforementioned normalization techniques involving adding external layers to the model and can slow down computations.

Therefore, the authors were motivated to develop a new FNN implementation that can achieve the intended effect of normalization techniques that works well with stochastic gradient descent and dropout. Self-normalizing neural networks are based on the idea of scaled exponential linear units (SELU), a new activation function introduced in this paper, whose output distribution is proved to converge to a fixed point, thus making it possible to train deeper networks.

## Notations

As the paper (primarily in the supplementary materials) comes with lengthy proofs, important notations are listed first.

Consider two fully-connected layers, let [math]x[/math] denote the inputs to the second layer, then [math]z = Wx[/math] represents the network inputs of the second layer, and [math]y = f(z)[/math] represents the activations in the second layer.

Assume that all [math]x_i[/math]'s, [math]1 \leqslant i \leqslant n[/math], have mean [math]\mu := \mathrm{E}(x_i)[/math] and variance [math]\nu := \mathrm{Var}(x_i)[/math] and that each [math]y[/math] has mean [math]\widetilde{\mu} := \mathrm{E}(y)[/math] and variance [math]\widetilde{\nu} := \mathrm{Var}(y)[/math], then let [math]g[/math] be the set of functions that maps [math](\mu, \nu)[/math] to [math](\widetilde{\mu}, \widetilde{\nu})[/math].

For the weight vector [math]w[/math], [math]n[/math] times the mean of the weight vector is [math]\omega := \sum_{i = 1}^n \omega_i[/math] and [math]n[/math] times the second moment is [math]\tau := \sum_{i = 1}^{n} w_i^2[/math].

## Key Concepts

### Self-Normalizing Neural-Net (SNN)

*A neural network is self-normalizing if it possesses a mapping [math]g: \Omega \rightarrow \Omega[/math] for each activation [math]y[/math] that maps mean and variance from one layer to the next and has a stable and attracting fixed point depending on [math](\omega, \tau)[/math] in [math]\Omega[/math]. Furthermore, the mean and variance remain in the domain [math]\Omega[/math], that is [math]g(\Omega) \subseteq \Omega[/math], where [math]\Omega = \{ (\mu, \nu) | \mu \in [\mu_{min}, \mu_{max}], \nu \in [\nu_{min}, \nu_{max}] \}[/math]. When iteratively applying the mapping [math]g[/math], each point within [math]\Omega[/math] converges to this fixed point.*

In other words, in SNNs, if the inputs from an earlier layer ([math]x[/math]) already have their mean and variance within a predefined interval [math]\Omega[/math], then the activations to the next layer ([math]y = f(z = Wx)[/math]) should remain within those intervals. This is true across all pairs of connecting layers as the normalizing effect gets propagated through the network, hence why the term self-normalizing. When the mapping is applied iteratively, it should draw the mean and variance values closer to a fixed point within [math]\Omega[/math], the value of which depends on [math]\omega[/math] and [math]tau[/math] (recall that they are from the weight vector).

The activation function that makes an SNN possible should meet the following four conditions:

- It can take on both negative and positive values, so it can normalize the mean;
- It has a saturation region, so it can dampen variances that are too large;
- It has a slope larger than one, so it can increase variances that are too small; and
- It is a continuous curve, which is necessary for the fixed point to exist (see the definition of Banach fixed point theorem to follow).

Commonly used activation functions such as rectified linear units (ReLU), sigmoid, tanh, leaky ReLUs and exponential linear units (ELUs) do not meet all four criteria, therefore, a new activation function is needed.

### Scaled Exponential Linear Units (SELUs)

One of the main ideas introduced in this paper is the SELU function. As the name suggests, it is closely related to ELU [3],

\[ \mathrm{elu}(x) = \begin{cases} x & x > 0 \\ \alpha e^x - \alpha & x \leqslant 0 \end{cases} \]

but further builds upon it by introducing a new scale parameter $\lambda$ and proving the exact values that $\alpha$ and $\lambda$ should take on to achieve self-normalization. SELU is defined as:

\[ \mathrm{selu}(x) = \lambda \begin{cases} x & x > 0 \\ \alpha e^x - \alpha & x \leqslant 0 \end{cases} \]

SELUs meet all four criteria listed above - it takes on positive values when [math]x \gt 0[/math] and negative values when [math]x \lt 0[/math], it has a saturation region when [math]x[/math] is a larger negative value, the value of [math]\lambda[/math] can be set to greater than one to ensure a slope greater than one, and it is continuous at [math]x = 0[/math].

Figure 1 below gives an intuition for how SELUs normalize activations across layers. As shown, a variance dampening effect occurs when inputs are negative and far away from zero, and a variance increasing effect occurs when inputs are close to zero.

Figure 2 below plots the progression of training error on the MNIST and CIFAR10 datasets when training with SNNs versus FNNs with batch normalization at varying model depths. As shown, FNNs that adopted the SELU activation function exhibited lower and less variable training loss compared to using batch normalization, even as the depth increased to 16 and 32 layers.

### Banach Fixed Point Theorem and Contraction Mappings

The underlying theory behind SNNs is the Banach fixed point theorem, which states the following: *Let [math](X, d)[/math] be a non-empty complete metric space with a contraction mapping [math]f: X \rightarrow X[/math]. Then [math]f[/math] has a unique fixed point [math]x_f \subseteq X[/math] with [math]f(x_f) = x_f[/math]. Every sequence [math]x_n = f(x_{n-1})[/math] with starting element [math]x_0 \subseteq X[/math] converges to the fixed point: [math]x_n \underset{n \rightarrow \infty}\rightarrow x_f[/math].*

A contraction mapping is a function [math]f: X \rightarrow X[/math] on a metric space [math]X[/math] with distance [math]d[/math], such that for all points [math]\mathbf{u}[/math] and [math]\mathbf{v}[/math] in [math]X[/math]: [math]d(f(\mathbf{u}), f(\mathbf{v})) \leqslant \delta d(\mathbf{u}, \mathbf{v})[/math], for a [math]0 \leqslant \delta \leqslant 1[/math].

The easiest way to prove a contraction mapping is usually to show that the spectral norm [12] of its Jacobian is less than 1 [13], as was done for this paper.

## Proving the Self-Normalizing Property

### Mean and Variance Mapping Function

[math]g[/math] is derived under the assumption that [math]x_i[/math]'s are independent but not necessarily having the same mean and variance (2). Under this assumption (and recalling earlier notation of [math]\omega[/math] and [math]\tau[/math]),

\begin{align} \mathrm{E}(z = \mathbf{w}^T \mathbf{x}) = \sum_{i = 1}^n w_i \mathrm{E}(x_i) = \mu \omega \end{align}

\begin{align} \mathrm{Var}(z) = \mathrm{Var}(\sum_{i = 1}^n w_i x_i) = \sum_{i = 1}^n w_i^2 \mathrm{Var}(x_i) = \nu \sum_{i = 1}^n w_i^2 = \nu\tau \textrm{ .} \end{align}

When the weight terms are normalized, [math]z[/math] can be viewed as a weighted sum of [math]x_i[/math]'s. Wide neural net layers with a large number of nodes is common, so [math]n[/math] is usually large, and by the Central Limit Theorem, [math]z[/math] approaches a normal distribution [math]\mathcal{N}(\mu\omega, \sqrt{\nu\tau})[/math].

Using the above property, the exact form for [math]g[/math] can be obtained using the definitions for mean and variance of continuous random variables:

Analytical solutions for the integrals can be obtained as follows:

The authors are interested in the fixed point [math](\mu, \nu) = (0, 1)[/math] as these are the parameters associated with the common standard normal distribution. The authors also proposed using normalized weights such that [math]\omega = \sum_{i = 1}^n = 0[/math] and [math]\tau = \sum_{i = 1}^n w_i^2= 1[/math] as it gives a simpler, cleaner expression for [math]\widetilde{\mu}[/math] and [math]\widetilde{\nu}[/math] in the calculations in the next steps. This weight scheme can be achieved in several ways, for example, by drawing from a normal distribution [math]\mathcal{N}(0, \frac{1}{n})[/math] or from a uniform distribution [math]U(-\sqrt{3}, \sqrt{3})[/math].

At [math]\widetilde{\mu} = \mu = 0[/math], [math]\widetilde{\nu} = \nu = 1[/math], [math]\omega = 0[/math] and [math]\tau = 1[/math], the constants [math]\lambda[/math] and [math]\alpha[/math] from the SELU function can be solved for - [math]\lambda_{01} \approx 1.0507[/math] and [math]\alpha_{01} \approx 1.6733[/math]. These values are used throughout the rest of the paper whenever an expression calls for [math]\lambda[/math] and [math]\alpha[/math].

### Self-Normalizing Property Under Normalized Weights

With the weights normalized, it is possible to calculate the exact value for the spectral norm [12] of [math]g[/math]'s Jacobian around the fixed point [math](\mu, \nu) = (0, 1)[/math], which turns out to be [math]0.7877[/math]. Thus, at initialization, SNNs have a stable and attracting fixed point at [math](0, 1)[/math], which means that when [math]g[/math] is applied iteratively to a pair [math](\mu_{new}, \nu_{new})[/math], it should draw the points closer to [math](0, 1)[/math]. The rate of convergence is determined by the spectral norm [12], whose value depends on [math]\mu[/math], [math]\nu[/math], [math]\omega[/math] and [math]\tau[/math].

### Self-Normalizing Property Under Unnormalized Weights

As weights are updated during training, there is no guarantee that they would remain normalized. The authors addressed this issue through the first key theorem presented in the paper, which states that a fixed point close to (0, 1) can still be obtained if [math]\mu[/math], [math]\nu[/math], [math]\omega[/math] and [math]\tau[/math] are restricted to a specified range.

Additionally, there is no guarantee that the mean and variance of the inputs would stay within the range given by the first theorem, which led to the development of theorems #2 and #3. These two theorems established an upper and lower bound on the variance of inputs if the variance of activations from the previous layer are above or below the range specified, respectively. This ensures that the variance would not explode or vanish after being propagated through the network.

The theorems come with lengthy proofs in the supplementary materials for the paper. High-level proof sketches are presented here.

#### Theorem 1: Stable and Attracting Fixed Points Close to (0, 1)

**Definition:** We assume [math]\alpha = \alpha_{01}[/math] and [math]\lambda = \lambda_{01}[/math]. We restrict the range of the variables to the domain [math]\mu \in [-0.1, 0.1][/math], [math]\omega \in [-0.1, 0.1][/math], [math]\nu \in [0.8, 1.5][/math], and [math]\tau \in [0.9, 1.1][/math]. For [math]\omega = 0[/math] and [math]\tau = 1[/math], the mapping has the stable fixed point [math](\mu, \nu) = (0, 1[/math]. For other [math]\omega[/math] and [math]\tau[/math], g has a stable and attracting fixed point depending on [math](\omega, \tau)[/math] in the [math](\mu, \nu)[/math]-domain: [math]\mu \in [-0.03106, 0.06773][/math] and [math]\nu \in [0.80009, 1.48617][/math]. All points within the [math](\mu, \nu)[/math]-domain converge when iteratively applying the mapping to this fixed point.

**Proof:** In order to show the the mapping [math]g[/math] has a stable and attracting fixed point close to [math](0, 1)[/math], the authors again applied Banach's fixed point theorem, which states that a contraction mapping on a nonempty complete metric space that does not map outside its domain has a unique fixed point, and that all points in the [math](\mu, \nu)[/math]-domain converge to the fixed point when [math]g[/math] is iteratively applied.

The two requirements are proven as follows:

**1. g is a contraction mapping.**

For [math]g[/math] to be a contraction mapping in [math]\Omega[/math] with distance [math]||\cdot||_2[/math], there must exist a Lipschitz constant [math]M \lt 1[/math] such that:

\begin{align} \forall \mu, \nu \in \Omega: ||g(\mu) - g(\nu)||_2 \leqslant M||\mu - \nu||_2 \end{align}

As stated earlier, [math]g[/math] is a contraction mapping if the spectral norm [12] of the Jacobian [math]\mathcal{H}[/math] (3) is below one, or equivalently, if the the largest singular value of [math]\mathcal{H}[/math] is less than 1.

To find the singular values of [math]\mathcal{H}[/math], the authors used an explicit formula derived by Blinn [2] for [math]2\times2[/math] matrices, which states that the largest singular value of the matrix is [math]\frac{1}{2}(\sqrt{(a_{11} + a_{22}) ^ 2 + (a_{21} - a{12})^2} + \sqrt{(a_{11} - a_{22}) ^ 2 + (a_{21} + a{12})^2})[/math].

For [math]\mathcal{H}[/math], an expression for the largest singular value of [math]\mathcal{H}[/math], made up of the first-order partial derivatives of the mapping [math]g[/math] with respect to [math]\mu[/math] and [math]\nu[/math], can be derived given the analytical solutions for [math]\widetilde{\mu}[/math] and [math]\widetilde{\nu}[/math] (and denoted [math]S(\mu, \omega, \nu, \tau, \lambda, \alpha)[/math]).

From the mean value theorem, we know that for a [math]t \in [0, 1][/math],

Therefore, the distance of the singular value at [math]S(\mu, \omega, \nu, \tau, \lambda_{\mathrm{01}}, \alpha_{\mathrm{01}})[/math] and at [math]S(\mu + \Delta\mu, \omega + \Delta\omega, \nu + \Delta\nu, \tau \Delta\tau, \lambda_{\mathrm{01}}, \alpha_{\mathrm{01}})[/math] can be bounded above by

An upper bound was obtained for each partial derivative term above, mainly through algebraic reformulations and by making use of the fact that many of the functions are monotonically increasing or decreasing on the variables they depend on in [math]\Omega[/math] (see pages 17 - 25 in the supplementary materials).

The [math]\Delta[/math] terms were then set (rather arbitrarily) to be: [math]\Delta \mu=0.0068097371[/math], [math]\Delta \omega=0.0008292885[/math], [math]\Delta \nu=0.0009580840[/math], and [math]\Delta \tau=0.0007323095[/math]. Plugging in the upper bounds on the absolute values of the derivative terms for [math]S[/math] and the [math]\Delta[/math] terms yields

\[ S(\mu + \Delta \mu,\omega + \Delta \omega,\nu + \Delta \nu,\tau + \Delta \tau,\lambda_{\rm 01},\alpha_{\rm 01}) - S(\mu,\omega,\nu,\tau,\lambda_{\rm 01},\alpha_{\rm 01}) < 0.008747 \]

Next, the largest singular value is found from a computer-assisted fine grid-search (1) over the domain [math]\Omega[/math], with grid lengths [math]\Delta \mu=0.0068097371[/math], [math]\Delta \omega=0.0008292885[/math], [math]\Delta \nu=0.0009580840[/math], and [math]\Delta \tau=0.0007323095[/math], which turned out to be [math]0.9912524171058772[/math]. Therefore,

\[ S(\mu + \Delta \mu,\omega + \Delta \omega,\nu + \Delta \nu,\tau + \Delta \tau,\lambda_{\rm 01},\alpha_{\rm 01}) \leq 0.9912524171058772 + 0.008747 < 1 \]

Since the largest singular value is smaller than 1, [math]g[/math] is a contraction mapping.

**2. g does not map outside its domain.**

To prove that [math]g[/math] does not map outside of the domain [math]\mu \in [-0.1, 0.1][/math] and [math]\nu \in [0.8, 1.5][/math], lower and upper bounds on [math]\widetilde{\mu}[/math] and [math]\widetilde{\nu}[/math] were obtained to show that they stay within [math]\Omega[/math].

First, it was shown that the derivatives of [math]\widetilde{\mu}[/math] and [math]\widetilde{\xi}[/math] with respect to [math]\mu[/math] and [math]\nu[/math] are either positive or have the sign of [math]\omega[/math] in [math]\Omega[/math], so the minimum and maximum points are found at the borders. In [math]\Omega[/math], it then follows that

\begin{align} -0.03106 <\widetilde{\mu}(-0.1,0.1, 0.8, 0.95, \lambda_{\rm 01}, \alpha_{\rm 01}) \leq & \widetilde{\mu} \leq \widetilde{\mu}(0.1,0.1,1.5, 1.1, \lambda_{\rm 01}, \alpha_{\rm 01}) < 0.06773 \end{align}

and

\begin{align} 0.80467 <\widetilde{\xi}(-0.1,0.1, 0.8, 0.95, \lambda_{\rm 01}, \alpha_{\rm 01}) \leq & \widetilde{\xi} \leq \widetilde{\xi}(0.1,0.1,1.5, 1.1, \lambda_{\rm 01}, \alpha_{\rm 01}) < 1.48617. \end{align}

Since [math]\widetilde{\nu} = \widetilde{\xi} - \widetilde{\mu}^2[/math],

\begin{align} 0.80009 & \leqslant \widetilde{\nu} \leqslant 1.48617 \end{align}

The bounds on [math]\widetilde{\mu}[/math] and [math]\widetilde{\nu}[/math] are narrower than those for [math]\mu[/math] and [math]\nu[/math] set out in [math]\Omega[/math], therefore [math]g(\Omega) \subseteq \Omega[/math].

#### Theorem 2: Decreasing Variance from Above

**Definition:** For [math]\lambda = \lambda_{01}[/math], [math]\alpha = \alpha_{01}[/math], and the domain [math]\Omega^+: -1 \leqslant \mu \leqslant 1, -0.1 \leqslant \omega \leqslant 0.1, 3 \leqslant \nu \leqslant 16[/math], and [math]0.8 \leqslant \tau \leqslant 1.25[/math], we have for the mapping of the variance [math]\widetilde{\nu}(\mu, \omega, \nu, \tau, \lambda, \alpha)[/math] under [math]g[/math]: [math]\widetilde{\nu}(\mu, \omega, \nu, \tau, \lambda, \alpha) \lt \nu[/math].

Theorem 2 states that when [math]\nu \in [3, 16][/math], the mapping [math]g[/math] draws it to below 3 when applied across layers, thereby establishing an upper bound of [math]\nu \lt 3[/math] on variance.

**Proof:** The authors proved the inequality by showing that [math]g(\mu, \omega, \xi, \tau, \lambda_{01}, \alpha_{01}) = \widetilde{\xi}(\mu, \omega, \xi, \tau, \lambda_{01}, \alpha_{01}) - \nu \lt 0[/math], since the second moment should be greater than or equal to variance [math]\widetilde{\nu}[/math]. The behavior of [math]\frac{\partial }{\partial \mu } \widetilde{\xi}(\mu, \omega, \nu, \tau, \lambda, \alpha)[/math], [math]\frac{\partial }{\partial \omega } \widetilde{\xi}(\mu, \omega, \nu, \tau, \lambda, \alpha)[/math], [math]\frac{\partial }{\partial \nu } \widetilde{\xi}(\mu, \omega, \nu, \tau, \lambda, \alpha)[/math], and [math]\frac{\partial }{\partial \tau } \widetilde{\xi}(\mu, \omega, \nu, \tau, \lambda, \alpha)[/math] are used to find the bounds on [math]g(\mu, \omega, \xi, \tau, \lambda_{01}, \alpha_{01})[/math] (see pages 9 - 13 in the supplementary materials). Again, the partial derivative terms were monotonic, which made it possible to find the upper bound at the board values. It was shown that the maximum value of [math]g[/math] does not exceed [math]-0.0180173[/math].

#### Theorem 3: Increasing Variance from Below

**Definition**: We consider [math]\lambda = \lambda_{01}[/math], [math]\alpha = \alpha_{01}[/math], and the domain [math]\Omega^-: -0.1 \leqslant \mu \leqslant 0.1[/math] and [math]-0.1 \leqslant \omega \leqslant 0.1[/math]. For the domain [math]0.02 \leqslant \nu \leqslant 0.16[/math] and [math]0.8 \leqslant \tau \leqslant 1.25[/math] as well as for the domain [math]0.02 \leqslant \nu \leqslant 0.24[/math] and [math]0.9 \leqslant \tau \leqslant 1.25[/math], the mapping of the variance [math]\widetilde{\nu}(\mu, \omega, \nu, \tau, \lambda, \alpha)[/math] increases: [math]\widetilde{\nu}(\mu, \omega, \nu, \tau, \lambda, \alpha) \gt \nu[/math].

Theorem 3 states that the variance [math]\widetilde{\nu}[/math] increases when variance is smaller than in [math]Omega[/math]. The lower bound on variance is [math]\widetilde{\nu} \gt 0.16[/math] when [math]0.8 \leqslant \tau[/math] and [math]\widetilde{\nu} \gt 0.24[/math] when [math]0.9 \leqslant \tau[/math] under the proposed mapping.

**Proof:** According to the mean value theorem, for a [math]t \in [0, 1][/math],

Similar to the proof for Theorem 2 (except we are interested in the smallest [math]\widetilde{\nu}[/math] instead of the biggest), the lower bound for [math]\frac{\partial }{\partial \nu} \widetilde{\xi}(\mu,\omega,\nu+t(\nu_{\mathrm{min}}-\nu),\tau,\lambda_{\rm 01},\alpha_{\rm 01})[/math] can be derived, and substituted into the relationship [math]\widetilde{\nu} = \widetilde{\xi}(\mu,\omega,\nu,\tau,\lambda_{\rm 01},\alpha_{\rm 01}) - (\widetilde{\mu}(\mu,\omega,\nu,\tau,\lambda_{\rm 01},\alpha_{\rm 01}))^2[/math]. The lower bound depends on [math]\tau[/math] and [math]\nu[/math], and in the [math]\Omega^{-1}[/math] listed, it is slightly above [math]\nu[/math].

## Implementation Details

### Initialization

As previously explained, SNNs work best when inputs to the network are standardized, and the weights are initialized with mean of 0 and variance of [math]\frac{1}{n}[/math] to help converge to the fixed point [math](\mu, \nu) = (0, 1)[/math].

### Dropout Technique

The authors reason that dropout, the act of randomly setting activations to 0 with probability [math]1 - q[/math], is not compatible with SELUs because the low variance region in SELUs is at [math]\lim_{x \rightarrow -\infty} = -\lambda \alpha[/math], not 0 (contrast this with ReLUs, which fits well with dropout and have [math]\lim_{x \rightarrow -\infty} = 0[/math] as the saturation region). Additionally, activations need to be transformed (e.g. scaled) after dropout to maintain the same mean and variance. Therefore, a new dropout technique for SELUs was needed, termed *alpha dropout*.

With alpha dropout, activations are randomly set to [math]-\lambda\alpha = \alpha'[/math], or [math]1.7581[/math], by drawing from a Bernoulli distribution [math]d \sim B(1, q)[/math].

The updated mean and variance of the activations are now: \[ \mathrm{E}(xd + \alpha'(1 - d)) = \mu q + \alpha'(1 - q) \]

and

\[ \mathrm{Var}(xd + \alpha'(1 - d)) = q((1-q)(\alpha' - \mu)^2 + \nu) \]

To ensure that mean and variance are unchanged after dropout, the authors used an affine transformation [math]a(xd + \alpha'(1 - d) + b[/math], and solved for the values of [math]a[/math] and [math]b[/math] to give [math]a = (\frac{\nu}{q((1-q)(\alpha' - \mu)^2 + \nu)})^{\frac{1}{2}}[/math] and [math]b = \mu - a(q\mu + (1-q)\alpha'))[/math]. As the values for [math]\mu[/math] and [math]\nu[/math] are set to [math]0[/math] and [math]1[/math] throughout the paper, these expressions can be simplified into [math]a = (q + \alpha'^2 q(1-q))^{-\frac{1}{2}}[/math] and [math]b = -(q + \alpha^2 q (1-q))^{-\frac{1}{2}}((1 - q)\alpha')[/math], where [math]\alpha' \approx 1.7581[/math].

Empirically, the authors found that dropout rates of [math]0.05[/math] or [math]0.10[/math] worked well with SNNs.

### Optimizers

Through experiments, the authors found that stochastic gradient descent, momentum, Adadelta and Adamax work well on SNNs. For Adam, configuration parameters [math]\beta_2 = 0.99[/math] and [math]\epsilon = 0.01[/math] were found to be more effective.

## Experimental Results

Three sets of experiments were conducted to compare the performance of SNNs to six other FNN structures and to other machine learning algorithms, such as support vector machines and random forests. The experiments were carried out on (1) 121 UCI Machine Learning Repository datasets, (2) the Tox21 chemical compounds toxicity effects dataset (with 12,000 compounds and 270,000 features), and (3) the HTRU2 dataset of statistics on radio wave signals from pulsar candidates (with 18,000 observations and eight features). In each set of experiment, hyperparameter search was conducted on a validation set to select parameters such as the number of hidden units, number of hidden layers, learning rate, regularization parameter, and dropout rate (see pages 95 - 107 of the supplementary material for exact hyperparameters considered). Whenever models of different setups gave identical results on the validation data, preference was given to the structure with more layers, lower learning rate and higher dropout rate.

The six FNN structures considered were: (1) FNNs with ReLU activations, no normalization and “Microsoft weight initialization” (MSRA) [5] to control the variance of input signals [5]; (2) FNNs with batch normalization [6], in which normalization is applied to activations of the same mini-batch; (3) FNNs with layer normalization [1], in which normalization is applied on a per layer basis for each training example; (4) FNNs with weight normalization [8], whereby each layer’s weights are normalized by learning the weight’s magnitude and direction instead of the weight vector itself; (5) highway networks, in which layers are not restricted to being sequentially connected [9]; and (6) an FNN-version of residual networks [4], with residual blocks made up of two or three densely connected layers.

On the Tox21 dataset, the authors demonstrated the self-normalizing effect by comparing the distribution of neural inputs [math]z[/math] at initialization and after 40 epochs of training to that of the standard normal. As Figure 3 show, the distribution of [math]z[/math] remained similar to a normal distribution.

On all three sets of classification tasks, the authors demonstrated that SNN outperformed the other FNN counterparts on accuracy and AUC measures, came close to the state-of-the-art results on the Tox21 dataset with an 8-layer network, and produced a new state-of-the-art AUC on predicting pulsars for the HTRU2 dataset by a small margin (achieving an AUC 0.98, averaged over 10 cross-validation folds, versus the previous record of 0.976).

On UCI datasets with fewer than 1,000 observations, SNNs did not outperform SVMs or random forests in terms of average rank in accuracy, but on datasets with at least 1,000 observations, SNNs showed the best overall performance (average rank of 5.8, compared to 6.1 for support vector machines and 6.6 for random forests). Through hyperparameter tuning, it was also discovered that the average depth of FNNs is 10.8 layers, more than the other FNN architectures tried.

## Future Work

Although not the focus of this paper, the authors also briefly noted that their initial experiments with applying SELUs on relatively simple CNN structures showed promising results, which is not surprising given that ELUs, which do not have the self-normalizing property, has already been shown to work well with CNNs, demonstrating faster convergence than ReLU networks and even pushing the state-of-the-art error rates on CIFAR-100 at the time of publishing in 2015 [3].

Since the paper was published, SELUs have been adopted by several researchers, not just with FNNs see link, but also with CNNs, GANs, autoencoders, reinforcement learning and RNNs. In a few cases, researchers for those papers concluded that networks trained with SELUs converged faster than those trained with ReLUs, and that SELUs have the same convergence quality as batch normalization. There is potential for SELUs to be incorporated into more architectures in the future.

## Critique

Overall, the authors presented a convincing case for using SELUs (along with proper initialization and alpha dropout) on FNNs. FNNs trained with SELU have more layers than those with other normalization techniques, so the work here provides a promising direction for making traditional FNNs more powerful. There are not as many well-established benchmark datasets to evaluate FNNs, but the experiments carried out, particularly on the larger Tox21 dataset, showed that SNNs can be very effective at classification tasks.

The only question I have with the proofs is the lack of explanation for how the domains, [math]\Omega[/math], [math]\Omega^-[/math] and [math]\Omega^+[/math] are determined, which is an important consideration because they are used for deriving the upper and lower bounds on expressions needed for proving the three theorems. The ranges appear somewhat set through trial-and-error and heuristics to ensure the numbers work out (e.g. make the spectral norm [12] of [math]\mathcal{J}[/math] as large as can be below 1 so as to ensure [math]g[/math] is a contraction mapping), so it is not clear whether they are unique conditions, or that the parameters will remain within those prespecified ranges throughout training; and if the parameters can stray away from the ranges provided, then the issue of what will happen to the self-normalizing property was not addressed. Perhaps that is why the authors gave preference to models with a deeper structure and smaller learning rate during experiments to help the parameters stay within their domains. Further, in addition to the hyperparameters considered, it would be helpful to know the final values that went into the best-performing models, for a better understanding of what range of values work better for SNNs empirically.

## Conclusion

The SNN structure proposed in this paper is built on the traditional FNN structure with a few modifications, including the use of SELUs as the activation function (with [math]\lambda \approx 1.0507[/math] and [math]\alpha \approx 1.6733[/math]), alpha dropout, network weights initialized with mean of zero and variance [math]\frac{1}{n}[/math], and inputs normalized to mean of zero and variance of one. It is simple to implement while being backed up by detailed theory.

When properly initialized, SELUs will draw neural inputs towards a fixed point of zero mean and unit variance as the activations are propagated through the layers. The self-normalizing property is maintained even when weights deviate from their initial values during training (under mild conditions). When the variance of inputs goes beyond the prespecified range imposed, they are still bounded above and below so SNNs do not suffer from exploding and vanishing gradients. This self-normalizing property allows SNNs to be more robust to perturbations in stochastic gradient descent, so deeper structures with better prediction performance can be built.

In the experiments conducted, the authors demonstrated that SNNs outperformed FNNs trained with other normalization techniques, such as batch, layer and weight normalization, and specialized architectures, such as highway or residual networks, on several classification tasks, including on the UCI Machine Learning Repository datasets. The adoption of SELUs by other researchers also lends credence to the potential for SELUs to be implemented in more neural network architectures.

## References

- Ba, Kiros and Hinton. "Layer Normalization". arXiv:1607.06450. (2016).
- Blinn. "Consider the Lowly 2X2 Matrix." IEEE Computer Graphics and Applications. (1996).
- Clevert, Unterthiner, Hochreiter. "Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs)." arXiv: 1511.07289. (2015).
- He, Zhang, Ren and Sun. "Deep Residual Learning for Image Recognition." arXiv:1512.03385. (2015).
- He, Zhang, Ren and Sun. "Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification." arXiv:1502.01852. (2015)
- Ioffe and Szegedy. "Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariance Shift." arXiv:1502.03167. (2015).
- Klambauer, Unterthiner, Mayr and Hochreiter. "Self-Normalizing Neural Networks." arXiv: 1706.02515. (2017).
- Salimans and Kingma. "Weight Normalization: A Simple Reparameterization to Accelerate Training of Deep Neural Networks." arXiv:1602.07868. (2016).
- Srivastava, Greff and Schmidhuber. "Highway Networks." arXiv:1505.00387 (2015).
- Unterthiner, Mayr, Klambauer and Hochreiter. "Toxicity Prediction Using Deep Learning." arXiv:1503.01445. (2015).
- https://en.wikipedia.org/wiki/Central_limit_theorem
- http://mathworld.wolfram.com/SpectralNorm.html
- https://www.math.umd.edu/~petersd/466/fixedpoint.pdf

## Online Resources

https://github.com/bioinf-jku/SNNs (GitHub repository maintained by some of the paper's authors)

## Footnotes

1. Error propagation analysis: The authors performed an error analysis to quantify the potential numerical imprecisions propagated through the numerous operations performed. The potential imprecision [math]\epsilon[/math] was quantified by applying the mean value theorem

\[ |f(x + \Delta x - f(x)| \leqslant ||\triangledown f(x + t\Delta x|| ||\Delta x|| \textrm{ for } t \in [0, 1]\textrm{.} \]

The error propagation rules, or [math]|f(x + \Delta x - f(x)|[/math], was first obtained for simple operations such as addition, subtraction, multiplication, division, square root, exponential function, error function and complementary error function. Them, the error bounds on the compound terms making up [math]\Delta (S(\mu, \omega, \nu, \tau, \lambda, \alpha)[/math] were found by decomposing them into the simpler expressions. If each of the variables have a precision of [math]\epsilon[/math], then it turns out [math]S[/math] has a precision better than [math]292\epsilon[/math]. For a machine with a precision of [math]2^{-56}[/math], the rounding error is [math]\epsilon \approx 10^{-16}[/math], and [math]292\epsilon \lt 10^{-13}[/math]. In addition, all computations are correct up to 3 ulps (“unit in last place”) for the hardware architectures and GNU C library used, with 1 ulp being the highest precision that can be achieved.

2. Independence Assumption: The classic definition of central limit theorem requires [math]x_i[/math]’s to be independent and identically distributed, which is not guaranteed to hold true in a neural network layer. However, according to the Lyapunov CLT, the [math]x_i[/math]’s do not need to be identically distributed as long as the [math](2 + \delta)[/math]th moment exists for the variables and meet the Lyapunov condition for the rate of growth of the sum of the moments [11]. In addition, CLT has also shown to be valid under weak dependence under mixing conditions [11]. Therefore, the authors argue that the central limit theorem can be applied with network inputs.

3. [math]\mathcal{H}[/math] versus [math]\mathcal{J}[/math] Jacobians: In solving for the largest singular value of the Jacobian [math]\mathcal{H}[/math] for the mapping [math]g: (\mu, \nu)[/math], the authors first worked with the terms in the Jacobian [math]\mathcal{J}[/math] for the mapping [math]h: (\mu, \nu) \rightarrow (\widetilde{\mu}, \widetilde{\xi})[/math] instead, because the influence of [math]\widetilde{\mu}[/math] on [math]\widetilde{\nu}[/math] is small when [math]\widetilde{\mu}[/math] is small in [math]\Omega[/math] and [math]\mathcal{H}[/math] can be easily expressed as terms in [math]\mathcal{J}[/math]. [math]\mathcal{J}[/math] was referenced in the paper, but I used [math]\mathcal{H}[/math] in the summary here to avoid confusion.