Author: Dhruv Shrivastava
In the field of mathematic modelling, a radial basis function network is an artificial neural network that uses radial basis functions as activation functions. Radial basis function neural network is distinguished from other neural networks due to their universal approximation and faster learning speed. Radial basis functions networks have many uses, including function approximation, time series prediction, classification, and system control.
Introduction:
Radial basis functions network was formulated by Broomhead and Lowe in 1988. Radial basis function (RBFs) has only one hidden layer and the convergence of optimization is much faster than other neural networks, and despite having one hidden layer. RBF network in its simplest form is a three-layer feedforward neural network consisting of first layer which corresponds to the inputs of the network, the second is hidden layer and the third layer is final output of the network.
![](https://static.wixstatic.com/media/nsplsh_41706679557a3563355130~mv2_d_3543_2317_s_2.jpg/v1/fill/w_980,h_641,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/nsplsh_41706679557a3563355130~mv2_d_3543_2317_s_2.jpg)
This paper provides a detailed introduction to Radial Basis Function along with the mathematical and algorithmic development, then a comparison between RBF and MLP (multi-layer perceptron). We will also train RBF network to predict the customer’s response to subscription for term deposit.
Architecture of RBF:
Radial basis function (RBF) networks typically have three layers: an input layer, a hidden layer consists of hidden neurons, and activation function of these neurons is a Gaussian function. Hidden layer generates a signal which corresponds to an input vector in the input layer and corresponding to this signal the network generates a response output.
Design and Development:
To generate an output, neuron process the input signal through a function called activation function. In RBF activation function of hidden neuron is φ(X) i.e., for an input vector X output produced by the hidden neuron will be φ(X).
![](https://static.wixstatic.com/media/6e3b57_c33d948bfee2413083ecfae9782e161b~mv2.jpg/v1/fill/w_304,h_182,al_c,q_80,enc_auto/6e3b57_c33d948bfee2413083ecfae9782e161b~mv2.jpg)
Fig-1.
![](https://static.wixstatic.com/media/6e3b57_ea4a708bd17e432f9cefcb8675d0fd64~mv2.jpg/v1/fill/w_248,h_84,al_c,q_80,enc_auto/6e3b57_ea4a708bd17e432f9cefcb8675d0fd64~mv2.jpg)
Above figure represents a Gaussian neural activation for 1-D input x and with mean . Here φ(x) represents output of gaussian node given value of x.From above figure we can clearly see that the signal strength decreases because the input (X) moves far away from the middle.
The basic idea of this model is that the whole feature vector space is partitioned by Gaussian neural nodes, where each node generates a sign like an input vector, and strength of the signal produced by each neuron depends on the space between its center and therefore the input vector. Also, for inputs lying closer in Euclidian vector space, the output signals that are generated must be similar.
![](https://static.wixstatic.com/media/6e3b57_72632bbdd7f84d97a9587511ec66acb6~mv2.jpg/v1/fill/w_408,h_90,al_c,q_80,enc_auto/6e3b57_72632bbdd7f84d97a9587511ec66acb6~mv2.jpg)
Here, is center of the neuron and X is response of the neuron corresponding to input X. In RBF architecture, weights connecting input vector to hidden neurons represents the center of the corresponding neuron. These weights are predetermined such that the entire space is covered by the receptive field of these neurons, whereas values of weights connecting hidden neurons to output neurons are determined to train network.
![](https://static.wixstatic.com/media/6e3b57_4cd3dea7361f4951a92818cc27a60bb6~mv2.jpg/v1/fill/w_384,h_210,al_c,q_80,enc_auto/6e3b57_4cd3dea7361f4951a92818cc27a60bb6~mv2.jpg)
Fig-2.
It will good if vectors lying close in Euclidian space fall under the receptive area of same neuron therefore, we will determine the centre of hidden neuron using k-mean clustering.
K-means Clustering algorithm:
Select the number of cluster centres K.
Randomly select the k points in dataset and set them as K centroids of the data.
Determine the centroid closest to it for all data points.
Calculate the average of all points lying closest to the same centroid.
Change the value of all centroids to corresponding averages values.
Go to step 3 until convergence.
The range of receptive fields is chosen such that entire domain of input vector is covered by the receptive field of the neurons. So, the value of sigma is chosen according to maximum distance d between two hidden neurons.
![](https://static.wixstatic.com/media/6e3b57_3ca7aa83ed814809ae1beec02f2d9a01~mv2.jpg/v1/fill/w_265,h_106,al_c,q_80,enc_auto/6e3b57_3ca7aa83ed814809ae1beec02f2d9a01~mv2.jpg)
Where d is the max distance and M is the number of hidden neurons.
Mathematical Development:
Let gij be an element of matrix G representing the output of j^th neuron for ithinput vector and Wij be an element of matrix W representing the weight connecting i^th output neuron to j^th hidden neuron. In Radial basis function, the activation function of output neuron is linear that is “g(z)=z” where z is the weighted summation of signals from hidden layer. Multiplying i^th row of G and j^th columns of W do the weighted summation of signals from hidden layer which is equal to signal produced by j^th output neuron.
GW =T
Where T is a column vector and ithrows contain the target value of ith training vector.
From above equation using pseudo inverse
![](https://static.wixstatic.com/media/6e3b57_d7c81d9fe30f4fe68dabaf29db5e291e~mv2.jpg/v1/fill/w_348,h_63,al_c,q_80,enc_auto/6e3b57_d7c81d9fe30f4fe68dabaf29db5e291e~mv2.jpg)
where G^T is the transpose of matrix G.
Algorithm:
Define number of hidden neurons “K”.
Set the positions of RBF centres using K-means clustering algorithm.
Calculate using equation 2.
Calculate actions of RBF node using equation (1).
Train the output using equation (3).
RBF vs MLP:
MLPs (Multi Layered perceptron) are better than RBFs when the underlying characteristics feature of data is embedded deep inside very high dimensional sets for example, in image recognition etc.
RBFs have much faster convergence rate as compared to MLPs because RBFs have only one hidden layer.
RBF network is usually preferred over MLPs for low dimensional data where deep feature extraction is not required and results are directly correlated with the components of input vector.
Unlike most machine learning model RBF is a robust learning model.
Classification more time in RBF than MLP.
![](https://static.wixstatic.com/media/6e3b57_abfc7a20b94d4575a293734d7c242fb8~mv2.jpg/v1/fill/w_352,h_264,al_c,q_80,enc_auto/6e3b57_abfc7a20b94d4575a293734d7c242fb8~mv2.jpg)
Fig-3: Classification in MLP vs RBF.
Implementation:
Predicting a client’s response from his/her characteristics details like age, job, education, marital status etc requires years of experience and learning. Here an RBF based AI implementation on bank marketing dataset is presented. We will try to predict whether or not a client will subscribe for a term deposit.
Classes: There is two “yes” and “no” corresponding to the response of client.
Step1: Import all necessary packages:
![](https://static.wixstatic.com/media/6e3b57_45367c63cc194fac94c2745928b5f617~mv2.jpg/v1/fill/w_980,h_272,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/6e3b57_45367c63cc194fac94c2745928b5f617~mv2.jpg)
Step2: Read the data from the file and encode the label using LabelEncoder:
![](https://static.wixstatic.com/media/6e3b57_9843e2500ce4429db511d12ca3a4a868~mv2.jpg/v1/fill/w_980,h_129,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/6e3b57_9843e2500ce4429db511d12ca3a4a868~mv2.jpg)
Step3: split the data into training and testing data:
![](https://static.wixstatic.com/media/6e3b57_570e5751965241faa4d4c9b94832fe83~mv2.jpg/v1/fill/w_980,h_204,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/6e3b57_570e5751965241faa4d4c9b94832fe83~mv2.jpg)
Step4: Scale the data using StandardScaler:
![](https://static.wixstatic.com/media/6e3b57_57fba7a6a5c2427bad91c61b02879040~mv2.jpg/v1/fill/w_722,h_105,al_c,q_80,enc_auto/6e3b57_57fba7a6a5c2427bad91c61b02879040~mv2.jpg)
Step5: Determine centres of the neurons using KMeans:
![](https://static.wixstatic.com/media/6e3b57_0925c33e0aae4e6a8ca96765830f9e7e~mv2.jpg/v1/fill/w_897,h_146,al_c,q_80,enc_auto/6e3b57_0925c33e0aae4e6a8ca96765830f9e7e~mv2.jpg)
Step6: Determine
![](https://static.wixstatic.com/media/6e3b57_6261528797af4e1f9bcadba0d208dafb~mv2.jpg/v1/fill/w_810,h_316,al_c,q_80,enc_auto/6e3b57_6261528797af4e1f9bcadba0d208dafb~mv2.jpg)
Step7: Set up matrix G:
![](https://static.wixstatic.com/media/6e3b57_05bc9302bb2f4e19a16cc519819bdf1f~mv2.jpg/v1/fill/w_980,h_276,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/6e3b57_05bc9302bb2f4e19a16cc519819bdf1f~mv2.jpg)
Step8: Find weight matrix W to train the network:
![](https://static.wixstatic.com/media/6e3b57_2a2b60c9115d489daff47bc624a5227a~mv2.jpg/v1/fill/w_850,h_150,al_c,q_80,enc_auto/6e3b57_2a2b60c9115d489daff47bc624a5227a~mv2.jpg)
Step9: Set up matrix G for the test data:
![](https://static.wixstatic.com/media/6e3b57_167584e2deda468cb4a88485d36d7d76~mv2.jpg/v1/fill/w_980,h_226,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/6e3b57_167584e2deda468cb4a88485d36d7d76~mv2.jpg)
Step10: Analyse the accuracy of prediction on test set:
![](https://static.wixstatic.com/media/6e3b57_2acc019e7c374391b3ecc368d3303273~mv2.jpg/v1/fill/w_980,h_162,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/6e3b57_2acc019e7c374391b3ecc368d3303273~mv2.jpg)
Conclusion:
With RBF we got a prediction accuracy pf 88% and so is the cause with MLP. But, the computational cost of training MLP is higher than RBF hence it is better to use RBF instead of MLP.
GitHub Link:
https://github.com/dhruv20032000/Radial-Basis-neural-network
References:
https://www.hackerearth.com/blog/developers/radial-basis-function-network/
https://towardsdatascience.com/radial-basis-functions-neural-networks-all-we-need-to-know-9a88cc053448
https://www.google.com/imgres?imgurl=https%3A%2F%2Fblog-c7ff.kxcdn.com%2Fblog%2Fwp-content%2Fuploads%2F2017%2F01%2FCapture-22.png&imgrefurl=https%3A%2F%2Fwww.hackerearth.com%2Fblog%2Fdevelopers%2Fradial-basis-function-network%2F&tbnid=Ec-EjF8cC2jANM&vet=12ahUKEwjR0b22nOfxAhW_s0sFHahBAvcQMygoegUIARCFAg..i&docid=K3wToKS1VWbIDM&w=511&h=306&q=radial%20basis%20functions%20neural%20networks&ved=2ahUKEwjR0b22nOfxAhW_s0sFHahBAvcQMygoegUIARCFAg
https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.researchgate.net%2Ffigure%2FArchitecture-of-the-RBF-neural-network-RBF-radial-basis-function_fig2_333469185&psig=AOvVaw2woGDCHYtcwjfoe6ve_6MO&ust=1626512246097000&source=images&cd=vfe&ved=0CAsQjRxqFwoTCJDq4Oac5_ECFQAAAAAdAAAAABAI
https://ieeexplore.ieee.org/abstract/document/1215400
https://www.google.com/url?sa=i&url=https%3A%2F%2Fslideplayer.com%2Fslide%2F5867042%2F&psig=AOvVaw0yx0kkLpJ5dvSk9_de4wSw&ust=1626522606565000&source=images&cd=vfe&ved=0CAsQjRxqFwoTCNCLi4PD5_ECFQAAAAAdAAAAABAD
Commentaires