Air quality prediction method based on multi-task genetic programming
Through the multi-task genetic programming method, information exchange between air quality prediction tasks is used to generate a better regression model, which solves the problem of insufficient prediction accuracy and efficiency in single task processing and achieves higher prediction accuracy and stability.
Patent Information
- Application Number
- CN202410572735.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-10
- Publication Date
- 2024-08-23
AI Technical Summary
Existing air quality prediction methods mainly deal with single tasks and fail to make full use of public useful information between similar or related tasks, resulting in insufficient prediction accuracy and efficiency.
A method based on multi-task genetic programming is used to obtain data from multiple groups of tasks to be predicted, perform preprocessing and model learning, and use the information exchange mechanism between populations to promote individual crossover and local replacement to generate a better regression model.
It significantly reduces the fitting error of the model, improves the convergence speed and generalization ability of the algorithm, and enhances the adaptability and prediction accuracy to complex air quality problems.
Smart Images

Figure CN118536389A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an air quality prediction method based on multi-task genetic programming. Background Art
[0002] Air quality is a key factor affecting human health, ecological environment and socio-economic development. Therefore, accurate prediction of air quality is crucial for formulating effective environmental policies, mitigating the impact of pollution, protecting public health and guiding the public to take appropriate protective measures. In addition, as people's environmental awareness increases, the public's demand for air quality information is growing. Accurate air quality forecasts can not only help the public understand the current and future air quality conditions, but also help them make more informed decisions in their daily lives, such as going out for exercise, travel arrangements, etc.
[0003] Symbolic regression can solve various complex regression problems by automatically discovering model structures and optimizing model parameters. Traditional regression methods often need to select model structures based on domain expert experience or prior knowledge, which may lead to overly simple models or ignore certain important features. However, symbolic regression does not require assumptions about the distribution of data, independence between input variables, and does not rely on prior knowledge of the domain, which makes symbolic regression better adapted to complex data in the real world.
[0004] As an evolutionary algorithm, genetic programming (GP) has a flexible form of expression. It can automatically combine mathematical operators and independent variables, and under the guidance of fitness values, automatically evolve the optimal regression model including model structure and parameters. In addition, the programs generated by GP are usually readable and interpretable. GP is currently considered to be the mainstream method for solving symbolic regression tasks. However, most of the current research focuses on solving a symbolic regression task independently in a single run. In fact, there are many similar or related symbolic regression tasks in real life. If the experience of solving related tasks can be used, the efficiency of the algorithm and the regression effect may be improved.
[0005] Evolutionary multi-task optimization, as an emerging new paradigm for solving multiple tasks simultaneously, has been widely used in recent years. Evolutionary multi-task algorithms use the implicit parallelism of population evolution and solve multiple tasks in a single run by designing a knowledge exchange mechanism. Compared with traditional single-task evolutionary algorithms, evolutionary multi-task algorithms can often find better solutions and have faster convergence speed. Evolutionary multi-task algorithms have been widely used in many fields, such as continuous numerical optimization, job shop scheduling, feature selection, image classification, etc.
[0006] Currently, most prediction methods based on symbolic regression only solve one regression problem in a single run. However, there are many similar or related regression problems in real life, and the common useful knowledge between these problems has not been fully utilized. Therefore, it is necessary to study new multi-task GP methods to improve the accuracy and efficiency of prediction. Summary of the invention
[0007] The purpose of the present invention is to overcome the above defects and provide an air quality prediction method based on multi-task genetic programming, which makes full use of the common useful information between similar or related tasks to improve the prediction performance.
[0008] The technical solution adopted by the present invention is: an air quality prediction method based on multi-task genetic programming, comprising the following steps:
[0009] Step S1: obtaining k groups of data of tasks to be predicted through an acquisition module;
[0010] Step S2: preprocessing k groups of data to be predicted through a preprocessing module, and correspondingly inputting k genetic planning populations;
[0011] Step S3: automatically learning a model corresponding to the data to be predicted using each genetic programming population through a model learning module;
[0012] Step S4: During the evolution process, the information exchange module is used to promote individual crossover between populations and realize information exchange between different prediction tasks;
[0013] Step S5: After the evolution is completed, the individual with the smallest error in each population is selected through the test module as the regression model for each task to be predicted to obtain the final prediction result.
[0014] Further, the specific steps of step S3 are:
[0015] Step S31: input multiple sets of data to be predicted;
[0016] Step S32: designing a plurality of population function sets corresponding to the plurality of groups of data, and inputting the independent variables of the data into the genetic planning individuals as terminal sets;
[0017] Step S33: Generate GP tree individuals and initialize k populations for learning regression models corresponding to k groups of data to be predicted;
[0018] Step S34: Select an individual fitness evaluation function to evaluate the fitness value of each individual in each population;
[0019] Step S35: judging whether to conduct knowledge exchange according to the historical evolution information of the population, and if the knowledge exchange conditions are met, selecting exchange individuals, and realizing knowledge exchange through crossover and local individual replacement;
[0020] Step S36: performing selection, crossover and mutation operations, and each population evolves to generate the next generation population;
[0021] Step S37: using the fitness evaluation function in step S34 to evaluate the fitness value of each individual in the new population;
[0022] Step S38: Determine whether the maximum number of iterations of the population has been reached; if so, stop the evolution; otherwise, go to step S35 to continue the search process.
[0023] Further, the function set in step S32 is "+", "-", "*", " / ", "sin" and "cos", wherein " / " is a protected division, and when the divisor is 0, 1 is returned instead of an error or infinity.
[0024] Furthermore, in step S33, the size of the GP population is set to 50, the number of iterations is set to 50, the individual generation method is "Ramped half-and-half", and the tree depth range is [2,8].
[0025] Furthermore, in step S34, the individual inputs the independent variables of the training set into the GP tree to obtain the predicted value, and calculates the fitting error of the GP individual on the training set. The calculation formula is as follows:
[0026]
[0027] Among them, n represents the number of data samples, y i Represents the model's predicted fitting output value for the i-th sample, y io Represents the actual output value of the i-th sample;
[0028] To speed up fitness evaluation, a certain number of evaluated trees are stored in an archive or list; during fitness evaluation, if a new tree already exists in the archive, its fitness value will be assigned the fitness value of the corresponding tree in the archive; otherwise, the new tree will be evaluated on the training set.
[0029] Further, the specific steps of step S35 include:
[0030] Step S351: determining whether to conduct knowledge exchange based on population historical evolution information;
[0031] The two indicators of population convergence speed and convergence acceleration are used, and combined with the knowledge exchange of the previous generation to guide whether to communicate; the variable S is introduced to indicate whether the population conducts knowledge exchange. The value of S has two cases, 1 for knowledge exchange and 0 for no knowledge exchange;
[0032] Case 1: When the acceleration is greater than 0, the convergence speed is getting faster, indicating that the evolutionary state of the previous generation is conducive to the convergence of the algorithm, so the communication state is not changed, that is, S is kept unchanged;
[0033] Case 2: When the acceleration is equal to 0, if the speed is greater than 0, it means that the population is still converging, and S remains unchanged; if the speed is equal to 0, it means that the speed is 0 for at least two consecutive generations, and the algorithm may fall into a local optimum and enter a high-level knowledge exchange;
[0034] Case 3: When the acceleration is less than 0, if the speed is greater than 0, it means that the population is converging but the speed is slowing down. In this case, keep S unchanged; if the speed is 0, the value of S should be opposite to the previous state. The absolute value of S-1 can be taken to achieve the switching of S between 0 and 1;
[0035] Step S352: selecting a communication individual based on the fitness value distribution;
[0036] First, count the number of different fitness values and the number of individuals corresponding to each fitness value; then calculate the number of deleted individuals corresponding to each fitness value; finally, randomly select the replacement individual set corresponding to each fitness value according to the number of deleted individuals;
[0037] Step S353: The communication individual and the auxiliary individual cross to generate offspring;
[0038] After selecting the individual to be replaced in the target population, one is randomly selected from the remaining tasks as an auxiliary task. The auxiliary individual selects the best individual in the auxiliary task, and the replacement individual of the target population and the auxiliary individual generate offspring through crossover.
[0039] Step S354: using the fitness evaluation function in step S33 to evaluate the fitness of the newly generated individual;
[0040] Step S355: Select excellent individuals from the newly generated individuals to replace the communication individuals selected in step S352 to achieve information exchange between populations.
[0041] Compared with the prior art, the present invention has the following advantages:
[0042] (1) By designing a novel multi-task algorithm, the model fitting error is significantly reduced and the convergence speed of the algorithm is accelerated. It has the advantages of simple implementation, high classification accuracy and few adjustable parameters.
[0043] (2) Based on the historical communication of the population and the trend of changes in the population convergence speed, the information exchange between populations is guided, so that the algorithm can more accurately identify and promote beneficial information exchange; in addition, the communication individuals are selected based on diversity, which effectively improves the generalization ability of the algorithm. The above improvements enable the algorithm to better adapt to the complex air quality prediction problems in real life and improve the adaptability and prediction accuracy of the model on unknown data. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 The present invention is a flow chart of the method. DETAILED DESCRIPTION
[0045] The present invention is further described below in conjunction with the accompanying drawings. The technology described below can be subjected to various transformations and can have various embodiments, which are described in detail with specific embodiments in conjunction with the accompanying drawings. However, this does not mean that the technology described below is limited to specific embodiments. It should be understood that the present invention includes all similar modifications, equivalents and substitutions without departing from the spirit and technical scope of the technology described below.
[0046] like Figure 1 As shown, the present invention is an air quality prediction method based on multi-task genetic programming, comprising the following steps:
[0047] Step S1: Obtain k groups of data of tasks to be predicted through an acquisition module.
[0048] Step S2: preprocess k groups of data to be predicted through a preprocessing module, and input k genetic planning populations accordingly.
[0049] Step S3: Using each genetic programming population to automatically learn the model corresponding to the data to be predicted through the model learning module. The specific steps are:
[0050] Step S31: input multiple sets of data to be predicted.
[0051] Step S32: Design function sets for multiple populations corresponding to multiple groups of data, and the independent variables of the data are input into the genetic planning individuals as terminal sets; the above function sets are "+", "-", "*", " / ", "sin" and "cos"; among them, " / " is a protected division, and when the divisor is 0, it returns 1 instead of an error or returning infinity.
[0052] Step S33: Generate GP tree individuals and initialize k populations for learning the regression model of k groups of data to be predicted; the size of the GP population is set to 50, the number of iterations is set to 50, the individual generation method is "Ramped half-and-half", and the tree depth range is [2,8].
[0053] Step S34: Select an individual fitness evaluation function to evaluate the fitness value of each individual in each population; the individual inputs the independent variables of the training set (a set of data) into the GP tree to obtain the predicted value, and calculates the fitting error of the GP individual on the training set. The calculation formula is as follows:
[0054]
[0055] Among them, n represents the number of data samples, y i Represents the model's predicted fitting output value for the i-th sample, y io Represents the actual output value of the i-th sample.
[0056] To speed up fitness evaluation, a certain number of evaluated trees are stored in an archive or list; during fitness evaluation, if a new tree already exists in the archive, its fitness value will be assigned the fitness value of the corresponding tree in the archive; otherwise, the new tree will be evaluated on the training set.
[0057] Step S35: Determine whether to exchange knowledge based on the historical evolution information of the population. If the knowledge exchange conditions are met, select exchange individuals and implement knowledge exchange through crossover and local individual replacement. The specific steps are:
[0058] Step S351: determining whether to conduct knowledge exchange based on population historical evolution information;
[0059] The two indicators of population convergence speed and convergence acceleration are used, and combined with the knowledge exchange of the previous generation to guide whether to communicate; the variable S is introduced to indicate whether the population conducts knowledge exchange. The value of S has two cases, 1 for knowledge exchange and 0 for no knowledge exchange;
[0060] Case 1: When the acceleration is greater than 0, the convergence speed is getting faster, indicating that the evolutionary state of the previous generation is conducive to the convergence of the algorithm, so the communication state is not changed, that is, S is kept unchanged;
[0061] Case 2: When the acceleration is equal to 0, if the speed is greater than 0, it means that the population is still converging, and S remains unchanged; if the speed is equal to 0, it means that the speed is 0 for at least two consecutive generations, and the algorithm may fall into a local optimum and enter a high-level knowledge exchange;
[0062] Case 3: When the acceleration is less than 0, if the speed is greater than 0, it means that the population is converging but the speed is slowing down. In this case, keep S unchanged; if the speed is 0, the value of S should be opposite to the previous state. The switching of S between 0 and 1 can be achieved by taking the absolute value of S-1.
[0063] Note that the convergence rate is always greater than or equal to 0 during the evolution process, so the rate does not ever become less than 0.
[0064] Step S352: selecting a communication individual based on the fitness value distribution;
[0065] First, the number of different fitness values and the number of individuals corresponding to each fitness value are counted; then the number of deleted individuals corresponding to each fitness value is calculated; finally, the replacement individual set corresponding to each fitness value is randomly selected according to the number of deleted individuals.
[0066] Step S353: The communication individual and the auxiliary individual cross to generate offspring;
[0067] After selecting the individual to be replaced in the target population, one is randomly selected from the remaining tasks as an auxiliary task. The auxiliary individual selects the best individual in the auxiliary task, and the replacement individual of the target population and the auxiliary individual generate offspring through crossover.
[0068] Step S354: Use the fitness evaluation function in step S33 to evaluate the fitness of the newly generated individual.
[0069] Step S355: Select excellent individuals from the newly generated individuals to replace the communication individuals selected in step S352 to achieve information exchange between populations.
[0070] Step S36: Perform selection, crossover and mutation operations, and each population evolves to generate the next generation population.
[0071] Step S37: Use the fitness evaluation function in step S34 to evaluate the fitness value of each individual in the new population.
[0072] Step S38: Determine whether the maximum number of iterations of the population has been reached; if so, stop the evolution; otherwise, go to step S35 to continue the search process.
[0073] Step S4: During the evolution process, the information exchange module is used to promote individual crossover between populations and realize information exchange between different prediction tasks.
[0074] Step S5: After the evolution is completed, the individual with the smallest error in each population is selected through the test module as the regression model for each task to be predicted to obtain the final prediction result.
[0075] In order to further illustrate the superiority of the present invention in the problem of air quality prediction, Table 1 shows the prediction performance of the present invention, the single-task GP method, and the multi-task GP method on the carbon dioxide concentration dataset.
[0076] The original carbon dioxide concentration data set includes 260 sample data points, namely, the monthly average atmospheric CO2 concentration obtained from air samples collected in the Northwest Territories of Canada from January 1986 to August 2007. The original data set is denoted as CO2, representing Task 1; 40 important points that can capture the original problem curve are selected from the original time series as a simplified time series, denoted as SCO2, representing Task 2. Each prediction problem is executed independently 30 times, the size of the individual in the population is set to 50, the maximum number of iterations is set to 50, and the performance index value obtained each time is recorded. Table 1 shows the mean and standard deviation of the fitting error RMSE, and the best results are highlighted in bold. By comparison, it can be seen that the method proposed in the present invention shows superior prediction performance when performing air quality prediction. Specifically, the mean and standard deviation of the fitting error of the proposed method are superior to those of the comparative method, proving that the present invention improves the performance on each prediction task and that the method has good stability.
[0077] Table 1
[0078]
[0079] In summary, the air quality prediction method based on multi-task genetic programming proposed in the present invention can effectively handle the air quality prediction problem and has good stability.
[0080] Although the present invention has been described in detail above with general description and specific embodiments, some modifications or improvements can be made on the basis of the present invention. The above description is only a preferred embodiment of the present invention and is not limited to the scope of the present invention. Other changes and modifications made by those skilled in the art without departing from the spirit and scope of protection of the present invention are still included in the scope of protection of the present invention.
Claims
1. An air quality prediction method based on multi-task genetic programming, characterized in that: The following steps are involved: Step S1: obtaining k groups of data of tasks to be predicted through an acquisition module; Step S2: preprocessing k groups of data to be predicted through a preprocessing module, and correspondingly inputting k genetic planning populations; Step S3: automatically learning a model corresponding to the data to be predicted using each genetic programming population through a model learning module; Step S4: During the evolution process, the information exchange module is used to promote individual crossover between populations and realize information exchange between different prediction tasks; Step S5: After the evolution is completed, the individual with the smallest error in each population is selected through the test module as the regression model for each task to be predicted to obtain the final prediction result.
2. The air quality prediction method based on multi-task genetic programming according to claim 1, characterized in that: The specific steps of step S3 are: Step S31: input multiple sets of data to be predicted; Step S32: designing a plurality of population function sets corresponding to the plurality of groups of data, and inputting the independent variables of the data into the genetic planning individuals as terminal sets; Step S33: Generate GP tree individuals and initialize k populations for learning regression models corresponding to k groups of data to be predicted; Step S34: Select an individual fitness evaluation function to evaluate the fitness value of each individual in each population; Step S35: judging whether to conduct knowledge exchange according to the historical evolution information of the population, and if the knowledge exchange conditions are met, selecting exchange individuals, and realizing knowledge exchange through crossover and local individual replacement; Step S36: performing selection, crossover and mutation operations, and each population evolves to generate the next generation population; Step S37: using the fitness evaluation function in step S34 to evaluate the fitness value of each individual in the new population; Step S38: Determine whether the maximum number of iterations of the population has been reached; if so, stop the evolution; otherwise, go to step S35 to continue the search process.
3. The air quality prediction method based on multi-task genetic programming according to claim 2, characterized in that: The function set in step S32 is "+", "-", "*", " / ", "sin" and "cos", wherein " / " is a protected division, and when the divisor is 0, 1 is returned instead of an error or infinity.
4. The air quality prediction method based on multi-task genetic programming according to claim 2, characterized in that: In step S33, the size of the GP population is set to 50, the number of iterations is set to 50, the individual generation method is "Ramped half-and-half", and the tree depth range is [2,8].
5. The air quality prediction method based on multi-task genetic programming according to claim 2, characterized in that: In step S34, the individual inputs the independent variables of the training set into the GP tree to obtain the predicted value, and calculates the fitting error of the GP individual on the training set. The calculation formula is as follows: Among them, n represents the number of data samples, y i Represents the model's predicted fitting output value for the i-th sample, y io Represents the actual output value of the i-th sample; To speed up fitness evaluation, a certain number of evaluated trees are stored in an archive or list; during fitness evaluation, if a new tree already exists in the archive, its fitness value will be assigned the fitness value of the corresponding tree in the archive; otherwise, the new tree will be evaluated on the training set.
6. The air quality prediction method based on multi-task genetic programming according to claim 2, characterized in that: The specific steps of step S35 include: Step S351: determining whether to conduct knowledge exchange based on population historical evolution information; The two indicators of population convergence speed and convergence acceleration are used, and combined with the knowledge exchange of the previous generation to guide whether to communicate; the variable S is introduced to indicate whether the population conducts knowledge exchange. The value of S has two cases, 1 for knowledge exchange and 0 for no knowledge exchange; Case 1: When the acceleration is greater than 0, the convergence speed is getting faster, indicating that the evolutionary state of the previous generation is conducive to the convergence of the algorithm, so the communication state is not changed, that is, S is kept unchanged; Case 2: When the acceleration is equal to 0, if the speed is greater than 0, it means that the population is still converging, and S remains unchanged; if the speed is equal to 0, it means that the speed is 0 for at least two consecutive generations, and the algorithm may fall into a local optimum and enter a high-level knowledge exchange; Case 3: When the acceleration is less than 0, if the speed is greater than 0, it means that the population is converging but the speed is slowing down. In this case, keep S unchanged; if the speed is 0, the value of S should be opposite to the previous state. The absolute value of S-1 can be taken to achieve the switching of S between 0 and 1; Step S352: selecting a communication individual based on the fitness value distribution; First, count the number of different fitness values and the number of individuals corresponding to each fitness value; then calculate the number of deleted individuals corresponding to each fitness value; finally, randomly select the replacement individual set corresponding to each fitness value according to the number of deleted individuals; Step S353: The communication individual and the auxiliary individual cross to generate offspring; After selecting the replaced individual in the target population, randomly select one from the remaining tasks as an auxiliary task. The auxiliary individual selects the best individual in the auxiliary task. The replacement individual of the target population and the auxiliary individual generate offspring through crossover. Step S354: using the fitness evaluation function in step S33 to evaluate the fitness of the newly generated individual; Step S355: Select excellent individuals from the newly generated individuals to replace the communication individuals selected in step S352 to achieve information exchange between populations.
