Artificial intelligence and neural nets are widely used for solving prediction problems. General Regression Neural Networks (GRNN) is one of the type neural network that can be used
for prediction. This type of neural net is very similar to probabilistic neural net(PNN).
PNN for probabilistic classification was implemented in [1].
This article will focus on numerical example and implementation of General Regression Neural Network.
Numerical Example
Consider simple task:
we have time series 3,4,5,6,7
The next value will be 8
Now we have another sequence, which is for simplicity absolutely the same 3,4,5,6,7
and we need to predict next value. We know that it will be the same as in previous case but
let see how our GRNN will calculate it.
It has hidden layer and each neuron in this layer will calculate difference
between known case and unknown case. The difference dif will be equal 0 for each position.
The output of any hidden neuron will be
exp(-dif2) = exp(0) = 1
Let H be the number of hidden neurons in the hidden layer.
In the next layer the neuron will add all outputs which will be
1* H
Another neuron will add target value multiplied by output from hidden neurons.
Target value in our case is 8 and the output from hidden neuron is 1.
So the total sum will be
1*H*8
Finally on the next layer the neuron will divide previous two values and get 8:
Output = 1*H*8 /1 * H = 8
This is our prediction.
More Complicated Numerical Example
In the real data we will have many inputs with different target values. Let's consider
example with 2 inputs.
3,4,5,6,7 =>8
3.8, 4.8, 5.8, 6.8, 7.8 =>8.8
our test is for 3.8, 4.8, 5.8, 6.8, 7.8
where
d1=0.8 for all hidden neurons when 1st input is used
d2=0 for all hidden neurons when 2nd input is used
W(0) > W(0.8)
and 2nd input get more weight than the first resulting in the prediction more closely to 8.8
This is how GRNN works - it uses distance to calculate weight.
Radial Basis Function
The function that calculates weight based on distance is called radial basis function. [4]
In our example we used Gaussian RBF:
W(d) = exp(-b*d2) b>0
b is some numerical coefficient.
Programming General Regression Neural Networks
Now we understand how GRNN calculates output values so the program can be easy implemented.
The perl script can be found on the link below.
Any questions, suggestions, feedback are welcome at AMCSL forum