CN111797937A - Greenhouse environment assessment method based on PNN network - Google Patents
Greenhouse environment assessment method based on PNN network Download PDFInfo
- Publication number
- CN111797937A CN111797937A CN202010678726.6A CN202010678726A CN111797937A CN 111797937 A CN111797937 A CN 111797937A CN 202010678726 A CN202010678726 A CN 202010678726A CN 111797937 A CN111797937 A CN 111797937A
- Authority
- CN
- China
- Prior art keywords
- samples
- sample
- pnn
- pnn network
- training
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/23—Clustering techniques
- G06F18/232—Non-hierarchical techniques
- G06F18/2321—Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
- G06F18/23213—Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/004—Artificial life, i.e. computing arrangements simulating life
- G06N3/006—Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
Abstract
The invention provides a greenhouse environment assessment method based on a PNN network, and relates to the technical field of facility agriculture. Firstly, establishing a greenhouse environment parameter sample library, classifying the samples and then dividing the samples into training samples and testing samples; then, clustering the training samples by using an improved K-means clustering algorithm, selecting a threshold value according to the representative samples, and selecting a batch of representative samples as new training samples of the PNN network; training a PNN network after the new training samples are normalized, carrying out grade evaluation on the normalized test samples by using the trained PNN network, and calculating the error rate of classifying the test samples; and finally, enabling the same type of mode layer neurons in the PNN to adopt the same smoothing factor, enabling different types of mode layer neurons to adopt different smoothing factors, and modifying the smoothing factor of the PNN by taking the classified error rate as a target function of a particle swarm optimization algorithm to obtain an optimal PNN classification model.
Description
Technical Field
The invention relates to the technical field of facility agriculture, in particular to a greenhouse environment assessment method based on a PNN network.
Background
With the development of agricultural technology and the change of climate environment, greenhouse planting technology plays an increasingly important role in agricultural production. The greenhouse planting technology mainly has the function of providing a proper growth environment for crops in a severe outdoor environment, so that the greenhouse environment is monitored on line or off line in order to meet the requirement of crop growth, the quality of the greenhouse environment is evaluated according to expert experience, and the guidance of agricultural production is of great significance.
At present, the ubiquitous problem of the greenhouse environment comprehensive detector on the market is: the comprehensive greenhouse environment detector cannot judge the quality of the greenhouse environment according to detected data, and lacks guidance significance for users, and evaluation of the greenhouse environment quality mainly depends on human expert experience knowledge.
A Probabilistic Neural Network (PNN) is a simple-structured and widely-applied Neural Network proposed by d.f. specht in 1988, and its basic idea is as follows: and separating a decision space in the multidimensional input space by using a Bayesian minimum risk criterion. The PNN network is a feedforward neural network based on a statistical principle and taking a Parzen window function as an activation function, absorbs the advantages of a radial basis neural network and a classical probability density estimation principle, and has more remarkable advantages in mode classification compared with the traditional feedforward neural network. However, the traditional PNN network has two defects: (1) when the training samples are too many, the PNN network has higher requirements on the storage space and the computing power of the hardware, which increases the difficulty and the cost of the hardware design; (2) in a traditional PNN network, a smoothing factor has a crucial influence on the classification accuracy of the network, but the values of the smoothing factor are usually given manually, and a specific selection basis is lacked.
In the structural optimization and parameter optimization of the PNN network, the following methods are generally selected: firstly, clustering processing is carried out on training samples by using a clustering algorithm such as a K-means algorithm and the like, and a representative clustering center is used as a new training sample of the PNN network, so that the structure of the PNN network is simplified; then, assuming that the smoothing factors of the neurons in the mode layer of the PNN network have the same value, taking the classification error rate of the PNN network as an objective function, and performing parameter optimization on the smoothing factors by using an optimization algorithm such as Particle Swarm Optimization (PSO) to improve the classification accuracy of the network. However, this method has two disadvantages: (1) when the number of the clustering centers is small, the phenomenon that the classification accuracy of the PNN network is reduced due to the fact that the number of the training samples is small can be caused by using the clustering centers as new training samples of the PNN network; (2) assuming that the neuron parameters of the PNN network mode layer are the same, when the PNN network executes the classification task, the handling capacity of the difference between samples is poor, and the details of the test samples may be ignored.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a greenhouse environment assessment method based on a PNN network aiming at the defects of the prior art, so as to realize the assessment of the greenhouse environment.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows: a greenhouse environment assessment method based on a PNN network comprises the following steps:
step 1: establishing a greenhouse environment parameter sample library with the size of n, performing quality evaluation on each group of samples in the sample library according to M grades, and further dividing the n samples into M classes; the dimension of each group of samples in the sample library is q, and the dimension q respectively represents greenhouse environment parameters having important influence on plant growth;
step 2: selecting m samples from a sample library as training samples, and taking other samples (l-n-m) as test samples;
and step 3: initializing parameters in an improved K-means clustering algorithm and a particle swarm optimization algorithm;
the initialized parameters are specifically as follows: initializing cluster number K and initial cluster center in improved K-means clustering algorithmAn iteration stop threshold value, a representative sample selection threshold value alpha, a maximum iteration number J and a current iteration number J; initializing the number of particles N in a Particle Swarm Optimization (PSO), wherein the solution space dimension is D, the maximum iteration number max _ iter of the PSO algorithm is particleAn initial position vector px and an initial velocity vector pv of the child; let the position vector of the particle be denoted pxi=[pxi1,pxi2,…,pxiD],i∈[1,N]The velocity vector of the particle is expressed as pvi=[pvi1,pvi2,…,pviD]The individual optimum position at which the objective function is minimized in the current iteration is pbesti=[pbesti1,pbesti2,…,pbestiD]The optimal position of the population is gbest ═ gbest1,gbest2,…,gbestD]The minimum value of the target function experienced by the individual and the population in the iterative process is p _ fitness respectivelyiG _ fitness; initializing all smoothing factor values in the PNN network to be 0.1;
and 4, step 4: clustering the selected m training samples by using an improved K-means clustering algorithm to obtain K clustering clusters and K clustering centers, wherein the number of the samples in each cluster is mgG is 1, 2, … k; selecting a batch of representative samples from each cluster as a new training sample of the PNN network according to the representative sample selection threshold value alpha;
step 4.1: randomly selecting K sample points from m training samples as initial clustering centers of a K-means clustering algorithm
Step 4.2: setting the current iteration number as j, and carrying out comparison on each sample point p in the training sampletT is 1, 2, …, m is calculated to each cluster center in turnThe Euclidean distance d (t, g) of (1) is as follows:
step 4.3: finding each sample point about respective cluster centersAnd corresponding sample point ptDivision into and clustering centersIn the cluster with the minimum distance;
step 4.4: recalculating cluster center of each cluster by using average value methodAs shown in the following equation:
wherein p isgwRepresenting the w sample point in the g cluster;
step 4.5: calculating the square sum of the distances between the samples in each cluster and the new cluster center, wherein the following formula is shown in the specification:
wherein E isj+1Representing the sum of squares of distances between the samples in each cluster and the new cluster center;
step 4.6: judging whether the iteration number J is equal to the maximum iteration number J or | Ej+1-EjIf yes, executing the step 4.7, otherwise, executing the step 4.2 again;
step 4.7: counting the number m of samples in each clustergAnd selecting m of the nearest neighbor of each cluster center according to the sample selection threshold value alphagA, outputting alpha samples as the most representative training samples, and obtaining new training samples with p being m and alpha;
and 5: carrying out normalization processing on the new training sample;
setting a new training sample matrix X as shown in the following formula:
wherein, p represents the number of new training samples, and q represents the dimension of the new training samples;
carrying out normalization processing on the new training sample matrix X through the normalization factor matrix B to obtain a matrix C, wherein the expressions of the matrix B and the matrix C are shown as the following formula:
step 6: training the PNN according to the normalized training sample matrix C, performing grade evaluation on the normalized test samples by using the trained PNN, and calculating the error rate of classifying the test samples;
the structure of the PNN network comprises an input layer, a mode layer, a summation layer and an output layer; the input layer does not process the data and sends the data into the mode layer; the number of the neurons in the mode layer is equal to the number of the training samples, and the activation function of the neurons is a Gaussian function; the connection mode of the summation layer and the mode layer is sparse connection, and the number of neurons in the summation layer is equal to the number of classes of the training samples; the output layer selects the category corresponding to the maximum posterior probability for output according to the Bayesian decision rule;
step 6.1: constructing a mode layer of the PNN network by using the normalized training sample matrix C;
after the new training sample matrix X is normalized, a training sample matrix C is obtained, and the following formula is shown:
p training samples exist in the training matrix C and are divided into M classes, and the number of the training samples of the M classes is set to be h1,h2,…,hMThen, there are:
p=h1+h2+…+hM(8)
setting M types of samples to be sequentially arranged in a sample matrix C, and sequentially numbering each neuron of a mode layer as 1-p; number 1 to h1The neuron of (a) corresponds to the class 1 training sample with the number h1+1 sequentially to h1+h2The +1 neuron corresponds to the class 2 training sample, and the like, and the number is p-hM+1 neurons from number p in turn belong to class M samples;
step 6.2: calculating the Euclidean distance between each test sample in the test sample matrix and each training sample in the training set;
the test sample matrix T, which consists of n-m test samples and is normalized, is shown as follows:
the Euclidean distance matrix E between each test sample and each training sampledAs shown in the following equation:
step 6.3: activating neurons in a mode layer by using a radial basis function;
selecting a Gaussian function as an activation function of a neuron in a mode layer, and calculating an activated probability matrix U, wherein the probability matrix U is shown in the following formula:
wherein σ1、σ2、…σpRespectively representing the smoothing factors of p pattern layer neurons, and initially setting all the smoothing factors to have the same value, namely sigma1=σ2=…σp=0.1;
Step 6.4: solving the initial probability and matrix S of each sample to be tested belonging to each category through a summation layer, wherein the following formula is shown:
step 6.5: calculating the probability prob of the alpha-th sample to be tested belonging to the b-th class according to the initial probability sum of the samples to be tested belonging to each classabThe following formula shows:
wherein a belongs to [1, l ], b belongs to [1, M ];
step 6.6: according to Bayesian decision theorem and the probability that each sample to be detected belongs to each class, the class corresponding to the a-th sample to be detected is decided, and the following formula is shown:
ya=arg max(probab) (14)
wherein, yaThe method comprises the steps that a prediction result of a PNN network on an a-th test sample is shown, namely the category corresponding to the a-th test sample is shown;
step 6.7: calculating the error rate of the PNN network for classifying the test samples, wherein the error rate is shown in the following formula:
wherein, ER represents the error rate of the PNN network for classifying the test samples, neThe number of samples for the PNN network error classification is shown, and the number of test samples is shown by l-n-m;
and 7: the method comprises the steps that the same smooth factors are adopted by the neurons of the mode layers of the same type in the PNN network, different smooth factors are adopted by the neurons of the mode layers of different types, then the error rate ER of the PNN network for classifying test samples is used as a target function of a PSO algorithm, the smooth factor parameters in the PNN network are modified through the PSO algorithm, the PNN network is optimized, and finally an optimal PNN classification model is obtained;
step 7.1: is set atIn the beta iteration process of optimizing PNN network parameters by the PSO algorithm, firstly, the velocity vector pv is carried out on the particles in the PSO algorithmiAnd a position vector pxiIs updated as shown in the following equation:
wherein omega is an inertia weight and represents the searching capability of the particle swarm optimization algorithm; c. C1,c2Learning factors of the individual extreme point and the global extreme point respectively; mu.s1,μ2Respectively represent random numbers between 0 and 1; because the PSO algorithm optimization object is a smoothing factor adopted by each type of mode layer neuron, the particle solution space dimension D is M;
step 7.2: the updated particle position vector represents a feasible solution of the smoothing factor of the PNN network; position vector of particleReplacing the value of the smoothing factor of the PNN network, and then calculating the PNN network pairError rate of classification of corresponding test samplesAnd updating the individual optimal position information pbest experienced by the particle according to the following updating ruleiAnd the minimum value p _ fitness of the objective functioniUpdating, and updating the optimal position information gbest and the minimum value g _ fitness of the objective function which are experienced by the population;
the update rule is as follows:
if p _ fitnessiIf < g _ fit, gbest is pbesti,g_fitness=p_fitnessiOtherwise, the gbest and the g _ fixness remain unchanged;
step 7.3: when the iteration times reach the maximum iteration times max _ iter, the PSO algorithm is terminated, at the moment, the gbest represents an optimal solution of the PNN network about the smoothing factor, and the g _ fittness represents the error rate of classifying the test samples by using the gbest as the PNN network of the optimal smoothing factor; otherwise, re-executing the step 7.1;
and 8: and (4) collecting greenhouse environment data to be evaluated, and evaluating the greenhouse environment quality by adopting the optimal PNN classification model obtained in the step (7).
Adopt the produced beneficial effect of above-mentioned technical scheme to lie in: the invention provides a greenhouse environment evaluation method based on a PNN network, which applies a PNN classification model to greenhouse environment quality evaluation and makes up the current situation that a greenhouse environment comprehensive detector lacks evaluation capability; the improved K-means algorithm is utilized to perform representative sample selection on the training sample, so that the selected training sample is more representative and meets the requirement of the PNN network on the training sample; the complexity of the PNN network structure is reduced, and the difficulty of hardware implementation and storage cost are reduced; the complexity of the PNN network is reduced, and meanwhile the phenomenon that the classification accuracy of the PNN network is greatly reduced due to too few training samples is avoided. The improved PSO algorithm is utilized to carry out parameter optimization on the smoothing factors in the PNN network, the same smoothing factors are set for the mode layer neurons in the same type in the PNN network, and different smoothing factors are set for the mode layer neurons in different types, so that the classification accuracy of the PNN network is further improved.
Drawings
FIG. 1 is a flowchart of a greenhouse environment assessment method based on a PNN network according to an embodiment of the present invention;
FIG. 2 is a diagram of the environment requirements for greenhouse cucumber planting provided by the embodiment of the present invention;
fig. 3 is a schematic structural diagram of a PNN network according to an embodiment of the present invention;
fig. 4 is a diagram illustrating a classification result of a PNN network on a test sample according to an embodiment of the present invention.
Detailed Description
The following detailed description of embodiments of the present invention is provided in connection with the accompanying drawings and examples. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
In this embodiment, a greenhouse environment for planting cucumbers is taken as an example, and the greenhouse environment is evaluated by using the PNN network-based greenhouse environment evaluation method of the present invention.
A greenhouse environment assessment method based on a PNN network is shown in figure 1 and comprises the following steps:
step 1: establishing a greenhouse environment parameter sample library with the size of n, performing quality evaluation on each group of samples in the sample library according to M grades, and further dividing the n samples into M classes; the dimension of each group of samples in the sample library is q, and the dimension q respectively represents greenhouse environment parameters having important influence on plant growth;
in this example, the dimension of each group of samples in the sample library is q ═ 7, which respectively represents 7 greenhouse environment parameters having important influence on plant growth, namely air temperature, air humidity, carbon dioxide concentration, illumination intensity, soil temperature, soil humidity and soil salinity; and each group of sample data is evaluated and divided into four grades of good, medium and bad, which are respectively represented by 1, 2, 3 and 4.
In this example, the requirements of greenhouse cucumber planting on 7 environmental parameters are shown in fig. 2, and it can be seen from fig. 2 that the optimum growth conditions of greenhouse cucumbers are: the concentration of carbon dioxide is 1000-1500 ppt, the illumination intensity is 55 KLx-60 KLx, the air humidity is 70.0-80.0%, the soil humidity is 80.0-90.0%, the air temperature is 25-30 ℃, the soil temperature is 20-24 ℃, and the soil salt content is 0.5-0.8 mS/cm. In the embodiment, 1000 groups of samples of the greenhouse environment are measured by a sensor technology, and each group of samples is comprehensively evaluated, wherein part of the samples are shown in table 1;
TABLE 1 sample data in part of sample library
Step 2: selecting m samples from a sample library as training samples, and taking other samples (l-n-m) as test samples;
in the embodiment, 900 samples are selected from a sample library as training samples according to the ratio of 9: 1, and the remaining 100 samples are used as test samples;
and step 3: initializing parameters in an improved K-means clustering algorithm and a particle swarm optimization algorithm;
the initialized parameters are specifically as follows: initializing cluster number K and initial cluster center in improved K-means clustering algorithmAn iteration stop threshold value, a representative sample selection threshold value alpha, a maximum iteration number J and a current iteration number J; initializing the number N of particles in a Particle Swarm Optimization (PSO), wherein the solution space dimension is D, the maximum iteration number max _ iter of the PSO algorithm, an initial position vector px and an initial velocity vector pv of the particles; let the position vector of the particle be denoted pxi=[pxi1,pxi2,…,pxiD],i∈[1,N]The velocity vector of the particle is expressed as pvi=[pvi1,pvi2,…,pviD]The individual optimum position at which the objective function is minimized in the current iteration is pbesti=[pbesti1,pbesti2,…,pbestiD]The optimal position of the population is gbest ═ gbest1,gbest2,…,gbestD]The minimum value of the target function experienced by the individual and the population in the iterative process is p _ fitness respectivelyiG _ fitness; initializing all smoothing factor values in the PNN network to be 0.1;
in this example, from steps 1 and 2It can be known that the size of the sample library is n-1000, the dimension of each sample is q-7, the number of classes of the samples is M-4, i.e. 4 training samples of different types, the number of original training samples is M-900, and the number of test samples is l-100; meanwhile, the cluster center number K in the initialized and improved K-means algorithm is 8, the iteration stop threshold value is 0.001, the representative sample selection threshold value alpha is 0.2, the current iteration time J is 1, and the maximum iteration time J is 20; initializing the number of particles N equal to 30, the solution space dimension D equal to M equal to 4, the maximum iteration number max _ iter equal to 100 and the initial position vector px of the ith particle in the improved PSO algorithmi=[pxi1,pxi2,…,pxiD]Initial velocity vector pvi=[pvi1,pvi2,…,pviD]The optimal position of the individual is pbesti=[pbesti1,pbesti2,…,pbestiD]The optimal position of the population is gbest ═ gbest1,gbest2,…,gbestD]The minimum value of the target function experienced by the individual and the population in the iterative process is p _ fitness respectivelyiG _ fitness; the smoothing factors of the initial PNN network have the same value, and sigma is 0.1;
and 4, step 4: clustering the selected m training samples by using an improved K-means clustering algorithm to obtain K clustering clusters and K clustering centers, wherein the number of the samples in each cluster is mgG is 1, 2, … k; selecting a batch of representative samples from each cluster as a new training sample of the PNN network according to the representative sample selection threshold value alpha;
step 4.1: randomly selecting K sample points from m training samples as initial clustering centers of a K-means clustering algorithm
Step 4.2: setting the current iteration number as j, and carrying out comparison on each sample point p in the training sampletT is 1, 2, …, m is calculated to each cluster center in turnOf Europe styleDistance d (t, g), as shown in the following equation:
step 4.3: finding each sample point about respective cluster centersAnd corresponding sample point ptDivision into and clustering centersIn the cluster with the minimum distance;
step 4.4: recalculating cluster center of each cluster by using average value methodAs shown in the following equation:
wherein p isgwRepresenting the w sample point in the g cluster;
step 4.5: calculating the square sum of the distances between the samples in each cluster and the new cluster center, wherein the following formula is shown in the specification:
wherein E isj+1Representing the sum of squares of the distances between the samples in each cluster and the new cluster center, the target of the K-means algorithm can be regarded as the sum of squares of the distances in the minimized cluster;
step 4.6: judging whether the iteration time J is equal to the maximum iteration time J as 20 or | Ej+1-EjIf yes, executing step 4.7, otherwise, executing step 4.2 again;
step 4.7: counting the number m of samples in each clustergRoot of Chinese angelicaAccording to the sample selection threshold value alpha, m of the nearest neighbor of each cluster center is selectedgA, outputting alpha samples as the most representative training samples, and obtaining 180 new training samples, wherein p is m and alpha;
and 5: carrying out normalization processing on the new training sample;
setting a new training sample matrix X as shown in the following formula
Wherein, p represents the number of new training samples, q represents the dimensionality of the new training samples, and p is 180 and q is 7;
carrying out normalization processing on the new training sample matrix X through the normalization factor matrix B to obtain a matrix C, wherein the expressions of the matrix B and the matrix C are shown as the following formula:
step 6: training the PNN according to the normalized training sample matrix C, performing grade evaluation on the normalized test samples by using the trained PNN, and calculating the error rate of classifying the test samples;
the structure of the PNN network comprises an input layer, a mode layer, a summation layer and an output layer; the input layer does not process the data and sends the data into the mode layer; the number of pattern layer neurons is equal to the number of training samples, the activation function of the pattern layer neurons is a Gaussian function, and the main function of the pattern layer neurons is to calculate the matching relation between the input feature vector and each training sample in the training samples; the connection mode of the summation layer and the mode layer is sparse connection, the number of neurons in the summation layer is equal to the number of classes of training samples, and the method has the main functions of summing the outputs of the neurons in the mode layer according to classes and averaging to obtain the posterior probability of input vectors into each class according to the calculation method of the Parzen window function; the output layer is used for selecting the category corresponding to the maximum posterior probability for output according to the Bayesian decision rule;
step 6.1: constructing a mode layer of the PNN network by using the normalized training sample matrix C;
after the new training sample matrix X is normalized, a training sample matrix C is obtained, and the following formula is shown:
the training matrix C has p-180 training samples, and is divided into M-4 classes, and the number of 4 classes of training samples is set as h1,h2,h3,h4Then, there are:
p=h1+h2+h3+h4(8)
in the PNN network, the number of pattern layer neurons is determined by the training samples. So when there are p training samples in the training set, then there are p neurons in the pattern layer of the PNN as well. Setting M types of samples to be sequentially arranged in a sample matrix C, and sequentially numbering each neuron of a mode layer as 1-p; number 1 to h1The neuron of (a) corresponds to the class 1 training sample with the number h1+1 sequentially to h1+h2The +1 neuron corresponds to the class 2 training sample, and the like, and the number is p-h4+1 neurons in sequence to number p belong to class 4 samples;
in this embodiment, the structure of the PNN network is as shown in fig. 3.
Step 6.2: calculating the Euclidean distance between each test sample in the test sample matrix and each training sample in the training set;
the test sample matrix T, which is composed of 100 test samples, n-m, and is normalized, is shown as follows:
each test sample is then compared withEuclidean distance matrix E between each training sampledAs shown in the following equation:
step 6.3: activating neurons in a mode layer by using a radial basis function;
selecting a Gaussian function as an activation function of a neuron in a mode layer, and calculating an activated probability matrix U, wherein the probability matrix U is shown in the following formula:
wherein σ1、σ2、…σpThe smoothing factors of p pattern layer neurons are respectively expressed, and the value of the smoothing factor has a crucial influence on the classification accuracy of the PNN network. Initially, all smoothing factors are set to have the same value, namely sigma1=σ2=…σp=0.1;
Step 6.4: solving the initial probability and matrix S of each sample to be tested belonging to each category through a summation layer, wherein the following formula is shown:
step 6.5: calculating the probability prob of the a-th sample to be tested belonging to the b-th class according to the initial probability sum of the samples to be tested belonging to each classabThe following formula shows:
wherein a belongs to [1, l ], b belongs to [1, M ];
step 6.6: according to Bayesian decision theorem and the probability that each sample to be detected belongs to each class, the class corresponding to the a-th sample to be detected is decided, and the following formula is shown:
ya=arg max(probab) (14)
wherein, yaThe method comprises the steps that a prediction result of a PNN network on an a-th test sample is shown, namely the category corresponding to the a-th test sample is shown;
step 6.7: calculating the error rate of the PNN network for classifying the test samples, wherein the error rate is shown in the following formula:
wherein, ER represents the error rate of the PNN network for classifying the test samples, neThe number of samples for the PNN network error classification is shown, and the number of test samples is shown by l-n-m;
and 7: the method comprises the steps that the same smooth factors are adopted by the neurons of the same type in the PNN network, different smooth factors are adopted by the neurons of the different types of mode layers, then the error rate ER of the PNN network for classifying test samples is used as a target function of a PSO algorithm, the smooth factor parameters in the PNN network are modified through the PSO algorithm, the PNN network is optimized, the value of the ER is continuously reduced under limited iteration times, the purpose of optimizing the PNN network parameters is achieved, and finally an optimal PNN classification model is obtained;
step 7.1: setting the beta iteration process of optimizing PNN network parameters by the PSO algorithm, firstly carrying out velocity vector pv on particles in the PSO algorithmiAnd a position vector pxiIs updated as shown in the following equation:
wherein omega is an inertia weight and represents the searching capability of the particle swarm optimization algorithm; c. C1,c2Learning factors of the individual extreme point and the global extreme point respectively; mu.s1,μ2Respectively represent random numbers between 0 and 1; since the PSO algorithm optimizes the object thatThe smoothing factor adopted by each type of mode layer neuron, so that the spatial dimension D of the particle solution is equal to M and equal to 4;
in the present embodiment, the inertia weight ω is 0.6, and the learning factor c1=c2=2;
Step 7.2: the updated particle position vector represents a feasible solution of the smoothing factor of the PNN network; position vector of particleReplacing the value of the smoothing factor of the PNN network, and then calculating the classification error rate of the PNN network to the test sample according to the step 6 to calculate the PNN network pairError rate of classification of corresponding test samplesAnd updating the individual optimal position information pbest experienced by the particle according to the following updating ruleiAnd the minimum value p _ fitness of the objective functioniUpdating, and updating the optimal position information gbest and the minimum value g _ fitness of the objective function which are experienced by the population;
the update rule is as follows:
if p _ fitnessiIf < g _ fit, gbest is pbesti,g_fitness=p_fitnessiOtherwise, the gbest and the g _ fixness remain unchanged;
step 7.3: when the iteration number reaches the maximum iteration number max _ iter which is 100, the PSO algorithm is terminated, at this time, the gbest represents an optimal solution of the PNN network about the smoothing factor, and the g _ fittness represents the error rate of classifying the test sample by the PNN network which adopts the gbest as the optimal smoothing factor; otherwise, re-executing the step 7.1;
and 8: and (4) collecting greenhouse environment data to be evaluated, and evaluating the greenhouse environment quality by adopting the optimal PNN classification model obtained in the step (7).
In this embodiment, the test set samples are evaluated by using the optimal PNN classification model, the evaluation result is shown in fig. 4, and the evaluation accuracy of the whole test sample reaches 85%, wherein the evaluation accuracy of each type of test sample is shown in table 2, the evaluation accuracy of the evaluation method of the present invention for the 2 nd type test sample is higher by 95.2%, and the evaluation accuracy for the 4 th type test sample is lowest by 62.5%, which is caused by different types of samples in the training samples being distributed differently.
TABLE 2 comparison table of classification results of the evaluation method of the present invention
In the embodiment, the optimal PNN classification model of the present invention is compared with the conventional PNN evaluation model from the viewpoint of evaluation accuracy, network structure, training time, test time, and storage space, as shown in table 3, although the optimal PNN classification model of the present invention requires a long time in the training process, it is better than the conventional PNN network in terms of classification accuracy, network structure, test time, and storage space. Therefore, the evaluation method has higher evaluation speed and lower requirements on hardware design difficulty and storage space, and provides an effective method for evaluating the greenhouse environment quality.
TABLE 3 comparison with conventional PNN evaluation model
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions and scope of the present invention as defined in the appended claims.
Claims (7)
1. A greenhouse environment assessment method based on a PNN network is characterized in that: the method comprises the following steps:
step 1: establishing a greenhouse environment parameter sample library with the size of n, performing quality evaluation on each group of samples in the sample library according to M grades, and further dividing the n samples into M classes; the dimension of each group of samples in the sample library is q, and the dimension q respectively represents greenhouse environment parameters having important influence on plant growth;
step 2: selecting m samples from a sample library as training samples, and taking other samples (l-n-m) as test samples;
and step 3: initializing parameters in an improved K-means clustering algorithm and a particle swarm optimization algorithm;
and 4, step 4: clustering the selected m training samples by using an improved K-means clustering algorithm to obtain K clustering clusters and K clustering centers, wherein the number of the samples in each cluster is mgG is 1, 2, … k; selecting a batch of representative samples from each cluster as a new training sample of the PNN network according to the representative sample selection threshold value alpha;
and 5: carrying out normalization processing on the new training sample;
step 6: training a PNN network according to the normalized training sample matrix, performing grade evaluation on the normalized test samples by using the trained PNN network, and calculating the error rate of classifying the test samples;
and 7: the method comprises the steps that the same smooth factors are adopted by the mode layer neurons of the same type in the PNN network, different smooth factors are adopted by the mode layer neurons of different types, then the error rate of the PNN network in classifying test samples is used as the target function of the particle swarm optimization algorithm, the smooth factor parameters in the PNN network are modified through the particle swarm optimization algorithm, the PNN network is optimized, and finally an optimal PNN classification model is obtained;
and 8: and (4) collecting greenhouse environment data to be evaluated, and evaluating the greenhouse environment quality by adopting the optimal PNN classification model obtained in the step (7).
2. The PNN network-based greenhouse environment assessment method according to claim 1, wherein: the initialized parameters in the step 3 are specifically as follows: initializing cluster number K and initial cluster center in improved K-means clustering algorithmAn iteration stop threshold value, a representative sample selection threshold value alpha, a maximum iteration number J and a current iteration number J; initializing the number N of particles in a particle swarm optimization algorithm, wherein the solution space dimension is D, the maximum iteration time max _ iter, the initial position vector px and the initial velocity vector pv of the particles; let the position vector of the particle be denoted pxi=[pxi1,pxi2,…,pxiD],i∈[1,N]The velocity vector of the particle is expressed as pvi=[pvi1,pvi2,…,pviD]The individual optimum position at which the objective function is minimized in the current iteration is pbesti=[pbesti1,pbesti1,…,pbestiD]The optimal position of the population is gbext ═ gbest1,gbest2,…,gbestD]The minimum value of the target function experienced by the individual and the population in the iterative process is p _ fitness respectivelyiG _ fitness; all smoothing factor values in the PNN network are initialized to be 0.1.
3. The PNN network-based greenhouse environment assessment method according to claim 2, wherein: the specific method of the step 4 comprises the following steps:
step 4.1:randomly selecting K sample points from m training samples as initial clustering centers of a K-means clustering algorithm
Step 4.2: setting the current iteration number as j, and carrying out comparison on each sample point p in the training sampletT is 1, 2, …, m is calculated to each cluster center in turnThe Euclidean distance d (t, g) of (1) is as follows:
step 4.3: finding each sample point about respective cluster centersAnd corresponding sample point ptDivision into and clustering centersIn the cluster with the minimum distance;
step 4.4: recalculating cluster center of each cluster by using average value methodAs shown in the following equation:
wherein p isgwRepresenting the w sample point in the g cluster;
step 4.5: calculating the square sum of the distances between the samples in each cluster and the new cluster center, wherein the following formula is shown in the specification:
wherein E isj+1Representing the sum of squares of distances between the samples in each cluster and the new cluster center;
step 4.6: judging whether the iteration number J is equal to the maximum iteration number J or | Ej+1-EjIf yes, executing the step 4.7, otherwise, executing the step 4.2 again;
step 4.7: counting the number m of samples in each clustergAnd selecting m of the nearest neighbor of each cluster center according to the sample selection threshold value alphagα samples are output as the most representative training samples, and new training samples of p ═ m · α are obtained.
4. The PNN network-based greenhouse environment assessment method according to claim 3, wherein: the specific method for performing normalization processing on the new training sample in the step 5 comprises the following steps:
setting a new training sample matrix X as shown in the following formula
Wherein, p represents the number of new training samples, and q represents the dimension of the new training samples;
carrying out normalization processing on the new training sample matrix X through the normalization factor matrix B to obtain a matrix C, wherein the expressions of the matrix B and the matrix C are shown as the following formula:
5. the PNN network-based greenhouse environment assessment method according to claim 6, wherein: the structure of the PNN network comprises an input layer, a mode layer, a summation layer and an output layer; the input layer does not process the data and sends the data into the mode layer; the number of the neurons in the mode layer is equal to the number of the training samples, and the activation function of the neurons is a Gaussian function; the connection mode of the summation layer and the mode layer is sparse connection, and the number of neurons in the summation layer is equal to the number of classes of the training samples; and the output layer selects the category corresponding to the maximum posterior probability for output according to the Bayesian decision rule.
6. The PNN network-based greenhouse environment assessment method according to claim 5, wherein: the specific method of the step 6 comprises the following steps:
step 6.1: constructing a mode layer of the PNN network by using the normalized training sample matrix C;
after the new training sample matrix X is normalized, a training sample matrix C is obtained, and the following formula is shown:
p training samples exist in the training matrix C and are divided into M classes, and the number of the training samples of the M classes is set to be h1,h2,…,hMThen, there are:
p=h1+h2+…+hM(8)
setting M types of samples to be sequentially arranged in a sample matrix C, and sequentially numbering each neuron of a mode layer as 1-p; number 1 to h1The neuron of (a) corresponds to the class 1 training sample with the number h1+1 sequentially to h1+h2The +1 neuron corresponds to the class 2 training sample, and the like, and the number is p-hM+1 neurons from number p in turn belong to class M samples;
step 6.2: calculating the Euclidean distance between each test sample in the test sample matrix and each training sample in the training set;
the test sample matrix T, which consists of n-m test samples and is normalized, is shown as follows:
the Euclidean distance matrix E between each test sample and each training sampledAs shown in the following equation:
step 6.3: activating neurons in a mode layer by using a radial basis function;
selecting a Gaussian function as an activation function of a neuron in a mode layer, and calculating an activated probability matrix U, wherein the probability matrix U is shown in the following formula:
wherein σ1、σ2、…σpRespectively representing the smoothing factors of p pattern layer neurons, and initially setting all the smoothing factors to have the same value, namely sigma1=σ2=…σp=0.1;
Step 6.4: solving the initial probability and matrix S of each sample to be tested belonging to each category through a summation layer, wherein the following formula is shown:
step 6.5: calculating the probability prob of the alpha-th sample to be tested belonging to the b-th class according to the initial probability sum of the samples to be tested belonging to each classabThe following formula shows:
wherein a belongs to [1, l ], b belongs to [1, M ];
step 6.6: according to Bayesian decision theorem and the probability that each sample to be detected belongs to each class, the class corresponding to the a-th sample to be detected is decided, and the following formula is shown:
ya=arg max(proba6) (14)
wherein, yaThe method comprises the steps that a prediction result of a PNN network on an a-th test sample is shown, namely the category corresponding to the a-th test sample is shown;
step 6.7: calculating the error rate of the PNN network for classifying the test samples, wherein the error rate is shown in the following formula:
wherein, ER represents the error rate of the PNN network for classifying the test samples, neThe number of samples of the PNN network error classification is shown, and the number of test samples is shown by l-n-m.
7. The PNN network-based greenhouse environment assessment method according to claim 6, wherein:
step 7.1: setting the beta iteration process of optimizing PNN network parameters by the particle swarm optimization algorithm, firstly carrying out velocity vector pv on particles in the particle swarm optimization algorithmiAnd a position vector pxiIs updated as shown in the following equation:
pvi β+1=w·pvi β+c1μ1(pbesti β-pxi β)+c2μ2(gbestβ-pxi β) (16)
pxi β+1=pxi β+pvi β+1(17)
wherein omega is an inertia weight and represents the searching capability of the particle swarm optimization algorithm; c. C1,c2Learning factors of the individual extreme point and the global extreme point respectively; mu.s1,μ2Respectively represent random numbers between 0 and 1; since the PSO algorithm optimizes the objectsThe class mode layer neuron adopts a smoothing factor, so that the spatial dimension D of the particle solution is M;
step 7.2: the updated particle position vector represents a feasible solution of the smoothing factor of the PNN network; the position vector px of the particlei β+1Replacing the value of the smoothing factor of the PNN network, and then calculating the px of the PNN network pairi β+1Error rate of classification of corresponding test samplesAnd updating the individual optimal position information pbest experienced by the particle according to the following updating ruleiAnd the minimum value p _ fitness of the objective functioniUpdating, and updating the optimal position information gbest and the minimum value g _ fitness of the objective function which are experienced by the population;
the update rule is as follows:
if p _ fitnessiIf < g _ fit, gbest is pbesti,g_fitness=p_fitnessiOtherwise, the gbest and the g _ fixness remain unchanged;
step 7.3: when the iteration times reach the maximum iteration times max _ iter, terminating the particle swarm optimization algorithm, wherein the gbest represents an optimal solution of the PNN network about the smoothing factor, and the g _ fittness represents the error rate of classifying the test samples by the PNN network adopting the gbest as the optimal smoothing factor; otherwise step 7.1 is re-executed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010678726.6A CN111797937B (en) | 2020-07-15 | 2020-07-15 | Greenhouse environment assessment method based on PNN network |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010678726.6A CN111797937B (en) | 2020-07-15 | 2020-07-15 | Greenhouse environment assessment method based on PNN network |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111797937A true CN111797937A (en) | 2020-10-20 |
CN111797937B CN111797937B (en) | 2023-06-13 |
Family
ID=72807092
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010678726.6A Active CN111797937B (en) | 2020-07-15 | 2020-07-15 | Greenhouse environment assessment method based on PNN network |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111797937B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060006997A1 (en) * | 2000-06-16 | 2006-01-12 | U.S. Government In The Name Of The Secretary Of Navy | Probabilistic neural network for multi-criteria fire detector |
CN109120961A (en) * | 2018-07-20 | 2019-01-01 | 南京邮电大学 | The prediction technique of the QoE of IPTV unbalanced dataset based on PNN-PSO algorithm |
CN110909802A (en) * | 2019-11-26 | 2020-03-24 | 西安邮电大学 | Improved PSO (particle swarm optimization) based fault classification method for optimizing PNN (portable network) smoothing factor |
-
2020
- 2020-07-15 CN CN202010678726.6A patent/CN111797937B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060006997A1 (en) * | 2000-06-16 | 2006-01-12 | U.S. Government In The Name Of The Secretary Of Navy | Probabilistic neural network for multi-criteria fire detector |
CN109120961A (en) * | 2018-07-20 | 2019-01-01 | 南京邮电大学 | The prediction technique of the QoE of IPTV unbalanced dataset based on PNN-PSO algorithm |
CN110909802A (en) * | 2019-11-26 | 2020-03-24 | 西安邮电大学 | Improved PSO (particle swarm optimization) based fault classification method for optimizing PNN (portable network) smoothing factor |
Non-Patent Citations (2)
Title |
---|
KHAKZAD HAMID: "Improving performance of classification on severity of ill effects (SEV) index on fish using K-Means clustering algorithm with various distance metrics", 《WATER PRACTICE & TECHNOLOGY》, vol. 14, no. 1, pages 101 - 117 * |
郭全友等: "环境因子对轻腌大黄鱼中溶藻弧菌生长/非生长界面的影响", 《农业工程学报》, vol. 34, no. 3, pages 292 - 299 * |
Also Published As
Publication number | Publication date |
---|---|
CN111797937B (en) | 2023-06-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108564192B (en) | Short-term photovoltaic power prediction method based on meteorological factor weight similarity day | |
CN113190699B (en) | Remote sensing image retrieval method and device based on category-level semantic hash | |
CN111211994B (en) | Network traffic classification method based on SOM and K-means fusion algorithm | |
CN113282122B (en) | Commercial building energy consumption prediction optimization method and system | |
Song et al. | A hybrid evolutionary computation approach with its application for optimizing text document clustering | |
CN110232416A (en) | Equipment failure prediction technique based on HSMM-SVM | |
CN113705877B (en) | Real-time moon runoff forecasting method based on deep learning model | |
Islam et al. | InceptB: a CNN based classification approach for recognizing traditional bengali games | |
CN111988329B (en) | Network intrusion detection method based on deep learning | |
CN111105045A (en) | Method for constructing prediction model based on improved locust optimization algorithm | |
CN111160461A (en) | Fuzzy clustering-based weighted online extreme learning machine big data classification method | |
Alizadeh et al. | Combination of feature selection and hybrid classifier as to network intrusion detection system adopting FA, GWO, and BAT optimizers | |
CN111292124A (en) | Water demand prediction method based on optimized combined neural network | |
CN111209939A (en) | SVM classification prediction method with intelligent parameter optimization module | |
CN116956160A (en) | Data classification prediction method based on self-adaptive tree species algorithm | |
CN111797937B (en) | Greenhouse environment assessment method based on PNN network | |
CN116542382A (en) | Sewage treatment dissolved oxygen concentration prediction method based on mixed optimization algorithm | |
CN116663414A (en) | Fault diagnosis method and system for power transformer | |
CN116031879A (en) | Hybrid intelligent feature selection method suitable for transient voltage stability evaluation of power system | |
CN115906959A (en) | Parameter training method of neural network model based on DE-BP algorithm | |
CN113221447A (en) | Soil humidity prediction method for optimizing BP neural network based on improved genetic algorithm | |
CN114897204A (en) | Method and device for predicting short-term wind speed of offshore wind farm | |
CN114234392A (en) | Air conditioner load fine prediction method based on improved PSO-LSTM | |
CN113962819A (en) | Method for predicting dissolved oxygen in industrial aquaculture based on extreme learning machine | |
Khotimah et al. | Initial center weight self organizing map using genetic algorithm |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |