Optimizing the classification prediction of probabilistic neural network PNN based on the cuckoo algorithm – code attached
Article directory
 Classification prediction of probabilistic neural network PNN based on cuckoo algorithm optimization – code attached

 1. Overview of PNN network
 2. Related background of transformer fault diagnosis system

 2.1 Model establishment
 3. PNN network based on cuckoo optimization
 5.Test results
 6. References
 7.Matlab code
Abstract: Aiming at the smooth factor selection problem of PNN neural network, the cuckoo algorithm is used to optimize the selection of smooth factors of PNN neural network and applied to transformer fault diagnosis.
1.PNN network overview
Probabilistic neural networks (PNN) was first proposed by Dr. D. F. Specht in 1989. It is a parallel algorithm developed based on the Bayes classification rule and the probability density surface number estimation method of the Parzen window. It is a type of artificial neural network that is simple in construction, concise in training, and widely used. In practical applications, especially in applications that solve classification problems, the advantage of PNN is to use linear learning algorithms to complete the work that nonlinear learning algorithms are proud of, while maintaining the high accuracy and other characteristics of nonlinear algorithms; this kind of network corresponds to The weight is the distribution of pattern samples, and the network does not require training, so it can meet the requirements of realtime processing during training.
The PNN network is a feedforward neural network developed from the radial basis function network. Its theoretical basis is Bayesian minimum risk criterion (Bayesian decision theory). As a type of radial basis network, PNN Suitable for pattern classification. When the value of distribution density SPREAD is close to 0, it forms a nearest neighbor classifier; when the value of SPREAD is large, it forms a neighbor classifier for several training samples. The hierarchical model of PNN consists of 4 layers: input layer, pattern layer, summation layer, and output layer. Its basic structure is shown in Figure 1.
f
(
X
,
w
i
)
=
e
x
p
[
?
(
X
?
w
i
)
T
(
X
?
W
i
)
/
2
δ
]
(1)
f(X,w_i)=exp[(Xw_i)^T(XW_i)/2\delta]\tag{1}
f(X,wi?)=exp[?(X?wi?)T(X?Wi?)/2δ](1)
In the formula,
w
i
w_i
wi? is the weight of the connection from the input layer to the mode layer;
δ
\delta
δ is the smoothing factor, which plays a vital role in classification. The third layer is the summation layer, which accumulates the probability of belonging to a certain category and calculates according to Equation (1), thereby obtaining the estimated probability density function of the failure mode. Each class has only one summation layer unit, and the summation layer unit is connected to the pattern layer unit belonging to its own class only, but has no connection with other units in the pattern layer. Therefore, the summation layer unit simply adds the outputs of pattern layer units belonging to its own class, regardless of the outputs of pattern layer units belonging to other classes. The output of the summation layer unit is proportional to various types of kernelbased probability density estimates. Through the normalization process of the output layer, various types of probability estimates can be obtained. The output decisionmaking layer of the network consists of a simple threshold discriminator, whose function is to select a neuron with the largest posterior probability density among the estimated probability densities of each failure mode as the output of the entire system. The output layer neuron is a kind of competitive neuron. Each neuron corresponds to a data type, that is, a failure mode. The number of output layer neurons is equal to the number of types of training sample data. It receives various types of output from the summation layer. Probability density function, the output of the neuron with the largest probability density function is 1, that is, the corresponding category is the sample pattern category to be recognized, and the outputs of other neurons are all 0.
Figure 1. PNN network structure
2. Related background of transformer fault diagnosis system
When a running transformer fails to varying degrees, abnormal phenomena or information will be generated. Fault analysis is to collect abnormal phenomena or information of the transformer and conduct analysis based on these phenomena or information to determine the type, severity and location of the fault. Therefore, the purpose of transformer fault diagnosis is first to accurately determine whether the operating equipment is currently in a normal state or an abnormal state. If the transformer is in an abnormal state and has a fault, determine the nature, type and cause of the fault. Such as insulation failure, overheating failure or mechanical failure. If it is an insulation fault, is it aging of the insulation, moisture, or a discharge fault? If it is a discharge fault, what type of discharge is it? Transformer fault diagnosis also requires predicting the possible development of the fault based on fault information or information processing results, that is, diagnosing the severity and development trend of the fault; proposing measures to control the fault to prevent and eliminate faults; proposing reasonable methods for equipment maintenance and Corresponding antiaccident measures; provide improvement suggestions for equipment design, manufacturing, assembly, etc., and provide scientific basis and suggestions for equipment modernization management.
2.1 Model establishment
In this case, after indepth analysis of the dissolved gas analysis method in oil, a fault diagnosis model based on probabilistic neural network was established based on the improved threeratio method. The data.mat in the case data is a 33 × 4dimensional matrix. The first three columns are the values of the improved threeratio method, and the fourth column is the output of the classification, which is the category of the fault. Use the first 23 samples as PNN training samples and the last 10 samples as validation samples.
3. PNN network based on cuckoo optimization
For the principle of the cuckoo algorithm, please refer to: https://blog.csdn.net/u011835903/article/details/108404684
The cuckoo algorithm is used to optimize the smoothness factor of the PNN network. The fitness function is designed as the classification error rate of the training set and the test set:
f
i
t
n
e
s
s
=
a
r
g
m
i
n
{
T
r
a
i
n
E
r
r
o
r
R
a
t
e
+
P
r
e
d
i
c
t
E
r
r
o
r
R
a
t
e
}
(2)
fitness = argmin\{TrainErrorRate + PredictErrorRate\}\tag{2}
fitness=argmin{TrainErrorRate + PredictErrorRate}(2)
The fitness function shows that the lower the classification error rate of the network, the better.
5. Test results
The cuckoo parameter settings are as follows:
%% cuckoo parameters pop=20; % population size Max_iteration=20; % Set the maximum number of iterations dim = 1;% dimension, that is, the number of weights and thresholds lb = 0.01;% lower boundary ub = 5;% upper bound
Judging from the results, cuckoopnn can obtain good classification results.
6. References
The book “MATLAB Neural Network 43 Case Analysis”, the PNN principle part comes from this book