# Difference between revisions of "RMSProp"

Author: Jason Huang (SysEn 6800 Fall 2020)

Steward: Allen Yang, Fengqi You

## Introduction

RMSProp, so call root mean square propagation, is an optimization algorithm/method dealing with Artificial Neural Network (ANN) for machine learning. It is also a currently developed algorithm compared to the Stochastic Gradient Descent (SGD) algorithm, momentum method. And even one of the foundations of Adam algorithm development. It is an unpublished optimization algorithm, using the adaptive learning rate method, first proposed in the Coursera course “Neural Network for Machine Learning” lecture six by Geoff Hinton. Astonished is that this informally revealed, an unpublished algorithm is intensely famous nowadays.

## Theory and Methodology

Artificial Neural Network

Artificial Neural Network can be regarded as the human brain and conscious center of Aritifical Intelligence(AI), presenting the imitation of what the mind will be when human thinking. Scientists are trying to build the concept of ANN close real neurons with their biological ‘parent’.

A single neuron presented as a mathematic function

And the function of neurons can be presented as:

${\displaystyle f(x_{1},x_{2})=max(0,w_{1}x_{1}+w_{2}x_{2})}$

Where ${\displaystyle x_{1},x_{2}}$ are two inputs numbers, and function ${\displaystyle f(x_{1},x_{2})}$ will takes these fixed inputs and create an output of single number. If ${\displaystyle w_{1}x_{1}+w_{2}x_{2}}$ is greater than 0, the function will return this positive value, or return 0 otherwise. Therefore, the neural network can be replaced as a coupled mathematical function, and its output of a previous function can be used as the next function input.

RProp

RProp, or we call Resilient Back Propagation, is the widely used algorithm for supervised learning with multi-layered feed-forward networks in the past. Besides, its concepts is the foundation of RMSPRop development t. The derivatives equation of error function can be represented as:

${\displaystyle {\frac {\partial E}{\partial w_{ij}}}={\frac {\partial E}{\partial s_{i}}}{\frac {\partial s_{i}}{\partial net_{i}}}{\frac {\partial net_{i}}{\partial w_{ij}}}}$

Where ${\displaystyle w_{ij}}$ is the weight from neuron ${\displaystyle j}$ to neuron ${\displaystyle i}$, ${\displaystyle s_{i}}$ is the output , and ${\displaystyle net_{i}}$ is the weighted sum of the inputs of neurons ${\displaystyle i}$. Once the weight of each partial derivatives is known, the error function can be presented by performing a simple gradient descent:

${\displaystyle w_{ij}(t+1)=w_{ij}(t)-\epsilon {\frac {\partial E}{\partial w_{ij}}}(t)}$

(reference required)

Obviously, the choice of the learning rate ${\displaystyle \epsilon }$, which scales the derivative, has an important effect on the time needed until convergence is reached. If it is set too small, too many steps are needed to reach an acceptable solution; on the contrary a large learning rate will possibly lead to oscillation, preventing the error to fall below a certain value.

In addition, RProp can combine the method with momentum method, to prevent above problem and to accelerate the convergence rate, the equation can rewrite as:

${\displaystyle \Delta w_{ij}(t)=\epsilon {\frac {\partial E}{\partial w_{ij}}}(t)+\Delta w_{ij}(t-1)}$

However, It turns out that the optimal value of the momentum parameter ${\displaystyle \mu }$ is equally problem dependent as the learning rate ${\displaystyle \epsilon }$, and that no general improvement can be accomplished. Besides, RProp algorithm is not function well when we have very large datasets and need to perform mini-batch weights updates.

RMSProp

RProp algorithm doesn’t work for mini-batches is that it violates the central idea behind stochastic gradient descent, which is when we have small enough learning rate, it averages the gradients over successive mini-batches. To solve this issue, consider the weight, that gets the gradient 0.1 on nine mini-batches, and the gradient of -0.9 on tenths mini-batch, RMSProp did force those gradients to roughly cancel each other out, so that the stay approximately the same.

By using the sign of gradient from RProp algorithm, and the mini-batches efficiency, and averaging over mini-batches which allows to combine gradients in the right way. PMSProp is keep the moving average of the squared gradients for each weight. And then we divide the gradient by square root the mean square.

The updated equation can be performed as:

${\displaystyle E[g^{2}](t)=\beta E[g^{2}](t-1)+(1-\beta )({\frac {\partial c}{\partial w}})^{2}}$

${\displaystyle w_{ij}(t)=w_{ij}(t-1)-{\frac {\eta }{\sqrt {E[g^{2}]}}}{\frac {\partial c}{\partial w_{ij}}}}$

where ${\displaystyle E[g]}$ is the moving average of squared gradients, ${\displaystyle \delta c/\delta w}$ is gradient of the cost function with respect to the weight, ${\displaystyle \eta }$ is the learning rate and ${\displaystyle \beta }$ is moving average parameter (default value — 0.9).

The equation adapt the learning rate by dividing by the squared gradients, However, since we only have the estimate of the gradient on the current mini-batch, we need instead to use the moving average, which is set as default 0.9, of it.

## Numerical Example

2D RMSProp Example

For the 2-Dimension of how RMSProp function, refer to "Dive into Deep Learning website". In the link, the implementation of function ${\displaystyle f(x)=0.1x_{1}^{1}+2x_{2}^{2}}$ is well presented.

For the specific package supporting RMSProp in python, refer to Python keras.optimizers.RMSprop() Examples for both 3D and 2D implementation.

## Applicants and Discussion

Visualizing Optimization algorithm comparing convergence with similar algorithm1
Visualizing Optimization algorithm comparing covergence with similar algorithm1

gradients based optimization algorithm has different convergence rate. As the visualizations shown, the without scaling based on gradient information algorithms are hard to break the symmetry and converge rapidly. RMSProp has a relative converge rate than others, but it is not the fastest one.