Gas spectrum quantitative analysis method and device based on evolutionary neural network
By employing a gas spectral quantitative analysis method based on evolutionary neural networks, the problems of spectral wavelength selection and nonlinear mapping in multi-component spectral quantitative analysis are solved. This enables efficient spectral data fitting and gas component concentration prediction, improving prediction accuracy and model stability, and providing reliable early warning for lithium battery thermal runaway.
Patent Information
- Application Number
- CN202511658432.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-13
- Publication Date
- 2026-02-17
AI Technical Summary
Existing technologies struggle to simultaneously and efficiently address the issues of spectral wavelength selection and nonlinear mapping in multi-component quantitative spectral analysis, resulting in existing methods failing to efficiently balance the core requirements of spectral wavelength selection and data nonlinear mapping.
A gas spectroscopic quantitative analysis method based on evolutionary neural networks is adopted. The parameters of the evolutionary model are encoded by binary individual coding. Combining RBF and BP networks, clustering is used to determine the center vector and the width of hidden nodes. The root mean square error of cross-validation with leave-one-out method is used as the individual fitness for mutation operation. The population is merged through elite strategy and roulette wheel mechanism to iteratively optimize the model structure and parameters.
It achieves precise screening of effective wavelengths in the spectrum, eliminates redundant and interfering variables, efficiently fits the nonlinear relationship between spectral data and gas component concentration, improves the prediction accuracy and model stability of quantitative analysis of multi-component gas concentration, and provides reliable early warning support for scenarios such as thermal runaway of lithium batteries.
Smart Images

Figure CN121543657A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of gas spectral analysis technology, and in particular to a gas spectral quantitative analysis method and apparatus based on an evolutionary neural network. Background Technology
[0002] Accurate detection of the concentration of gas components released during thermal runaway of lithium batteries is crucial for achieving safety early warning and protecting public life and property. Currently, the mainstream approach is to use traditional chemical detection techniques or modern spectral analysis techniques combined with partial least squares (PLS), neural networks (such as BPNN and RBFNN), and evolutionary algorithm-optimized neural networks (such as GA-BPNN) for quantitative analysis. Traditional chemical detection techniques are complex to operate, require large space, and are time-consuming, failing to meet the needs of rapid and continuous monitoring. While PLS-related methods can solve the multicollinearity problem, they struggle to handle the complex nonlinear relationships in spectral data. Even with variable selection strategies, efficiency and accuracy cannot be balanced. Ordinary neural networks can approximate nonlinear functions, but they carry the risk of overfitting, and the network architecture relies on human experience, making accuracy difficult to guarantee. While evolutionary algorithm-optimized neural networks can optimize the topology, they ignore the impact of redundant or interfering variables on model complexity and accuracy. As a result, existing methods cannot efficiently balance the core requirements of spectral wavelength selection and data nonlinear mapping. Therefore, existing technologies face the technical challenge of simultaneously and efficiently handling the spectral wavelength selection and nonlinear mapping problems in multi-component spectral quantitative analysis. Summary of the Invention
[0003] This application provides a gas spectral quantitative analysis method and apparatus based on evolutionary neural networks, which solves the technical problem that existing technologies have difficulty in simultaneously and efficiently handling the issues of spectral wavelength selection and nonlinear mapping in multi-component spectral quantitative analysis.
[0004] To achieve the above objectives, this application adopts the following technical solution: Firstly, a gas spectral quantitative analysis method based on evolutionary neural networks is provided, comprising: A) acquiring the spectral signals and component concentration values of gas samples to construct a spectral database; B) dividing the spectral database into a training set and a validation set; C) encoding the parameters of the evolutionary model using binary individual coding; the parameters include spectral wavelength selection, the number of hidden layers in the RBF network, the number of hidden nodes in the RBF network, the number of hidden layers in the BP network, the number of hidden nodes in the BP network, and evolutionary parameters; D) initializing the parameters of the evolutionary model; E) setting the hidden activation function of the RBF network, determining the center vector and hidden node width through clustering; setting the hidden activation function of the BP network; F) training the model using the training set. The model is structured as follows: G) The root mean square error of cross-validation using leave-one-out method is used as the individual fitness, and the individual fitness is ranked and normalized; H) Mutation operation is performed based on the normalized individual fitness and evolutionary parameters to generate a progeny population; I) Step F is repeated to calculate the normalized individual fitness of the progeny population; J) The parent and progeny populations are merged using an elite strategy and roulette wheel mechanism to generate a new population; J) Steps E to I are repeated until the optimal individual fitness in each generation is lower than the improvement threshold or the maximum number of iterations is reached, at which point iteration stops; K) The deterministic parameter evolutionary model corresponding to the optimal individual is output, and the gas component concentration is quantitatively analyzed using the deterministic parameter evolutionary model.
[0005] In conjunction with the first aspect mentioned above, in one possible implementation, binary individual coding is used to encode the parameters of the evolutionary model, including: setting each individual to consist of six gene segments, with each gene position taking the value of 0 or 1; segment 1 is the encoding of spectral wavelength variables, its length being the number of candidate wavelengths, with a gene position of 1 indicating selection of the corresponding wavelength variable and 0 indicating no selection; segment 2 is the encoding of the number of hidden layers in the RBF network, consisting of 3 gene positions; segment 3 is the encoding of the number of hidden nodes in the hidden layer of the RBF network, consisting of 28 gene positions, with every 4 gene positions corresponding to one number of hidden nodes in the hidden layer; segment 4 is the encoding of the number of hidden layers in the BP network, consisting of 3 gene positions; segment 5 is the encoding of the number of hidden nodes in the hidden layer of the BP network, consisting of 28 gene positions, with every 4 gene positions corresponding to one number of hidden nodes in the hidden layer; segment 6 is the encoding of evolutionary parameters, consisting of 4 gene positions divided into two groups of 2 gene positions each; the first group of gene positions encodes the first evolutionary parameter; the second group of gene positions encodes the second evolutionary parameter.
[0006] In conjunction with the first aspect mentioned above, in one possible implementation, the hidden activation function of the RBF network satisfies the following formula:
[0007] Where h is the number of hidden nodes in the hidden layer. The input vector of the hidden layer. is the center vector of the hidden nodes in the hidden layer. is the width of the hidden node, and i is the index of the hidden node in the hidden layer.
[0008] In conjunction with the first aspect above, one possible implementation involves determining the center vector and hidden node width through clustering, including the following steps: E1. Determine the number of clusters and randomly select h input vectors as initial cluster centers; the number of clusters is equal to the number of hidden nodes in the hidden layer of the RBF network; E2. Calculate the distance between each input vector (excluding the initial cluster centers) and each cluster center using Euclidean distance, and assign each input vector to the nearest cluster according to the minimum distance principle; E3. Calculate the mean of all input vectors in each cluster and use the mean as the new cluster center for that cluster; E4. Repeat steps E2 and E3 until the cluster center values of each cluster remain unchanged, and use the cluster centers as the center vectors of the hidden nodes in the hidden layer of the RBF network; E5. Calculate the hidden node width based on the center vectors using the p-nearest neighbor rule.
[0009] In conjunction with the first aspect mentioned above, in one possible implementation, the hidden activation function of the BP network satisfies the following formula:
[0010] in, The output matrix of the original spectral signals of the training set after wavelength variable selection satisfies... , This is the nonlinear extension of the input matrix by the RBF network, resulting in the output matrix.
[0011] In conjunction with the first aspect mentioned above, in one possible implementation, the root mean square error of leave-one-out cross-validation is used as the individual fitness, and the individual fitness is ranked and normalized, including: Calculate the root mean square error of cross-validation as the individual fitness; the root mean square error of cross-validation satisfies the following formula:
[0012] in, Represents an individual Adaptability, To verify the total number of samples, For the first The actual measured concentration of each sample For the first Predicted concentration for each sample; Individual fitness is normalized; the normalization satisfies the following formula:
[0013] in, This represents the maximum fitness of an individual in the population. This represents the minimum fitness of an individual in the population. This represents the new fitness value of the individual after normalization.
[0014] In conjunction with the first aspect mentioned above, in one possible implementation, mutation operations are performed based on the normalized individual fitness and evolutionary parameters to generate a progeny population. The mutation satisfies the following formula:
[0015] in, For the first The probability of mutation for each individual. As the first evolutionary parameter, This is the second evolutionary parameter.
[0016] In conjunction with the first aspect mentioned above, one possible implementation involves merging the parent and offspring populations to generate a new population using an elite strategy and a roulette wheel mechanism. This includes the following steps: I1. Merging the parent and offspring populations and removing duplicate individuals from the merged population to obtain a merged population; I2. Based on the elite strategy, selecting a predetermined number of individuals with the lowest fitness values from the merged population to form a subset of the new population; I3. Arranging the remaining individuals in the merged population (excluding the selected optimal individuals) in ascending order of fitness values and calculating the cumulative probability of each remaining individual; I4. Generating random numbers and selecting the remaining individuals based on the correspondence between the random numbers and the cumulative probabilities. This selection process is repeated until the total number of selected individuals and the predetermined number of individuals from step I2 reaches the predetermined population size, thus forming a new population.
[0017] In conjunction with the first aspect mentioned above, in one possible implementation, generating a random number and selecting the remaining individuals based on the correspondence between the random number and the cumulative probability includes: generating a uniformly distributed random number r within the interval [0,1]; if Then select an individual. As the next generation of individuals; among them This represents the cumulative probability.
[0018] Secondly, a gas spectral quantitative analysis device based on an evolutionary neural network is provided, comprising: a communication unit and a processing unit; the communication unit is used for step A, acquiring the spectral signal and component concentration values of a gas sample, and constructing a spectral database; the processing unit is used for the following steps: B, dividing the spectral database into a training set and a validation set; C, encoding the parameters of the evolutionary model using binary individual coding; the parameters include spectral wavelength selection, the number of hidden layers in the RBF network, the number of hidden nodes in the RBF network, the number of hidden layers in the BP network, the number of hidden nodes in the BP network, and evolutionary parameters; D, initializing the parameters of the evolutionary model; E, setting the activation function of the hidden layers of the RBF network, determining the center vector and the width of the hidden nodes through clustering; setting the hidden layers of the BP network... Activation function; F. Train the evolutionary model using the training set, use the root mean square error of cross-validation with leave-one-out method as the individual fitness, rank the individual fitness, and normalize it; G. Perform mutation operation based on the normalized individual fitness and evolutionary parameters to generate the offspring population; H. Repeat step F to calculate the normalized individual fitness of the offspring population; I. Merge the parent and offspring populations using an elite strategy and roulette wheel mechanism to generate a new population; J. Repeat steps E to I until the optimal individual fitness of each generation is lower than the improvement threshold or the maximum number of iterations is reached, then stop the iteration; K. Output the deterministic evolutionary model corresponding to the optimal individual, and use the deterministic evolutionary model to quantitatively analyze the gas component concentration.
[0019] Thirdly, this application provides a gas spectroscopic quantitative analysis device based on an evolutionary neural network, comprising: a processor and a storage medium; the storage medium includes instructions, and the processor is used to execute the instructions to implement the method described in the first aspect and any possible implementation thereof. This gas spectroscopic quantitative analysis device based on an evolutionary neural network can be an electronic device or a chip within an electronic device.
[0020] Fourthly, this application provides a gas spectral quantitative analysis system based on an evolutionary neural network, comprising: a spectrometer, a gas mass spectrometer, and electronic equipment; wherein, the spectrometer is used to acquire the spectral signal of a gas sample; the gas mass spectrometer is used to acquire the component concentration values of the gas sample; and the electronic equipment is used to perform the following steps: A. Acquiring the spectral signal and component concentration values of the gas sample to construct a spectral database; B. Dividing the spectral database into a training set and a validation set; C. Encoding the parameters of the evolutionary model using binary individual coding; the parameters include spectral wavelength selection, the number of hidden layers in the RBF network, the number of hidden nodes in the RBF network, the number of hidden layers in the BP network, the number of hidden nodes in the BP network, and evolutionary parameters; D. Initializing the parameters of the evolutionary model; E. Setting the hidden activation function of the RBF network, through... Clustering determines the center vector and hidden node width; setting the hidden layer activation function of the BP network; F, training the evolutionary model using the training set, using the root mean square error of leave-one-out cross-validation as the individual fitness, ranking the individual fitness and normalizing it; G, performing mutation operation based on the normalized individual fitness and evolutionary parameters to generate the offspring population; H, repeating step F to calculate the normalized individual fitness of the offspring population; I, merging the parent and offspring populations using an elite strategy and roulette wheel mechanism to generate a new population; J, repeating steps E to I until the optimal individual fitness of each generation is lower than the improvement threshold or the maximum number of iterations is reached, stopping the iteration; K, outputting the deterministic evolutionary model corresponding to the optimal individual, and using the deterministic evolutionary model to quantitatively analyze the gas component concentration.
[0021] Fifthly, this application provides a computer-readable storage medium storing instructions that, when executed on a gas spectral quantitative analysis device based on an evolutionary neural network, cause the gas spectral quantitative analysis device based on an evolutionary neural network to perform the methods described in the first aspect and any possible implementation thereof.
[0022] In a sixth aspect, this application provides a computer program product containing instructions that, when the computer program product is run on a gas spectral quantitative analysis device based on an evolutionary neural network, cause the gas spectral quantitative analysis device based on an evolutionary neural network to perform the methods described in the first aspect and any possible implementation thereof.
[0023] This application provides a gas spectral quantitative analysis method and apparatus based on evolutionary neural networks, which can accurately screen effective wavelengths of the spectrum to eliminate redundant and interfering variables, efficiently fit the nonlinear relationship between spectral data and gas component concentration, improve the prediction accuracy and model stability of multi-component gas concentration quantitative analysis, and provide reliable early warning support for scenarios such as lithium battery thermal runaway. It solves the technical problem that existing technologies cannot simultaneously and efficiently handle the problems of spectral wavelength selection and nonlinear mapping in multi-component spectral quantitative analysis.
[0024] It should be understood that the descriptions of technical features, technical solutions, beneficial effects, or similar language in this application do not imply that all features and advantages can be achieved in any single embodiment. Rather, it is understood that the description of a feature or beneficial effect means that a specific technical feature, technical solution, or beneficial effect is included in at least one embodiment. Therefore, the descriptions of technical features, technical solutions, or beneficial effects in this specification do not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions, and beneficial effects described in this embodiment can be combined in any suitable manner. Those skilled in the art will understand that embodiments can be implemented without one or more specific technical features, technical solutions, or beneficial effects of a particular embodiment. In other embodiments, additional technical features and beneficial effects may be identified in specific embodiments that do not embody all embodiments. Attached Figure Description
[0025] Figure 1 A system architecture diagram of a gas spectral quantitative analysis system based on an evolutionary neural network is provided for embodiments of this application; Figure 2 A schematic flowchart of a gas spectroscopic quantitative analysis method based on an evolutionary neural network provided in this application embodiment; Figure 3 A schematic flowchart of another gas spectroscopic quantitative analysis method based on an evolutionary neural network provided in this application embodiment; Figure 4 A schematic flowchart of another gas spectroscopic quantitative analysis method based on an evolutionary neural network provided in this application embodiment; Figure 5 A schematic diagram of a gas spectroscopic quantitative analysis device based on an evolutionary neural network provided in this application embodiment; Figure 6 This is a schematic diagram of the hardware structure of a gas spectral quantitative analysis device based on an evolutionary neural network, provided in an embodiment of this application. Detailed Implementation
[0026] In the description of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. The "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Furthermore, "at least one" means one or more, and "multiple" means two or more. The terms "first," "second," etc., do not limit the quantity or order of execution, and "first," "second," etc., do not necessarily imply differences.
[0027] It should be noted that, in this application, the terms "exemplary" or "for example" are used to indicate that something is being described as an example, illustration, or illustration. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0028] The gas spectral quantitative analysis method based on evolutionary neural networks provided in this application can be applied to, for example... Figure 1 The gas spectral quantitative analysis system based on evolutionary neural network shown includes: a spectrometer 101, a gas analysis mass spectrometer 102, and electronic equipment 103.
[0029] The system includes a spectrometer 101 for acquiring spectral signals from gas samples; a gas mass spectrometer 102 for acquiring component concentration values from gas samples; and an electronic device for performing the following steps: A) acquiring spectral signals and component concentration values from gas samples to construct a spectral database; B) dividing the spectral database into a training set and a validation set; C) encoding the parameters of the evolutionary model using binary individual coding; the parameters include spectral wavelength selection, the number of hidden layers in the RBF network, the number of hidden nodes in the RBF network, the number of hidden layers in the BP network, the number of hidden nodes in the BP network, and evolutionary parameters; D) initializing the parameters of the evolutionary model; E) setting the activation function of the hidden layers in the RBF network, determining the center vector and hidden node width through clustering, and setting the hidden layer of the BP network. Activation function; F. Train the evolutionary model using the training set, use the root mean square error of cross-validation with leave-one-out method as the individual fitness, rank the individual fitness, and normalize it; G. Perform mutation operation based on the normalized individual fitness and evolutionary parameters to generate the offspring population; H. Repeat step F to calculate the normalized individual fitness of the offspring population; I. Merge the parent and offspring populations using an elite strategy and roulette wheel mechanism to generate a new population; J. Repeat steps E to I until the optimal individual fitness of each generation is lower than the improvement threshold or the maximum number of iterations is reached, then stop the iteration; K. Output the deterministic evolutionary model corresponding to the optimal individual, and use the deterministic evolutionary model to quantitatively analyze the gas component concentration.
[0030] To address the technical challenge of simultaneously and efficiently handling spectral wavelength selection and nonlinear mapping in multi-component quantitative spectral analysis, this application provides a gas spectral quantitative analysis method based on an evolutionary neural network. This method includes: first, acquiring the spectral signals and component concentration values of gas samples to construct a spectral database, and dividing it into training and validation sets; then, encoding and initializing the spectral wavelength selection, RBF / BP network structure, and evolutionary parameters using binary individual encoding; subsequently, setting the activation functions of the RBF and BP networks, determining the RBF network center vector and hidden node width through clustering, training the model using the training set, and normalizing the fitness using the root mean square error of leave-one-out cross-validation; generating a progeny population based on the fitness and evolutionary parameter mutations, merging parent and progeny generations, selecting a new population through an elite strategy and a roulette wheel selection mechanism, iterating until the termination condition is met, and outputting the optimal model. Based on this, effective spectral wavelengths are accurately selected through binary encoding, redundant and interfering variables are eliminated, and the nonlinear relationships of data are efficiently fitted using RBF and BP networks. The model structure and parameters are iteratively optimized using an evolutionary algorithm, simultaneously overcoming the two core challenges of wavelength selection and nonlinear mapping, thereby improving the prediction accuracy and model stability of multi-component gas concentrations.
[0031] like Figure 2As shown in the embodiments of this application, the gas spectroscopic quantitative analysis method based on evolutionary neural networks includes: SA (Self-Assessment) is used to acquire the spectral signals and component concentration values of gas samples and construct a spectral database.
[0032] Among them, the spectral signal is the absorption / transmission intensity data of a gas to light of a specific wavelength, and the component concentration value is the content data of each component of the gas.
[0033] In this embodiment, the electronic device interfaces with a spectrometer and a gas mass spectrometer via a communication unit to receive the spectral signals and component concentration values of the gas sample, and organizes the raw spectral signals into an input matrix. n is the number of samples collected, and the component concentration values are organized into an output matrix. , where m is the number of types of escaping gases, which are integrated to form a spectral database.
[0034] As an example, electronic devices collect CO and C emitted during thermal runaway of lithium batteries. C A total of 120 sets (n=120) of spectral signals and corresponding concentration values were acquired from the mixed gas sample (m=3) to construct an on-site spectral database. The spectral analyzer used was an FTIR Dx4000 Fourier Transform Infrared Spectrometer, and the gas analysis mass spectrometer used was a Pfeiffer online mass spectrometer.
[0035] Based on the above steps, the integrity and data correspondence of the spectral database are ensured, providing reliable raw data support for subsequent model training.
[0036] SB divides the spectral database into a training set and a validation set.
[0037] The training set is used for learning model parameters, and the validation set is used for evaluating model accuracy.
[0038] In this embodiment, the electronic device adopts a venetian blind grouping strategy to synchronously divide the input matrix and output matrix in the spectral database into a training set and a validation set according to a preset R:1 ratio.
[0039] As an example, the electronic device divides 120 sets of data in a 4:1 ratio to obtain 96 training sets and 24 validation sets, which are used for individual model training and accuracy verification, respectively.
[0040] Based on the above steps, training data and validation data are effectively separated, thereby improving the objectivity and credibility of model evaluation results.
[0041] SC uses binary individual codes to encode the parameters of the evolutionary model.
[0042] The parameters of the evolutionary model include the selection of spectral wavelength, the number of hidden layers in the RBF network, the number of hidden nodes in the RBF network, the number of hidden layers in the BP network, the number of hidden nodes in the BP network, and evolutionary parameters.
[0043] In this embodiment of the application, the electronic device is configured such that each individual consists of six gene segments, each gene position is 0 or 1, and the above parameters are encoded respectively, wherein segment 1 corresponds to wavelength selection, segment 2-3 corresponds to RBF network structure, segment 4-5 corresponds to BP network structure, and segment 6 corresponds to evolutionary parameters.
[0044] Optionally, the encoding rules satisfy the following: for fragment 1, 1 gene position indicates selection of the corresponding wavelength, and 0 indicates no selection; fragment 2 consists of 3 gene positions, corresponding to RBF network hidden layer number 1-7; fragment 3 consists of 28 gene positions, with every 4 corresponding to RBF hidden layer hidden node number 1-15; fragment 4 consists of 3 gene positions, corresponding to BP network hidden layer number 1-7; fragment 5 consists of 28 gene positions, with every 4 corresponding to BP hidden layer hidden node number 1-15; fragment 6 is divided into two groups, each group consisting of 2 gene positions, encoding the first evolutionary parameter ("00" corresponds to a value of 0.05, "01" corresponds to a value of 0.1, "10" corresponds to a value of 0.15, and "11" corresponds to a value of 0.2) and the second evolutionary parameter ("00" corresponds to a value of 0.35, "01" corresponds to a value of 0.45, "10" corresponds to a value of 0.55, and "11" corresponds to a value of 0.65).
[0045] As an example, for spectral data of 1000 wavelengths, the electronic device sets the length of segment 1 to 1000.
[0046] Based on the above steps, the abstract model parameters are transformed into evolutionary binary codes, providing an operable gene vector for population iterative optimization.
[0047] SD, parameters for initializing the evolutionary model.
[0048] The initialization parameters include all evolutionary model parameters corresponding to the individual encoding, covering wavelength selection results, network structure parameters, and evolutionary parameters.
[0049] In this embodiment, the electronic device sets the initial population size, generates the code for each individual using a random initialization method, and determines the initial wavelength selection ratio, network layer number, hidden node number, and initial values of evolutionary parameters.
[0050] As an example, the electronic device randomly selects 30% or 70% of the wavelengths, the initial number of layers in the RBF and BP networks is 3 or 4, the number of hidden nodes is 5 or 10, the first evolutionary parameter is 0.1 or 0.2, and the second evolutionary parameter is 0.35 or 0.45.
[0051] Based on the above steps, an initial population containing diverse candidate schemes was constructed, providing a starting point for subsequent evolutionary iterations.
[0052] SE: Set the hidden activation function of the RBF network and determine the center vector and hidden node width through clustering; set the hidden activation function of the BP network.
[0053] Among them, the RBF network is used to achieve nonlinear expansion of the input data, and the BP network is used to construct the concentration prediction mapping relationship.
[0054] In this embodiment, the electronic device sets the hidden layer activation function of the RBF network to the Gaussian function, determines the center vector of the hidden nodes through a clustering algorithm, and then calculates the width of the hidden nodes using the p-nearest neighbor rule; at the same time, the hidden layer activation function of the BP network is set to the tangent Sigmoid function, and the input of the BP network is the nonlinear extended output matrix of the RBF network.
[0055] Optionally, the hidden activation function of the RBF network satisfies the following formula:
[0056] Where h is the number of hidden nodes in the hidden layer. The input vector of the hidden layer. is the center vector of the hidden nodes in the hidden layer. is the width of the hidden node, and i is the index of the hidden node in the hidden layer.
[0057] Optionally, the hidden activation function of the BP network satisfies the following formula:
[0058] in, The output matrix of the original spectral signals of the training set after wavelength variable selection satisfies... , This is the nonlinear extension of the input matrix by the RBF network, resulting in the output matrix.
[0059] It should be noted that, after determining the activation function of the RBF network, the Gausky function vector of the hidden nodes in the hidden layer of the RBF network is expressed as follows: The nonlinear extension of the input matrix by the hidden layer to the output matrix is expressed as: The nonlinear extension of the input matrix by the RBF network is represented as follows: s represents the number of hidden layers in the RBF network.
[0060] As an example, the electronic device obtains the center vectors of 10 RBF hidden nodes through clustering, calculates the corresponding hidden node widths, and the BP network receives the RBF expanded matrix as input.
[0061] Based on the above steps, a dual-network structure adapted to nonlinear data was constructed, providing model support for accurately capturing the complex relationship between spectral data and concentration.
[0062] SF: Train the evolutionary model using the training set, use the leave-one-out cross-validation root mean square error as the individual fitness, rank the individual fitness, and then normalize it.
[0063] Among them, leave-one-out cross-validation can make the most of the training data to evaluate the model's generalization ability, and normalization processing facilitates horizontal comparison of individual performance.
[0064] In this embodiment of the application, the electronic device inputs the training set into the evolutionary model corresponding to the current individual, performs model training, uses leave-one-out cross-validation to calculate the root mean square error (RMSECV) as the fitness of the individual, and then arranges the fitness of all individuals in ascending order and normalizes it to the [0,1] interval.
[0065] Optionally, the root mean square error of cross-validation satisfies the following formula:
[0066] in, Represents an individual Adaptability, To verify the total number of samples, For the first The actual measured concentration of each sample For the first The predicted concentration of each sample.
[0067] Alternatively, the normalization satisfies the following formula:
[0068] in, This represents the maximum fitness of an individual in the population. This represents the minimum fitness of an individual in the population. This represents the new fitness value of the individual after normalization.
[0069] It should be noted that a smaller fitness value indicates better model performance, and ranking and normalization must maintain a one-to-one correspondence between individuals and fitness values.
[0070] As an example, the electronic device uses leave-one-out verification on 96 training sets, calculates the RMSECV of each individual, and normalizes the population with the maximum RMSECV=0.8 and the minimum RMSECV=0.2 to obtain the new fitness value of the individual.
[0071] Based on the above steps, the performance of each individual model was accurately quantified, providing an objective and comparable quantitative basis for the evolutionary selection of the population.
[0072] SG is used to generate offspring populations by performing mutation operations based on the normalized individual fitness and evolutionary parameters.
[0073] Mutation is a core element of population evolution, used to introduce new gene combinations and avoid getting stuck in local optima.
[0074] In this embodiment, the electronic device is based on the normalized individual fitness and the evolutionary parameters (first evolutionary parameters) in the encoding. Second evolutionary parameters ), calculate the mutation probability of each individual, and then perform a bit-flipping operation on the binary code of the individual according to the probability to generate offspring population individuals.
[0075] Alternatively, the mutation probability satisfies the following formula:
[0076] in, For the first The probability of mutation for each individual. As the first evolutionary parameter, This is the second evolutionary parameter.
[0077] It should be noted that the mutation probability is negatively correlated with individual fitness, meaning that individuals with better performance have a lower mutation probability in order to preserve superior genes.
[0078] As an example, in electronic devices =0.1、 =0.35, the mutation probability of an individual with a fitness of 0.1 (good performance) is 0.12, and the mutation probability of an individual with a fitness of 0.9 (poor performance) is 0.38. Random numbers between 0 and 1 are generated per gene position. If the random number is less than the mutation probability, a bit flipping operation is triggered to perform mutation.
[0079] Based on the above steps, new gene combinations were effectively introduced, population diversity was maintained, and the driving force for the evolutionary process was provided.
[0080] SH, repeat step F to calculate the normalized individual fitness of the offspring population.
[0081] The purpose of repeating step F is to evaluate the performance of the offspring population using a unified standard, ensuring consistency with the evaluation of the parent population.
[0082] In this embodiment, the electronic device takes the generated offspring population as input and fully reuses the process of step F, including model training, leave-one-out cross-validation root mean square error calculation, fitness ranking, and normalization processing.
[0083] Based on the above steps, the fairness and consistency of the performance evaluation of offspring individuals are ensured, providing a unified benchmark for the merging selection of parent and offspring populations.
[0084] SI: Merge the parent and offspring populations through an elite strategy and a roulette wheel mechanism to generate a new population.
[0085] Among them, the elite strategy is used to retain the current best individual, and the roulette wheel mechanism is used to select ordinary individuals with potential. The combination of the two takes into account both the stability and diversity of evolution.
[0086] In this embodiment, the electronic device first merges the parent and offspring populations, removes duplicate individuals to obtain a merged population, then selects a preset number of optimal individuals through an elite strategy, and then uses a roulette wheel selection mechanism to select the remaining individuals until a new population of a preset size is formed.
[0087] Based on the above steps, the superior genes of the parent and offspring generations are integrated, which not only preserves the current best results, but also introduces reasonable randomness into the population, promoting continuous evolutionary optimization.
[0088] SJ, repeat steps E to I until the optimal individual fitness in each generation is below the improvement threshold or the maximum number of iterations is reached, then stop iterating.
[0089] Among them, the improvement threshold is used to determine whether the model performance has converged, and the maximum number of iterations is used to avoid excessive iterations that consume resources.
[0090] In this embodiment, the electronic device records the optimal individual fitness value of each new generation of the population, monitors whether the improvement of the optimal fitness of the most recent N generations is lower than a preset improvement threshold, or whether the current iteration number has reached the maximum iteration number (e.g., 100 times), and stops iterating if any of the conditions are met.
[0091] As an example, the electronic device is set with N=10, improvement threshold of 0.001, and maximum number of iterations of 100. When iterating to the 75th generation, the improvement of the best fitness in the last 10 generations is 0.0008, which is lower than the threshold, so the iteration stops.
[0092] Based on the above steps, a reasonable balance is struck between model accuracy and evolutionary efficiency, ensuring optimal model performance within limited resources.
[0093] SK outputs the optimal individual's corresponding deterministic evolutionary model, and uses the deterministic evolutionary model to quantitatively analyze the concentration of gas components.
[0094] Among them, the deterministic evolutionary model refers to the complete model after the optimal individual encoding is parsed, which includes wavelength selection results, network structure parameters, and evolutionary parameters.
[0095] In this embodiment, the electronic device outputs the optimal individual with the smallest fitness value in the population after the iteration terminates, parses its binary code, determines the spectral wavelength selected by the model, the number of hidden layers and hidden nodes of the RBF network, the number of hidden layers and hidden nodes of the BP network, and the evolutionary parameters, and constructs a complete evolutionary neural network model, which is used to input new gas spectral signals and output the corresponding quantitative analysis results of component concentrations.
[0096] As an example, the electronic device parses the optimal individual code, selects 200 effective wavelengths, constructs a 3-layer RBF network with 10 hidden nodes, and a 4-layer BP network with 8 hidden nodes, and then analyzes the spectral signal of the new sample to output CO and C. C The concentration value.
[0097] Based on the above steps, a high-precision quantitative analysis model was obtained, which can quickly and accurately detect the concentration of gas components.
[0098] Based on the above technical solution, it is possible to accurately screen the effective wavelengths of the spectrum to eliminate redundant and interfering variables, efficiently fit the nonlinear relationship between spectral data and gas component concentration, improve the prediction accuracy and model stability of quantitative analysis of multi-component gas concentration, provide reliable early warning support for scenarios such as thermal runaway of lithium batteries, and solve the technical problem that existing technologies cannot simultaneously and efficiently handle the problems of spectral wavelength selection and nonlinear mapping in quantitative analysis of multi-component spectra.
[0099] In one possible implementation of the embodiments of this application, combined with Figure 2 ,like Figure 3 As shown, the specific process of determining the center vector and the width of hidden nodes through clustering in the SE above is as follows: SE1. Determine the number of clusters by randomly selecting h input vectors as initial cluster centers; the number of clusters is equal to the number of hidden nodes in the hidden layer of the RBF network.
[0100] The number of clusters h is consistent with the number of hidden nodes in the hidden layer of the RBF network, which determines the fitting ability of the nonlinear mapping.
[0101] In this embodiment, the electronic device determines the number of clusters h based on the number of hidden nodes in the hidden layer of the RBF network in the current individual encoding, and then randomly selects h vectors from the wavelength-selected input vectors of the training set as the initial cluster centers.
[0102] As an example, if the number of hidden nodes in the hidden layer of the RBF network in an individual encoding is 5, then the electronic device determines the number of clusters h to be 5, and randomly selects 5 from the 96 sets of training set input vectors as the initial cluster centers.
[0103] Based on the above steps, an initial benchmark that meets the requirements of the network structure is provided for cluster analysis, ensuring that the center vector can represent the distribution characteristics of the input data.
[0104] SE2. Use Euclidean distance to calculate the distance between each input vector and each cluster center except the initial cluster center, and assign each input vector to the nearest cluster according to the minimum distance principle.
[0105] Euclidean distance is used to quantify the similarity between the input vector and the cluster center, and the minimum distance principle ensures the rationality of vector classification.
[0106] In this embodiment of the application, the electronic device calculates the Euclidean distance between each non-central input vector and the h initial cluster centers, and assigns the vector to the cluster with the smallest distance, thus completing the preliminary classification of all input vectors.
[0107] Optionally, the distance between the t-th input vector and the i-th cluster center is calculated using Euclidean distance, and the distance satisfies the following formula:
[0108] in, L is the dimension of the hidden layer input vector. Let l be the l-th element of the t-th input vector. Let be the l-th element of the i-th cluster center.
[0109] Based on the above steps, the input vectors were clustered and grouped, providing an accurate classification basis for subsequent optimization of the center vectors.
[0110] SE3. Calculate the mean of all input vectors in each cluster and use the mean as the new cluster center for that cluster.
[0111] Among them, the mean vector of the cluster can characterize the central tendency of all input vectors within the cluster, and is more representative as a new center.
[0112] In this embodiment, the electronic device calculates the mean of all input vectors within each cluster by dimension to obtain the new cluster center of the cluster, replacing the original initial cluster center.
[0113] Optionally, the mean is calculated according to the following formula:
[0114] in, For clusters The number of input vectors.
[0115] Based on the above steps, the location of the cluster centers was optimized, and the accuracy of the center vector in representing the data within the cluster was improved.
[0116] SE4. Repeat steps E2 and E3 until the cluster center value of each cluster remains unchanged, and use the cluster center as the center vector of the hidden nodes in the hidden layer of the RBF network.
[0117] The purpose of repeated iterations is to gradually converge the cluster centers to a stable state, ensuring the reliability of the center vector.
[0118] In this embodiment of the application, the electronic device cyclically executes the process of input vector distance calculation, cluster assignment and center mean update, and compares the difference between the new center and the old center after each iteration until all cluster center values no longer change.
[0119] Based on the above steps, a stable center vector with strong representational ability is obtained, providing reliable parameters for the nonlinear mapping of the RBF network.
[0120] SE5: Based on the center vector, the width of hidden nodes is calculated using the p-nearest neighbor rule.
[0121] Among them, the p-nearest neighbor rule determines the width of the hidden node by referring to the distance of the nearest center, so that the width is adapted to the data distribution density.
[0122] In this embodiment of the application, the electronic device calculates the distance between the center of each hidden node and all other centers, filters out the p centers that are closest to the center, and calculates the width of the hidden node based on these distances.
[0123] Optionally, the width of the hidden node is calculated using the p-nearest neighbor rule, satisfying the following formula:
[0124] in, These are the p hidden node centers that have the smallest distance relative to the j-th hidden node after calculating the distances between the centers of each hidden node.
[0125] It should be noted that the value of p ranges from 2 to h-1, and should be selected appropriately based on the size of h.
[0126] Based on the above steps, the width of the hidden nodes that adapts to the data distribution was determined, further improving the nonlinear mapping accuracy of the RBF network.
[0127] Based on the above technical solution, the center vector and hidden node width of the RBF network were accurately determined through a stepwise clustering process, enabling the RBF network to efficiently capture the nonlinear characteristics of spectral data and laying an optimized foundation for subsequent cooperation with the BP network.
[0128] In one possible implementation of the embodiments of this application, combined with Figure 2 ,like Figure 4As shown, the specific process by which the SI merges the parent and offspring populations to generate a new population through an elite strategy and a roulette wheel mechanism is as follows: SI1. Merge the parent population with the offspring population, remove duplicate individuals from the merged population, and obtain the merged population.
[0129] Among them, duplicate individuals refer to individuals with completely identical binary codes, whose corresponding model parameters and performance are exactly the same, and there is no need to retain them repeatedly.
[0130] In this embodiment, the electronic device compares the individual codes of the parent population with the individual codes of the offspring population one by one, removes individuals with identical codes, and retains unique individual codes to form a merged population.
[0131] As an example, the electronic device compared the codes of 100 parent individuals and 100 offspring individuals and found that 6 individuals had completely identical codes. After removing them, 194 individuals were obtained from the merged population.
[0132] Based on the above steps, redundant individuals in the population are reduced, the efficiency of subsequent selection processes is improved, and all unique gene combinations are preserved.
[0133] SI2. Based on the elite strategy, select a preset number of individuals with the lowest fitness values from the merged population and determine them as part of the new population.
[0134] The preset quantity is set according to the population size to ensure that the current best genes can be stably passed on to the next generation.
[0135] In this embodiment, the electronic device sorts the individuals in the merged population in ascending order of fitness value, selects a preset number of individuals, and directly determines them as some members of the new population without having to participate in the subsequent roulette wheel selection.
[0136] It should be noted that the preset number needs to be configured reasonably. Too many may lead to insufficient population diversity, while too few will fail to effectively preserve high-quality genes.
[0137] As an example, when the population size is 100, the electronic device selects the 10 individuals with the lowest fitness as elite individuals and directly enters the new population.
[0138] Based on the above steps, the optimal model in the current population is stably preserved, ensuring that the evolutionary process can continuously accumulate high-quality genes and avoid the loss of optimal results.
[0139] SI3. For the remaining individuals in the merged population other than the selected best individual, sort them in ascending order of fitness value and calculate the cumulative probability of each remaining individual.
[0140] The cumulative probability is used to divide the range of choices in roulette.
[0141] In the embodiments of this application, the electronic device sorts the remaining individuals in the merged population, excluding elite individuals, in ascending order of fitness value, calculates the selection probability of each individual based on the fitness value, and then accumulates the selection probabilities in the sorting order to obtain the cumulative probability of each individual.
[0142] Optionally, the selection probability is calculated according to the following formula:
[0143] in, For individuals The selection probability is given by K, where K is the total number of individuals in the merged population excluding those selected as the next generation.
[0144] Optionally, the cumulative probability satisfies the following formula:
[0145] in, For individuals The cumulative probability.
[0146] Based on the above steps, a quantitative probability basis is provided for roulette wheel selection, ensuring that high-quality individuals have a higher chance of being selected.
[0147] SI4. Generate random numbers. Based on the correspondence between random numbers and cumulative probabilities, select the remaining individuals. Repeat this selection operation until the total number of selected individuals and the preset number of individuals in step I2 reaches the preset population size, and together they form a new population.
[0148] The random numbers are uniformly distributed in the interval [0,1] to ensure the randomness and fairness of the selection process.
[0149] In this embodiment of the application, the electronic device generates a uniformly distributed random number r in the interval [0,1]. Then select an individual. As the next generation of individuals, this operation is repeated until the sum of the number of selected individuals and the number of elite individuals reaches the preset population size.
[0150] It should be noted that each random number generation and selection is independent of each other, and the same remaining individuals can be selected repeatedly to increase the genetic probability of high-quality individuals.
[0151] Based on the above steps, while prioritizing high-quality individuals, reasonable randomness is introduced, which avoids population homogenization and promotes the spread of high-quality genes.
[0152] Based on the above technical solutions, by combining elite strategies with roulette wheel mechanisms, the stable preservation of high-quality genes and the effective maintenance of population diversity are achieved, and new populations with greater evolutionary potential are efficiently screened out.
[0153] The foregoing mainly describes the solutions of the embodiments of this application from the perspective of device implementation. It is understood that each device, such as a gas spectral quantitative analysis device based on an evolutionary neural network, includes at least one of the hardware structures and software modules corresponding to each function in order to achieve the above-mentioned functions. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is implemented in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0154] This application embodiment can divide the gas spectral quantitative analysis device based on evolutionary neural networks into functional units according to the above method example. For example, each function can be divided into separate functional units, or two or more functions can be integrated into one processing unit. The integrated unit can be implemented in hardware or as a software functional unit. It should be noted that the unit division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0155] When using integrated units, Figure 5 A possible structural schematic diagram of the gas spectral quantitative analysis device based on evolutionary neural network (referred to as gas spectral quantitative analysis device 50 based on evolutionary neural network) involved in the above embodiments is shown. The gas spectral quantitative analysis device 50 based on evolutionary neural network includes a processing unit 501 and a communication unit 502, and may also include a storage unit 503. Figure 5 The schematic diagram shown can be used to illustrate the structure of the gas spectroscopic quantitative analysis device based on evolutionary neural networks involved in the above embodiments.
[0156] when Figure 5 The schematic diagram shown illustrates the structure of the gas spectral quantitative analysis device based on evolutionary neural network involved in the above embodiments. The processing unit 501 is used to control and manage the operation of the gas spectral quantitative analysis device based on evolutionary neural network, the communication unit 502 is used for the gas spectral quantitative analysis device based on evolutionary neural network to communicate with other devices, and the storage unit 503 is used to store the program code and data of the gas spectral quantitative analysis device based on evolutionary neural network.
[0157] For example, communication unit 502 is used in step A to acquire the spectral signal and component concentration values of the gas sample and construct a spectral database; Processing unit 501 is used for the following steps: B. Dividing the spectral database into a training set and a validation set; C. Encoding the parameters of the evolutionary model using binary individual encoding; the parameters include spectral wavelength selection, number of hidden layers in the RBF network, number of hidden nodes in the RBF network, number of hidden layers in the BP network, number of hidden nodes in the BP network, and evolutionary parameters; D. Initializing the parameters of the evolutionary model; E. Setting the hidden activation function of the RBF network, determining the center vector and hidden node width through clustering; setting the hidden activation function of the BP network; F. Training the evolutionary model using the training set, and using leave-one-out cross-validation to determine the root mean square error as the individual fitness value. The steps are as follows: G) Sort the fitness of individuals and normalize it; H) Perform mutation operation based on the normalized individual fitness and evolutionary parameters to generate offspring population; I) Repeat step F to calculate the normalized individual fitness of the offspring population; J) Merge the parent and offspring populations through an elite strategy and roulette wheel mechanism to generate a new population; D) Repeat steps E to I until the optimal individual fitness of each generation is lower than the improvement threshold or the maximum number of iterations is reached, then stop the iteration; E) Output the deterministic evolutionary model corresponding to the optimal individual, and use the deterministic evolutionary model to quantitatively analyze the gas component concentration.
[0158] In one possible implementation, the processing unit 501 is further configured to encode the parameters of the evolutionary model using binary individual encoding, including: setting each individual to consist of six gene segments, with each gene bit taking the value of 0 or 1; segment 1 is the encoding of spectral wavelength variables, its length being the number of candidate wavelengths, with a gene bit of 1 indicating selection of the corresponding wavelength variable and 0 indicating no selection; segment 2 is the encoding of the number of hidden layers in the RBF network, consisting of 3 gene bits; segment 3 is the encoding of the number of hidden nodes in the hidden layer of the RBF network, consisting of 28 gene bits, with every 4 gene bits corresponding to one number of hidden nodes in the hidden layer; segment 4 is the encoding of the number of hidden layers in the BP network, consisting of 3 gene bits; segment 5 is the encoding of the number of hidden nodes in the hidden layer of the BP network, consisting of 28 gene bits, with every 4 gene bits corresponding to one number of hidden nodes in the hidden layer; segment 6 is the encoding of evolutionary parameters, consisting of 4 gene bits divided into two groups, with 2 gene bits in each group; the first group of gene bits encodes the first evolutionary parameter; the second group of gene bits encodes the second evolutionary parameter.
[0159] In one possible implementation, the hidden activation function of the RBF network satisfies the following formula:
[0160] Where h is the number of hidden nodes in the hidden layer. The input vector of the hidden layer. is the center vector of the hidden nodes in the hidden layer. is the width of the hidden node, and i is the index of the hidden node in the hidden layer.
[0161] In one possible implementation, the processing unit 501 is further configured to determine the center vector and hidden node width through clustering, including the following steps: E1, determine the number of clusters, and randomly select h input vectors as initial cluster centers; the number of clusters is equal to the number of hidden nodes in the hidden layer of the RBF network; E2, calculate the distance between each input vector other than the initial cluster center and each cluster center using Euclidean distance, and assign each input vector to the nearest cluster according to the minimum distance principle; E3, calculate the mean of all input vectors in each cluster, and use the mean as the new cluster center of the cluster; E4, repeat steps E2 and E3 until the cluster center value of each cluster does not change, and use the cluster center as the center vector of the hidden node in the hidden layer of the RBF network; E5, calculate the hidden node width based on the center vector using the p-nearest neighbor rule.
[0162] In one possible implementation, the hidden activation function of the BP network satisfies the following formula:
[0163] in, The output matrix of the original spectral signals of the training set after wavelength variable selection satisfies... , This is the nonlinear extension of the input matrix by the RBF network, resulting in the output matrix.
[0164] In one possible implementation, the processing unit 501 is further configured to rank the individual fitnesss using the root mean square error of leave-one-out cross-validation as the individual fitness, and perform normalization processing, including: Calculate the root mean square error of cross-validation as the individual fitness; the root mean square error of cross-validation satisfies the following formula:
[0165] in, Represents an individual Adaptability, To verify the total number of samples, For the first The actual measured concentration of each sample For the first Predicted concentration for each sample; Individual fitness is normalized; the normalization satisfies the following formula:
[0166] in, This represents the maximum fitness of an individual in the population. This represents the minimum fitness of an individual in the population. This represents the new fitness value of the individual after normalization.
[0167] In one possible implementation, the processing unit 501 is further configured to perform mutation operations based on the normalized individual fitness and evolutionary parameters to generate a progeny population, wherein the mutation satisfies the following formula:
[0168] in, For the first The probability of mutation for each individual. As the first evolutionary parameter, This is the second evolutionary parameter.
[0169] In one possible implementation, the processing unit 501 is further configured to merge the parent population and the offspring population to generate a new population through an elite strategy and a roulette wheel mechanism, including the following steps: I1. Merging the parent population and the offspring population, removing duplicate individuals from the merged population to obtain a merged population; I2. Based on the elite strategy, selecting a preset number of individuals with the smallest fitness value from the merged population to determine a portion of the individuals in the new population; I3. Arranging the remaining individuals in the merged population, excluding the selected optimal individuals, in ascending order of fitness value, and calculating the cumulative probability of each remaining individual; I4. Generating random numbers, selecting the remaining individuals based on the correspondence between the random numbers and the cumulative probabilities, repeating this selection operation until the total number of selected individuals and the preset number of individuals in step I2 reaches the preset population size, together forming a new population.
[0170] In one possible implementation, processing unit 501 is further configured to generate random numbers and select remaining individuals based on the correspondence between random numbers and cumulative probabilities, including: generating a uniformly distributed random number r within the interval [0,1]; if Then select an individual. As the next generation of individuals; among them This represents the cumulative probability.
[0171] The processing unit 501 can be a processor or a controller, and the communication unit 502 can be a communication interface, transceiver, transceiver circuit, transceiver device, etc. The term "communication interface" is a general term and may include one or more interfaces. The storage unit 503 can be a memory. When the gas spectral quantitative analysis device 50 based on an evolutionary neural network is a chip, the processing unit 501 can be a processor or a controller, and the communication unit 502 can be an input interface and / or an output interface, pins, or circuits, etc. The storage unit 503 can be a storage unit within the chip (e.g., a register, cache, etc.) or a storage unit located outside the chip (e.g., read-only memory (ROM), random access memory (RAM, etc.).
[0172] The communication unit can also be called a transceiver unit. The antenna and control circuit with transceiver functions in the gas spectral quantitative analysis device 50 based on an evolutionary neural network can be considered as the communication unit 502 of the gas spectral quantitative analysis device 50 based on an evolutionary neural network, and the processor with processing functions can be considered as the processing unit 501 of the gas spectral quantitative analysis device 50 based on an evolutionary neural network. Optionally, the device in the communication unit 502 used to implement the receiving function can be considered as a communication unit, which is used to execute the receiving steps in the embodiments of this application. The communication unit can be a receiver, a receiver circuit, etc. The device in the communication unit 502 used to implement the transmitting function can be considered as a transmitting unit, which is used to execute the transmitting steps in the embodiments of this application. The transmitting unit can be a transmitter, a transmitter, a transmitting circuit, etc.
[0173] Figure 5 If the integrated units in the process are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. Storage media for storing computer software products include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.
[0174] Figure 5 The units in the process can also be called modules; for example, a processing unit can be called a processing module.
[0175] This application also provides a hardware structure diagram of a gas spectral quantitative analysis device based on an evolutionary neural network (referred to as gas spectral quantitative analysis device 60 based on an evolutionary neural network), see [link to relevant documentation]. Figure 6 The gas spectral quantitative analysis device 60 based on evolutionary neural network includes a processor 601, and optionally, a memory 602 connected to the processor 601.
[0176] In the first possible implementation, see Figure 6 The gas spectral quantitative analysis device 60 based on an evolutionary neural network also includes a transceiver 603. The processor 601, memory 602, and transceiver 603 are connected via a bus. The transceiver 603 is used to communicate with other devices or communication networks. Optionally, the transceiver 603 may include a transmitter and a receiver. The device in the transceiver 603 that implements the receiving function can be considered as a receiver, which is used to perform the receiving steps in the embodiments of this application. The device in the transceiver 603 that implements the transmitting function can be considered as a transmitter, which is used to perform the transmitting steps in the embodiments of this application.
[0177] Based on the first possible implementation method Figure 6 The schematic diagram shown can be used to illustrate the structure of the gas spectroscopic quantitative analysis device based on evolutionary neural networks involved in the above embodiments.
[0178] in, Figure 6 The system chip in a gas spectroscopic quantitative analysis device based on an evolutionary neural network can also be illustrated. In this case, the actions performed by the aforementioned gas spectroscopic quantitative analysis device based on an evolutionary neural network can be implemented by this system chip. The specific actions performed can be found above and will not be repeated here.
[0179] In implementation, each step of the method provided in this embodiment can be completed by integrated logic circuits in the processor or by instructions in software form. The steps of the method disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.
[0180] The processor in this application may include, but is not limited to, at least one of the following: a central processing unit (CPU), a microprocessor, a digital signal processor (DSP), a microcontroller unit (MCU), or an artificial intelligence processor, etc., which are various computing devices that run software. Each computing device may include one or more cores for executing software instructions to perform calculations or processing. The processor may be a separate semiconductor chip or integrated with other circuits into a single semiconductor chip. For example, it may be integrated with other circuits (such as encoding / decoding circuits, hardware acceleration circuits, or various bus and interface circuits) to form a SoC (System-on-a-Chip), or it may be integrated as a built-in processor within an ASIC. The ASIC with the integrated processor may be packaged separately or together with other circuits. In addition to the cores for executing software instructions to perform calculations or processing, the processor may further include necessary hardware accelerators, such as field-programmable gate arrays (FPGAs), PLDs (programmable logic devices), or logic circuits that implement dedicated logic operations.
[0181] The memory in the embodiments of this application may include at least one of the following types: read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions; random access memory (RAM) or other types of dynamic storage devices capable of storing information and instructions; or electrically erasable programmable-only memory (EEPROM). In some scenarios, the memory may also be a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto.
[0182] This application also provides a computer-readable storage medium including instructions that, when run on a computer, cause the computer to perform any of the methods described above.
[0183] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the methods described above.
[0184] This application also provides a chip including a processor and an interface circuit. The interface circuit is coupled to the processor. The processor is used to run computer programs or instructions to implement the above-described method. The interface circuit is used to communicate with other modules outside the chip.
[0185] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, implementation can be, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device containing one or more servers, data centers, etc., that can be integrated with the medium. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state disks (SSDs)).
[0186] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, disclosure, and appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple instances. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.
[0187] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.
Claims
1. An evolutionary neural network-based gas spectrum quantitative analysis method, characterized in that, The method comprises the following steps: A. obtaining spectral signals and component concentration values of a gas sample, and constructing a spectral database; B. dividing the spectral database into a training set and a validation set; C. encoding parameters of an evolutionary model using binary individual encoding; the parameters include spectral wavelength selection, RBF network hidden layer number, RBF network hidden node number, BP network hidden layer number, BP network hidden node number, and evolutionary parameters; D. initializing the parameters of the evolutionary model; E. setting the hidden layer activation function of the RBF network, and determining the center vector and hidden node width through clustering; setting the hidden layer activation function of the BP network; F. training the evolutionary model using the training set, taking the root mean square error obtained through leave-one-out cross-validation as the individual fitness, sorting the individual fitness, and performing normalization processing; G. performing mutation operation based on the normalized individual fitness and the evolutionary parameters, to generate a child population; H. repeatedly performing step F to calculate the normalized individual fitness of the child population; I. merging the parent population and the child population through an elite strategy and a roulette mechanism, to generate a new population; J. repeatedly performing steps E to I until a termination condition that the optimal individual fitness of each generation is lower than an improvement threshold or the maximum number of iterations is reached is met, and stopping iteration; K. outputting a determined parameter evolutionary model corresponding to the optimal individual, and performing quantitative analysis on the gas component concentration through the determined parameter evolutionary model.
2. The method of claim 1, wherein, The encoding of the parameters of the evolutionary model using binary individual encoding comprises: each individual is composed of six gene segments, and each gene site has a value of 0 or 1; segment 1 is spectral wavelength variable encoding, the length of which is the number of wavelengths to be selected, and the gene site value of 1 indicates that the corresponding wavelength variable is selected, and the value of 0 indicates that the corresponding wavelength variable is not selected; segment 2 is RBF network hidden layer number encoding, which is composed of three gene sites; segment 3 is RBF network hidden node number encoding, which is composed of 28 gene sites, and every four gene sites correspond to one hidden node number; segment 4 is BP network hidden layer number encoding, which is composed of three gene sites; segment 5 is BP network hidden node number encoding, which is composed of 28 gene sites, and every four gene sites correspond to one hidden node number; segment 6 is evolutionary parameter encoding, which is composed of four gene sites and is divided into two groups, each group having two gene sites; the first group of gene sites encodes a first evolutionary parameter; and the second group of gene sites encodes a second evolutionary parameter.
3. The method of claim 1, wherein, The hidden layer activation function of the RBF network satisfies the following formula: where h is the number of hidden layer hidden nodes, is the input vector of the hidden layer, is the center vector of the hidden layer hidden node, is the width of the hidden node, i is the hidden layer hidden node index.
4. The method of claim 3, wherein, The determination of the center vector and the hidden node width through clustering comprises the following steps: E1. determining the number of clustering clusters, and randomly selecting h input vectors as initial clustering centers; the number of clustering clusters is equal to the number of RBF network hidden nodes; E2. calculating the distance between each input vector except the initial clustering center and each clustering center using Euclidean distance, and distributing each input vector to the nearest clustering cluster according to the minimum distance principle; E3. calculating the mean of all input vectors in each clustering cluster, and taking the mean as the new clustering center of the clustering cluster. E4, repeating step E2 and step E3 until the cluster center value of each cluster is not changed, taking the cluster center as the center vector of the hidden node of the RBF network hidden layer; E5, calculating the hidden node width based on the center vector using the p-neighbor rule.
5. The method of claim 4, wherein, The activation function of the hidden layer of the BP network satisfies the following formula: wherein, is the output matrix of the original spectrum signal of the training set after the wavelength variable selection, satisfying , is the nonlinear expansion output matrix of the input matrix by the RBF network.
6. The method of claim 1, wherein, The root mean square error of cross-validation is calculated as the individual fitness, the individual fitness is sorted and normalized, including: The root mean square error of cross-validation is calculated as the individual fitness; the root mean square error of cross-validation satisfies the following formula: in, Represents an individual Adaptability, To verify the total number of samples, For the first The actual measured concentration of each sample For the first Predicted concentration for each sample; The individual fitness is normalized; the normalization satisfies the following formula: wherein, is the maximum value of the fitness of the population individuals, is the minimum value of the fitness of the population individuals, is the new fitness value of the individual after normalization.
7. The method of claim 1, wherein, The normalized individual fitness and the evolution parameter are used for mutation operation to generate a child population, and the mutation satisfies the following formula: in, For the first The probability of mutation for each individual. As the first evolutionary parameter, This is the second evolutionary parameter.
8. The method of claim 1, wherein, The parent population and the child population are combined to generate a new population by an elite strategy and a roulette mechanism, including the following steps: I1, combine the parent population and the child population, remove duplicate individuals in the combined population, and obtain a combined population; I2, based on the elite strategy, select a preset number of individuals with the smallest fitness value from the combined population to determine part of the individuals of the new population; I3, arrange the remaining individuals in the combined population except the optimal individuals selected in ascending order of fitness value, and calculate the cumulative probability of each remaining individual; I4, generate a random number, select a remaining individual based on the correspondence between the random number and the cumulative probability, repeat the selection operation until the total number of selected individuals and the preset number of individuals in step I2 reaches the preset population size, and combine to form a new population.
9. The method of claim 8, wherein, The random number is generated, and the remaining individuals are selected based on the correspondence between the random number and the cumulative probability, including: A uniformly distributed random number r is generated in the interval [0,1]; If then select the individual as the next generation individual; wherein, is the cumulative probability.
10. An apparatus for gas spectral quantitative analysis based on an evolutionary neural network, characterized by comprising: a gas spectral quantitative analysis device based on an evolutionary neural network according to any one of claims 1 to 9. The device comprises a communication unit and a processing unit; The communication unit is used to acquire the spectral signal of the gas sample and the component concentration value in step A, and construct a spectral database; The processing unit is configured to: B, divide the spectrum database into a training set and a validation set; C, encode parameters of an evolutionary model using binary individual encoding; the parameters include spectrum wavelength selection, RBF network hidden layer number, RBF network hidden node number, BP network hidden layer number, BP network hidden node number, and evolutionary parameters; D, initialize the parameters of the evolutionary model; E, set the hidden layer activation function of the RBF network, determine the center vector and the hidden node width through clustering, and set the hidden layer activation function of the BP network; F, train the evolutionary model using the training set, use the root mean square error of leave-one-out cross-validation as the individual fitness, sort the individual fitness, and perform normalization processing; G, perform mutation operation based on the normalized individual fitness and the evolutionary parameters to generate a child population; H, repeatedly execute step F to calculate the normalized individual fitness of the child population; I, combine the parent population and the child population through an elite strategy and a roulette mechanism to generate a new population; J, repeatedly execute steps E to I until a termination condition that each generation optimal individual fitness is lower than an improvement threshold or a maximum iteration number is reached is met, and stop iteration; K, output a determined parameter evolutionary model corresponding to an optimal individual, and perform quantitative analysis on the gas component concentration through the determined parameter evolutionary model.