A method, device, terminal and storage medium for predicting air quality

By using seasonal factors to correct the initial prediction results in the air quality prediction model, the prediction inaccuracy problem caused by the failure to consider seasonal changes in the prior art is solved, and the prediction accuracy of air quality data is significantly improved.

CN113139673BActive Publication Date: 2024-11-12XIAN TIANHE DEFENCE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011217917.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-04
Publication Date
2024-11-12
Estimated Expiration
2040-11-04

AI Technical Summary

Technical Problem

The existing air quality data prediction methods do not consider seasonal changes, resulting in inaccurate prediction results.

Method used

The target time period is initially predicted by a preset air quality prediction model, historical air quality data are obtained to determine the corresponding seasonal factors, and the initial forecast results are corrected to consider seasonal factors and improve prediction accuracy.

Benefits of technology

By considering the impact of seasonal factors on air quality data, the accuracy of the prediction results is significantly improved, making the final prediction results closer to the actual situation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113139673B_ABST
    Figure CN113139673B_ABST
Patent Text Reader

Abstract

The present application is applicable to the field of computer technology, and provides a method, device, terminal and storage medium for predicting air quality, including: predicting the air quality data of a target time period based on a preset air quality prediction model to obtain an initial prediction result; obtaining historical air quality data; determining a seasonal factor corresponding to the target time period based on the historical air quality data; and correcting the initial prediction result based on the seasonal factor to obtain a final prediction result corresponding to the air quality data of the target time period. The above method, by determining the seasonal factor corresponding to the target time period to be predicted through historical air quality data, and correcting the initial prediction result based on the seasonal factor, takes into account the impact of seasonal factors on air quality data, so that the final prediction result corresponding to the predicted air quality data of the target time period is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and in particular, relates to a method for predicting air quality, a device for predicting air quality, a terminal for predicting air quality, and a storage medium. Background Art

[0002] Accurate prediction of air quality is extremely important to people’s life and production.

[0003] The existing PM2.5 concentration prediction methods mainly include linear regression, nonparametric regression, neural network, support vector machine, neuro-fuzzy inference system, chaos theory, wavelet analysis, etc. Since PM2.5 concentration is strongly correlated with seasonal changes, these prediction methods used in the prior art do not take into account the impact of seasonal changes on PM2.5 concentration, resulting in inaccurate predicted PM2.5 data. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a method for predicting air quality, a device for predicting air quality, a terminal for predicting air quality and a storage medium, so as to solve the problem that the air quality data prediction method used in the prior art does not take into account the impact of seasonal changes, resulting in inaccurate predicted air quality data.

[0005] A first aspect of an embodiment of the present application provides a method for predicting air quality, comprising:

[0006] Predict the air quality data for the target time period based on the preset air quality prediction model to obtain an initial prediction result;

[0007] Get historical air quality data;

[0008] Determining a seasonal factor corresponding to the target time period based on the historical air quality data;

[0009] The initial prediction result is corrected based on the seasonal factor to obtain a final prediction result corresponding to the air quality data in the target time period.

[0010] In the embodiment of the present application, the terminal predicts the air quality data of the target time period based on a preset air quality prediction model to obtain an initial prediction result; determines the seasonal factor corresponding to the target time period based on the acquired historical air quality data; and corrects the initial prediction result based on the seasonal factor to obtain a final prediction result corresponding to the air quality data of the target time period. Since the seasonal factor corresponding to the target time period to be predicted is determined by the historical air quality data, and the initial prediction result is corrected based on the seasonal factor, the influence of the seasonal factor on the air quality data is taken into account, so that the final prediction result corresponding to the predicted air quality data of the target time period is more accurate.

[0011] Optionally, determining the seasonal factor corresponding to the target time period based on the historical air quality data includes:

[0012] Preprocessing the historical air quality data to obtain first data;

[0013] Acquire first season characteristic data in the first data, where the first season characteristic data is used to characterize air quality data that is strongly correlated with seasons in the historical air quality data;

[0014] Second data is obtained from the first seasonal characteristic data, and the seasonal factor is determined based on the second data; the second data is historical data of the same period corresponding to the target time period in the first seasonal characteristic data.

[0015] In the above method, the seasonal factor is determined based on the historical data of the same period corresponding to the target time period, so that the seasonal factor obtained is more consistent with the air quality data of the target time period. When the initial prediction result corresponding to the air quality data of the target time period is corrected by the seasonal factor, the corrected final prediction result can be made more accurate.

[0016] Optionally, the preprocessing the historical air quality data to obtain the first data includes:

[0017] Performing interpolation processing on the historical air quality data to obtain interpolation data;

[0018] The interpolation data is subjected to denoising to obtain the first data.

[0019] Optionally, the acquiring first seasonal characteristic data in the first data includes:

[0020] Dividing the first data into a plurality of unit group data;

[0021] Determine the attribute value corresponding to each unit group data; the attribute value includes variance;

[0022] The unit group data whose attribute value is greater than a preset threshold is obtained as the first seasonal characteristic data.

[0023] Optionally, before predicting the air quality data of the target time period based on a preset air quality prediction model and obtaining an initial prediction result, the method further includes:

[0024] Acquire second season characteristic data in the first data, where the second season characteristic data is used to characterize air quality data that is weakly correlated with season in the historical air quality data;

[0025] converting the second seasonal characteristic data into stationary non-white noise data;

[0026] Determining parameters required for constructing the air quality prediction model based on the stationary non-white noise data;

[0027] The air quality prediction model is constructed based on the parameters and the preset function.

[0028] In the above method, air quality data that is weakly correlated with the season is selected from the historical air quality data as the second season characteristic data, and the parameters required to construct the air quality prediction model are determined based on the second season characteristic data, thereby constructing the air quality prediction model. This is equivalent to excluding the air quality data that is strongly correlated with the season when constructing the air quality prediction model, so that the initial prediction results predicted by the constructed air quality prediction model can better fit the characteristics of the usual air quality data, and then when the initial prediction results are subsequently corrected by seasonal factors, there will be no other interference factors, making the final prediction results more accurate; and the air quality data is predicted by the air quality prediction model, which improves the prediction efficiency.

[0029] Optionally, after constructing the air quality prediction model based on the parameters and the preset function, the method further includes:

[0030] Get the validation dataset;

[0031] The air quality prediction model is verified based on the verification data set, and the parameters of the air quality prediction model are adjusted according to the verification result.

[0032] Optionally, determining the parameters required to construct the air quality prediction model based on the stationary non-white noise data includes:

[0033] Performing autocorrelation analysis on the stationary non-white noise data to obtain a first analysis result;

[0034] Performing partial autocorrelation analysis on the stationary non-white noise data to obtain a second analysis result;

[0035] The parameter is determined based on the first analysis result and the second analysis result.

[0036] A second aspect of an embodiment of the present application provides a device for predicting air quality, including:

[0037] A prediction unit, used to predict the air quality data of a target time period based on a preset air quality prediction model to obtain an initial prediction result;

[0038] An acquisition unit, used for acquiring historical air quality data;

[0039] a determining unit, configured to determine a seasonal factor corresponding to the target time period based on the historical air quality data;

[0040] The correction unit is used to correct the initial prediction result based on the seasonal factor to obtain a final prediction result corresponding to the air quality data in the target time period.

[0041] Optionally, the determining unit includes:

[0042] A processing unit, configured to pre-process the historical air quality data to obtain first data;

[0043] A first season characteristic data acquisition unit, used to acquire first season characteristic data in the first data, where the first season characteristic data is used to characterize the air quality data that is strongly correlated with the season in the historical air quality data;

[0044] The second data acquisition unit is used to acquire second data from the first seasonal characteristic data and determine the seasonal factor based on the second data; the second data is historical data of the same period corresponding to the target time period in the first seasonal characteristic data.

[0045] Optionally, the first seasonal characteristic data acquisition unit is specifically used to:

[0046] Performing interpolation processing on the historical air quality data to obtain interpolation data;

[0047] The interpolation data is subjected to denoising to obtain the first data.

[0048] Optionally, the second data acquisition unit is specifically used to:

[0049] Dividing the first data into a plurality of unit group data;

[0050] Determine the attribute value corresponding to each unit group data; the attribute value includes variance;

[0051] The unit group data whose attribute value is greater than a preset threshold is obtained as the first seasonal characteristic data.

[0052] Optionally, the device further comprises:

[0053] A second season characteristic data acquisition unit, used to acquire second season characteristic data in the first data, wherein the second season characteristic data is used to characterize the air quality data that is weakly correlated with the season in the historical air quality data;

[0054] A conversion unit, used for converting the second seasonal characteristic data into stationary non-white noise data;

[0055] A parameter determination unit, used to determine the parameters required to construct the air quality prediction model based on the stationary non-white noise data;

[0056] A construction unit is used to construct the air quality prediction model based on the parameters and a preset function.

[0057] Optionally, the device further comprises:

[0058] A first verification unit, used to obtain a verification data set;

[0059] The second verification unit is used to verify the air quality prediction model based on the verification data set and adjust the parameters of the air quality prediction model according to the verification result.

[0060] Optionally, the parameter determination unit is specifically used to:

[0061] Performing autocorrelation analysis on the stationary non-white noise data to obtain a first analysis result;

[0062] Performing partial autocorrelation analysis on the stationary non-white noise data to obtain a second analysis result;

[0063] The parameter is determined based on the first analysis result and the second analysis result.

[0064] A third aspect of an embodiment of the present application provides a terminal for predicting air quality, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for predicting air quality as described in the first aspect above when executing the computer program.

[0065] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for predicting air quality as described in the first aspect above are implemented.

[0066] A fifth aspect of an embodiment of the present application provides a computer program product. When the computer program product is run on a terminal for predicting air quality, the terminal for predicting air quality executes the steps of the method for predicting air quality described in the first aspect above.

[0067] The present invention provides a method for predicting air quality, a device for predicting air quality, a terminal for predicting air quality, and a storage medium, which have the following beneficial effects:

[0068] In the embodiment of the present application, the terminal predicts the air quality data of the target time period based on a preset air quality prediction model to obtain an initial prediction result; determines the seasonal factor corresponding to the target time period based on the acquired historical air quality data; and corrects the initial prediction result based on the seasonal factor to obtain a final prediction result corresponding to the air quality data of the target time period. Since the seasonal factor corresponding to the target time period to be predicted is determined by the historical air quality data, and the initial prediction result is corrected based on the seasonal factor, the influence of the seasonal factor on the air quality data is taken into account, so that the final prediction result corresponding to the predicted air quality data of the target time period is more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0070] Figure 1 is a flow chart of an implementation method of predicting air quality provided by an embodiment of the present application;

[0071] Figure 2 is a flow chart of an implementation method of predicting air quality provided by another embodiment of the present application;

[0072] Figure 3 Schematic diagram of historical air quality data provided for this application;

[0073] Figure 4 Comparison chart provided for this application;

[0074] Figure 5 Autocorrelation plots and partial autocorrelation plots provided for this application;

[0075] Figure 6 Model validation diagram provided for this application;

[0076] Figure 7is a schematic diagram of a device for predicting air quality provided by an embodiment of the present application;

[0077] Figure 8 It is a schematic diagram of a terminal for predicting air quality provided by another embodiment of the present application. DETAILED DESCRIPTION

[0078] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0079] In the prior art, air quality data is predicted by linear regression, nonparametric regression, neural network, support vector machine, neural fuzzy inference system, chaos theory, wavelet analysis, etc. Since most air quality data are strongly correlated with seasonal changes, these prediction methods used in the prior art do not take into account the impact of seasonal changes on air quality data, resulting in inaccurate predicted air quality data.

[0080] In view of this, the present application provides a method for predicting air quality, in which the terminal predicts the air quality data of the target time period based on a preset air quality prediction model to obtain an initial prediction result; determines the seasonal factor corresponding to the target time period based on the acquired historical air quality data; and corrects the initial prediction result based on the seasonal factor to obtain a final prediction result corresponding to the air quality data of the target time period. Since the seasonal factor corresponding to the target time period to be predicted is determined by the historical air quality data, and the initial prediction result is corrected based on the seasonal factor, the influence of the seasonal factor on the air quality data is taken into account, so that the final prediction result corresponding to the predicted air quality data of the target time period is more accurate.

[0081] See also Figure 1 , Figure 1 : is a schematic flow chart of a method for predicting air quality provided in an embodiment of the present application. The execution subject of the method for predicting air quality in this embodiment is a terminal, which includes but is not limited to mobile terminals such as smart phones, tablet computers, computers, personal digital assistants (PDAs), and may also include terminals such as desktop computers and servers. Figure 1 The method for predicting air quality shown may include S101 to S104, which are specifically as follows:

[0082] S101: Predicting the air quality data of a target time period based on a preset air quality prediction model to obtain an initial prediction result.

[0083] The air quality prediction model is constructed based on historical air quality data and is used to predict the air quality data of the target time period. The target time period is the time period for which you want to predict the air quality data. It can be an approximate date range or a specific time point. For example, the target time period can be October 1, 2020 to December 1, 2020, March 1, 2021 to March 21, 2021, and October 1, 2020 from 9 am to 6 pm. This is only for illustrative purposes and is not limited to this.

[0084] The air quality data may include sulfur dioxide concentration data, nitrogen dioxide concentration data, inhalable particulate matter (fine particulate matter, PM2.5 for short) concentration data, etc. In this embodiment, PM2.5 concentration data is used as an example for explanation.

[0085] In this embodiment, a pre-built air quality prediction model is pre-stored in the terminal. The air quality prediction model is constructed based on historical air quality data. The preset air quality prediction model can be a pre-built differential integrated moving average autoregressive (ARIMA) model.

[0086] Exemplarily, the PM2.5 concentration data of the target time period is predicted by a preset ARIMA model to obtain a corresponding initial prediction result. For example, the target time period to be predicted is input into a preset ARIMA model for prediction processing, and the ARIMA model outputs a corresponding initial prediction result.

[0087] S102: Obtain historical air quality data.

[0088] Historical air quality data refers to air quality data of any time period and any city before the current time. For example, historical air quality data may include PM2.5 concentration data of any time period in previous years, sulfur dioxide concentration data of any time period in previous years, PM2.5 concentration data before the current time, etc.

[0089] The terminal can obtain historical air quality data on the network, for example, obtaining PM2.5 concentration data of any time period and any city in the PM2.5 historical database; it can also obtain historical air quality data from a local database. For example, the local database pre-stores historical air quality data corresponding to multiple cities and multiple time periods. The terminal can selectively select historical air quality data from the local database according to the target city and target time period to be predicted; the user can also collect the data in advance and upload it to this terminal. This is only an example and is not limited to this.

[0090] For example, if you want to predict the PM2.5 concentration data in Xi'an from March 1, 2021 to March 21, 2021, the historical air quality data obtained can be all the PM2.5 concentration data in Xi'an from 2018 to 2019.

[0091] S103: Determine a seasonal factor corresponding to the target time period based on the historical air quality data.

[0092] The seasonal factor is used to correct the initial prediction results corresponding to the air quality data of the target time period. In order to make the final prediction results corresponding to the air quality data of the target time period more accurate, different seasonal factors can be determined for different target time periods and different cities.

[0093] Exemplarily, the historical air quality data of the city to be predicted is first obtained, and the air quality data of the historical period corresponding to the target time period is selected from the historical air quality data, and the seasonal factor corresponding to the target time period is determined based on the selected historical period data.

[0094] Optionally, in a possible implementation method, historical air quality data of a city that needs to be predicted may be first obtained, and the historical air quality data may be preprocessed to obtain first data; first season characteristic data in the first data may be obtained; second data may be obtained from the first season characteristic data, and the seasonal factor corresponding to the target time period may be determined based on the second data.

[0095] In the above method, the seasonal factor is determined based on the historical data of the same period corresponding to the target time period, so that the seasonal factor obtained is more consistent with the air quality data of the target time period. When the initial prediction result corresponding to the air quality data of the target time period is corrected by the seasonal factor, the corrected final prediction result can be made more accurate.

[0096] Optionally, in a possible implementation, the above S103 may include S1031 to S1033, which are specifically as follows:

[0097] S1031: Preprocess the historical air quality data to obtain first data.

[0098] The preprocessing may include interpolation processing and denoising processing. After obtaining the historical air quality data of the city to be predicted, the historical air quality data is preprocessed, and the data obtained after the preprocessing is the first data.

[0099] There may be null values ​​in historical air quality data, which means that no air quality data was recorded in a certain period of time. Interpolation processing is used to fill the null values ​​in historical air quality data. There may also be abnormal data in historical air quality data, such as values ​​that are too large, too small, or negative. De-noising processing is used to remove these abnormal data.

[0100] Exemplarily, the historical air quality data may be interpolated to fill in the null values ​​in the historical air quality data, and then the historical air quality data after the interpolation may be denoised to remove abnormal data to obtain the first data.

[0101] S1032: Acquire first season characteristic data in the first data, where the first season characteristic data is used to characterize air quality data that is strongly correlated with the season in the historical air quality data.

[0102] The first season characteristic data is used to characterize the air quality data that is strongly correlated with the season in the historical air quality data. It can be understood that the first season characteristic data is air quality data that is greatly fluctuated by seasonal factors. Exemplarily, the data whose attribute value corresponding to the unit group data in the first data is greater than the preset threshold can be used as the first season characteristic data, that is, the data whose attribute value corresponding to the unit group data in the first data is greater than the preset threshold is the air quality data that is strongly correlated with the season. Specifically, the first data can be divided into multiple unit group data, the attribute value corresponding to each unit group data is determined, and the unit group data whose attribute value is greater than the preset threshold is recorded as the first season characteristic data. Among them, the attribute value may include variance, mean, maximum value, minimum value, etc.

[0103] S1033: Acquire second data from the first seasonal characteristic data, and determine the seasonal factor based on the second data; the second data is historical data of the same period corresponding to the target time period in the first seasonal characteristic data.

[0104] The first season characteristic data is composed of multiple unit group data that meet the requirements (unit group data with attribute values ​​greater than a preset threshold), and the time periods corresponding to these unit group data are obtained and sorted according to time. According to the sorting result, the second data is selected from these unit group data, that is, the air quality data of the historical period corresponding to the target time period. For example, the target time period is from October 1, 2020 to December 1, 2020, and the historical air quality data initially obtained is the air quality data of all time periods from 2018 to 2019. The historical data of the same period corresponding to the target time period is the air quality data from October 1, 2018 to December 1, 2018 and / or the air quality data from October 1, 2019 to December 1, 2019.

[0105] The seasonal factor corresponding to the target time period is determined based on the acquired second data. Exemplarily, the seasonal factor can be calculated by the following formula:

[0106]

[0107] Among them, τ t represents the seasonal factor, μ Z represents the mean of the second data corresponding to different years, and t represents the time interval corresponding to the air quality data in each unit group data.

[0108] Optionally, in a possible implementation, the above S1031 may include S10311 to S10312, which are specifically as follows:

[0109] S10311: Perform interpolation processing on the historical air quality data to obtain interpolation data.

[0110] Null values ​​in historical air quality data are obtained, and interpolation processing is performed on the null values, and the data obtained is interpolation data. Exemplarily, the historical air quality data can be screened by a computer programming language (Python) to obtain null values ​​in the historical air quality data. The screened null values ​​can be interpolated by any method such as Lagrange interpolation method, Newton interpolation method, K-NearestNeighbor (KNN) classification algorithm to obtain interpolation data.

[0111] In this embodiment, Newton interpolation method is used as an example for explanation. The interpolation function used in Newton interpolation method is as follows:

[0112] N n (x) = N n-1 (x)+f[x0,x1,...,x n ](x-x0)...(xx n-1 )

[0113] In the above interpolation function, N n (x) represents a null value, i.e., the nth historical air quality data to be filled, N n-1 (x) represents the same as N n (x) The adjacent previous historical air quality data.

[0114] Substituting each historical air quality data into the above interpolation function accordingly can realize the interpolation processing of the null value.

[0115] S10312: Perform denoising processing on the interpolation data to obtain the first data.

[0116] The interpolation data obtained after the interpolation processing is subjected to denoising processing, and the data obtained is the first data. The normal data range to which the historical air quality data belongs can be pre-set, and all the historical air quality data exceeding the normal data range can be eliminated; a threshold can also be pre-set to eliminate the historical air quality data greater than the threshold. Considering that the historical air quality data will be affected by the season, the normal data range can be set wider, or the threshold can be set larger to retain more first characteristic data, thereby ensuring that the seasonal factor determined subsequently is more accurate.

[0117] Exemplarily, each historical air quality data is compared to see if it is within the normal data range. If so, it is retained; if it exceeds the normal data range, it is removed. Alternatively, each historical air quality data is compared to see if it is greater than a preset threshold. If it is less than or equal to the preset threshold, it is retained; if it is greater than the preset threshold, it is removed. All retained historical air quality data constitute the first data. Optionally, the interpolated data can also be denoised by a k-means clustering algorithm to obtain the first data.

[0118] Optionally, in a possible implementation, the above S1032 may include S10321 to S10323, which are specifically as follows:

[0119] S10321: Divide the first data into a plurality of unit group data.

[0120] The first data can be divided into a plurality of unit group data by using the STING clustering algorithm, each unit group data includes a plurality of historical air quality data, and the number of historical air quality data included in each unit group data is not limited. When a unit group data includes a large amount of historical air quality data, it can be further divided.

[0121] S10322: Determine the attribute value corresponding to each unit group data; the attribute value includes variance.

[0122] The attribute value may include variance, mean, maximum value, minimum value, etc. That is, the variance, mean, maximum value, minimum value, etc. corresponding to each unit group data is determined. Exemplarily, for a unit group data, each historical air quality data contained in the unit group data is obtained, the variance and mean of these historical air quality data are calculated, and the maximum and minimum values ​​of these historical air quality data are determined.

[0123] It is worth noting that the attribute value corresponding to each divided unit group data can be determined in turn; or the unit group data can be randomly selected each time to calculate the attribute value corresponding to the unit group data. After each attribute value calculation, all unit group data need to be traversed to calculate the unit group data for which the attribute value has not been calculated until all unit group data are processed.

[0124] S10323: Acquire unit group data whose attribute value is greater than a preset threshold as the first seasonal characteristic data.

[0125] The attribute value corresponding to each unit group data is compared with the preset threshold value. When the attribute value corresponding to the unit group data is greater than the preset threshold value, the unit group data is recorded as the first season characteristic data.

[0126] Optionally, when the attribute value corresponding to the unit group data is less than or equal to a preset threshold, the unit group data is recorded as second season characteristic data. The second season characteristic data is used to characterize the air quality data that is weakly correlated with the season in the historical air quality data. It can be understood that the second season characteristic data is air quality data with less fluctuation due to seasonal factors. Exemplarily, data whose attribute value corresponding to the unit group data in the first data is less than or equal to the preset threshold can be used as the second season characteristic data, that is, data whose attribute value corresponding to the unit group data in the first data is less than or equal to the preset threshold is air quality data that is weakly correlated with the season.

[0127] Exemplarily, the first season characteristic data and the second season characteristic data may be determined by the following formula, which is as follows:

[0128]

[0129] In the above formula, σ i 2 represents the variance corresponding to the i-th unit group data, f represents the preset threshold, N represents the number of all historical air quality data, X represents the variable value, μ represents the variance corresponding to all historical air quality data, and α represents the adjustment factor, which can be calculated by subtracting the minimum value from the maximum value in each unit group data and then squaring the difference.

[0130] S104: Correcting the initial prediction result based on the seasonal factor to obtain a final prediction result corresponding to the air quality data of the target time period.

[0131] The seasonal factor is multiplied by the initial prediction result, and the result obtained is the final prediction result corresponding to the air quality data of the target time period. For example, the initial prediction result can be recorded as y p , the seasonal factor is τ t The final prediction result is recorded as y z , then yz =y p ×τ t .

[0132] There is a strong correlation between air quality data and seasons, that is, seasonal changes will have a great impact on air quality data. Traditional air quality forecasts do not take seasonal factors into account, resulting in inaccurate predicted air quality data. However, by correcting the initial forecast results based on seasonal factors and taking seasonal factors into account, the final forecast results will be more accurate.

[0133] In the above embodiment, the terminal predicts the air quality data of the target time period based on the preset air quality prediction model to obtain an initial prediction result; determines the seasonal factor corresponding to the target time period based on the acquired historical air quality data; and corrects the initial prediction result based on the seasonal factor to obtain the final prediction result corresponding to the air quality data of the target time period. Since the seasonal factor corresponding to the target time period to be predicted is determined by the historical air quality data, and the initial prediction result is corrected based on the seasonal factor, the influence of the seasonal factor on the air quality data is taken into account, so that the final prediction result corresponding to the predicted air quality data of the target time period is more accurate.

[0134] Optionally, in a possible implementation, after preprocessing the historical air quality data to obtain the first data, trend, seasonality, and periodicity analysis may be performed on the first data, and whether the first data has seasonal characteristics may be determined based on the trend analysis results, seasonal analysis results, and periodicity analysis results.

[0135] Exemplarily, the centralized moving average method may be used to determine the trend of the first data, and the formula is as follows:

[0136]

[0137] Among them, T t is the trend term, f is the time series frequency, for example, f can be 90, l is the time series length, and when t exceeds the domain of the subscript, its value is null.

[0138] The calculated trend items are averaged to obtain the first value, and the first value is centralized to obtain the second value. Observe whether the second value has periodic fluctuations around 0. If so, the first data is considered to have seasonal characteristics, and the seasonal factor can be calculated to ensure that the final seasonal factor is more accurate. If not, the first data is considered to have no seasonal characteristics, and the historical air quality data can be re-obtained.

[0139] Optionally, in a possible implementation, before predicting the air quality data of the target time period based on the preset air quality prediction model and obtaining the initial prediction result, an air quality prediction model may be pre-built. Figure 2 , Figure 2 A schematic flow chart of a method for predicting air quality provided in another embodiment of the present application. Figure 2 The method for predicting air quality shown in FIG. 1 may include S201 to S208. In this embodiment, S205 to S208 are similar to Figure 1 For S101 to S104 in the corresponding embodiment, reference may be made to the description of S101 to S104 above, which will not be described in detail in this embodiment. S201 to S204 will be described in detail below.

[0140] S201: Acquire second season characteristic data in the first data, where the second season characteristic data is used to characterize air quality data that is weakly correlated with the season in the historical air quality data.

[0141] The second season characteristic data is used to characterize the air quality data that is weakly correlated with the season in the historical air quality data. It can be understood that the second season characteristic data is the air quality data with less fluctuation due to seasonal factors. Exemplarily, the data whose attribute value corresponding to the unit group data in the first data is less than or equal to the preset threshold value can be used as the second season characteristic data, that is, the data whose attribute value corresponding to the unit group data in the first data is less than or equal to the preset threshold value is the air quality data that is weakly correlated with the season.

[0142] The first data is divided into a plurality of unit group data; the attribute value corresponding to each unit group data is determined; and the unit group data whose attribute value is less than or equal to a preset threshold value is obtained as the second seasonal characteristic data. Exemplarily, the attribute value corresponding to each unit group data is compared with the preset threshold value, and when the attribute value corresponding to the unit group data is less than or equal to the preset threshold value, the unit group data is recorded as the second seasonal characteristic data. The specific acquisition method can refer to the process of obtaining the first seasonal characteristic data, which will not be repeated here.

[0143] S202: Convert the second seasonal characteristic data into stationary non-white noise data.

[0144] Perform a stationary test and a white noise test on the second season characteristic data, and determine whether the second season characteristic data is stationary non-white noise data based on the test results. For example, first perform a stationary test on the second season characteristic data, and then perform a white noise test on the second season characteristic data. When the second season characteristic data is not stationary non-white noise data, perform n-order difference processing on the second season characteristic data to convert the second season characteristic data into stationary non-white noise data.

[0145] Exemplarily, whether the second season characteristic data is stable can be tested by a stationary test function, and the stationary test function is as follows:

[0146]

[0147] In the above stationarity test function, If i=2 or i=3, the value of correla is 0 or close to 0, then the second season characteristic data is determined to be stable. The value of i can be adjusted according to the second season characteristic data, which is only an exemplary description and is not limited to this.

[0148] If the test result shows that the second season characteristic data is not stable, the second season characteristic data is subjected to differential processing. Exemplarily, the second season characteristic data is subjected to n-order differential processing until the second season characteristic data is stable, where n is a positive integer. For example, the second season characteristic data is subjected to first-order differential processing to determine whether the second season characteristic data after the first-order differential is stable. If so, the differential processing is stopped, otherwise, the second-order differential processing is performed. Determine whether the second season characteristic data after the second-order differential is stable. If so, the differential processing is stopped, otherwise, the third-order differential processing is performed, and so on, until the second season characteristic data is stable. When the second season characteristic data is stable, the order n of the differential is recorded.

[0149] S203: Determine parameters required to construct the air quality prediction model based on the stationary non-white noise data.

[0150] When the air quality prediction model is an ARIMA model, the parameters required to construct the ARIMA model are p, d, and q. The stationary non-white noise data can be subjected to autocorrelation analysis to obtain a first analysis result; the stationary non-white noise data can be subjected to partial autocorrelation analysis to obtain a second analysis result, and the values ​​of p and q are determined based on the first analysis result and the second analysis result; the value of d is determined based on the order n of the difference.

[0151] Optionally, in a possible implementation, the above S203 may include S2031 to S12033, which are specifically as follows:

[0152] S2031: Perform autocorrelation analysis on the stationary non-white noise data to obtain a first analysis result.

[0153] Perform autocorrelation analysis on the stationary non-white noise data to obtain the autocorrelation graph corresponding to the stationary non-white noise data. Observe the tailing, truncation, lag value, etc. in the autocorrelation graph. For example, if there are always non-zero values ​​in the autocorrelation graph, it will not be always equal to 0 after a certain constant a, or fluctuate randomly around 0, it is considered that there is tailing. If the autocorrelation graph quickly tends to 0 after being greater than a certain constant b, it is considered that there is truncation. The lag value is the constant a and constant b determined when judging tailing and truncation.

[0154] S2032: Perform partial autocorrelation analysis on the stationary non-white noise data to obtain a second analysis result.

[0155] Perform partial autocorrelation analysis on the stationary non-white noise data to obtain the partial autocorrelation graph corresponding to the stationary non-white noise data. Observe the tailing, truncation, lag value, etc. in the partial autocorrelation graph. Exemplarily, if there is always a non-zero value in the partial autocorrelation graph, it will not be always equal to 0 after a certain constant a, or it will fluctuate randomly around 0, and it is considered that there is tailing. If the partial autocorrelation graph quickly tends to 0 after being greater than a certain constant b, it is considered that there is truncation. The lag value is the constant a and constant b determined when judging tailing and truncation.

[0156] S2033: Determine the parameter based on the first analysis result and the second analysis result.

[0157] The values ​​of p and q are determined based on the first analysis result and the second analysis result; the value of d is determined based on the differential order n. Exemplarily, the values ​​of parameters p and q are determined based on constants a and b. The value of parameter p may be determined based on the value of constant a, and the value of parameter q may be determined based on the value of constant b. Alternatively, the value of parameter q may be determined based on the value of constant a, and the value of parameter p may be determined based on the value of constant b. The determination is made based on the actual analysis results, and there is no limitation on this.

[0158] S204: Constructing the air quality prediction model based on the parameters and preset functions.

[0159] When the air quality prediction model is an ARIMA model, the function corresponding to the ARIMA model is:

[0160]

[0161] Among them, X t is a time series, i.e., the target time period to be predicted, p, d, q are the parameters determined in S203 above, L i is the lag operator, φ i is the autoregressive coefficient, θ i is the sliding average coefficient, ε t is the white noise impulse coefficient.

[0162] Optionally, in a possible implementation, in order to ensure that the initial prediction result obtained by the air quality prediction model is more accurate, after S204, it may also include obtaining a verification data set; verifying the air quality prediction model based on the verification data set, and adjusting the parameters of the air quality prediction model according to the verification results.

[0163] The verification data set includes the verification time period and the real air quality data corresponding to each verification time period; wherein the verification time period is any time period before the current time, that is, the time period in which the air quality data can be collected. The terminal obtains the verification data set.

[0164] The air quality prediction model is used to perform prediction processing on each verification time period to obtain the prediction results corresponding to each verification time period. Based on the prediction results corresponding to each verification time period, standard residual graphs, density estimation graphs, QQ linear graphs, correlation graphs, etc. are drawn to observe whether these graphs are consistent with the actual air quality data corresponding to the verification time period. If these graphs do not match the actual air quality data corresponding to the verification time period, the air quality prediction model is adjusted, and the verification is continued based on the air quality prediction model with adjusted parameters until these graphs match the actual air quality data corresponding to the verification time period. If these graphs match the actual air quality data corresponding to the verification time period, it proves that the current air quality prediction model has been constructed and the air quality data of the target time period can be predicted.

[0165] Exemplarily, whether these graphs are consistent with the actual air quality data corresponding to the verification time period can be determined in the following manner. That is, when the standard residual graph and the density estimation graph are approximately normal distribution, the QQ linear graph is a straight line fit, and the value of the correlation graph tends to 0, the correlation graph is proved, and an air quality prediction model with high prediction accuracy is obtained.

[0166] If any of the conditions are not met, that is, the standard residual graph and the density estimation graph are approximately normal distribution, the QQ linear graph is a straight line fit, and the value of the correlation graph tends to 0, the parameters of the air quality prediction model are adjusted. For example, the values ​​of p and q can be modified separately or simultaneously. When modifying, the values ​​of p and q can be added or subtracted with positive integers each time. This is only an exemplary description and is not limited to this.

[0167] In the above method, air quality data that is weakly correlated with the season is selected from the historical air quality data as the second season characteristic data, and the parameters required to construct the air quality prediction model are determined based on the second season characteristic data, thereby constructing the air quality prediction model. This is equivalent to excluding the air quality data that is strongly correlated with the season when constructing the air quality prediction model, so that the initial prediction results predicted by the constructed air quality prediction model can better fit the characteristics of the usual air quality data, and then when the initial prediction results are subsequently corrected by seasonal factors, there will be no other interference factors, making the final prediction results more accurate; and the air quality data is predicted by the air quality prediction model, which improves the prediction efficiency.

[0168] By way of example, some diagrams are provided in this application to help understanding. Figure 3 Schematic diagram of historical air quality data provided for this application, Figure 3 From top to bottom (right to left), the abscissa of the first graph represents time, and the ordinate represents the PM2.5 concentration value. The abscissa of the second graph represents time, and the ordinate represents the trend item after the PM2.5 concentration value is transformed using the centralized moving average method. The abscissa of the third graph represents time, and the ordinate represents the periodic change of the fluctuation amplitude. The abscissa of the fourth graph represents time, and the ordinate represents the linear residual. It can be clearly seen that the PM2.5 concentration data is affected by the season, especially the PM2.5 concentration data from February to March is greatly affected by the season. Figure 4 In the comparison chart provided for this application, the horizontal axis represents time, the vertical axis represents the PM2.5 concentration value, the light gray line represents the trend corresponding to the original historical air quality data, and the dark line represents the trend after removing the seasonal characteristics, that is, the trend corresponding to the characteristic data of the second season. Figure 5 The autocorrelation diagram and partial autocorrelation diagram provided for this application, Figure 5 The upper middle part of the graph (the graph on the right) is an autocorrelation graph. The horizontal axis represents the amount of data (it can be set to 50, 100, 500, etc. according to requirements, and there is no limit to this), and the vertical axis represents the autocorrelation coefficient; Figure 5 The lower middle part of the graph (the graph on the left) is a partial autocorrelation graph. The horizontal axis represents the amount of data (it can be set to 20, 40, 60, etc. according to the needs, and there is no limit to this), and the vertical axis represents the partial autocorrelation coefficient. Figure 6 Model validation diagrams provided for this application, such as Figure 6From left to right and from top to bottom, the following are the standard residual, density estimation, QQ linear graph, and correlogram. The horizontal axis of the standard residual graph represents the amount of data, and the vertical axis represents the residual of the model; the horizontal axis of the density estimation graph represents the kernel function center and width parameter of the density estimation, and the vertical axis represents the density estimation; the horizontal axis of the QQ linear graph represents the theoretical quantile, and the vertical axis represents the sample quantile; the horizontal axis of the correlogram represents the amount of data, and the vertical axis represents the correlation coefficient of the estimated value.

[0169] See also Figure 7 , Figure 7 Schematic diagram of a device for predicting air quality provided in one embodiment of the present application. The device includes units for executing Figure 1 , Figure 2 For details, please refer to the steps in the corresponding embodiment. Figure 1 , Figure 2 For the convenience of explanation, only the parts related to this embodiment are shown. Figure 7 ,include:

[0170] The prediction unit 310 is used to predict the air quality data of the target time period based on a preset air quality prediction model to obtain an initial prediction result;

[0171] An acquisition unit 320, used to acquire historical air quality data;

[0172] A determination unit 330, configured to determine a seasonal factor corresponding to the target time period based on the historical air quality data;

[0173] The correction unit 340 is used to correct the initial prediction result based on the seasonal factor to obtain a final prediction result corresponding to the air quality data in the target time period.

[0174] Optionally, the determining unit 330 includes:

[0175] A processing unit, configured to pre-process the historical air quality data to obtain first data;

[0176] A first season characteristic data acquisition unit, used to acquire first season characteristic data in the first data, where the first season characteristic data is used to characterize the air quality data that is strongly correlated with the season in the historical air quality data;

[0177] The second data acquisition unit is used to acquire second data from the first seasonal characteristic data and determine the seasonal factor based on the second data; the second data is historical data of the same period corresponding to the target time period in the first seasonal characteristic data.

[0178] Optionally, the first seasonal characteristic data acquisition unit is specifically used to:

[0179] Performing interpolation processing on the historical air quality data to obtain interpolation data;

[0180] The interpolation data is subjected to denoising to obtain the first data.

[0181] Optionally, the second data acquisition unit is specifically used to:

[0182] Dividing the first data into a plurality of unit group data;

[0183] Determine the attribute value corresponding to each unit group data; the attribute value includes variance;

[0184] The unit group data whose attribute value is greater than a preset threshold is obtained as the first seasonal characteristic data.

[0185] Optionally, the device further comprises:

[0186] A second season characteristic data acquisition unit, used to acquire second season characteristic data in the first data, wherein the second season characteristic data is used to characterize the air quality data that is weakly correlated with the season in the historical air quality data;

[0187] A conversion unit, used for converting the second seasonal characteristic data into stationary non-white noise data;

[0188] A parameter determination unit, used to determine the parameters required to construct the air quality prediction model based on the stationary non-white noise data;

[0189] A construction unit is used to construct the air quality prediction model based on the parameters and a preset function.

[0190] Optionally, the device further comprises:

[0191] A first verification unit, used to obtain a verification data set;

[0192] The second verification unit is used to verify the air quality prediction model based on the verification data set and adjust the parameters of the air quality prediction model according to the verification result.

[0193] Optionally, the parameter determination unit is specifically used to:

[0194] Performing autocorrelation analysis on the stationary non-white noise data to obtain a first analysis result;

[0195] Performing partial autocorrelation analysis on the stationary non-white noise data to obtain a second analysis result;

[0196] Determine the parameter based on the first analysis result and the second analysis result.

[0197] See also Figure 8 , Figure 8 FIG. 1 is a schematic diagram of a terminal for predicting air quality provided by another embodiment of the present application. Figure 8 As shown, the terminal 4 for predicting air quality in this embodiment includes: a processor 40, a memory 41, and a computer-readable instruction 42 stored in the memory 41 and executable on the processor 40. When the processor 40 executes the computer-readable instruction 42, the steps in the above-mentioned various air quality prediction method embodiments are implemented, such as Figure 1 Alternatively, when the processor 40 executes the computer-readable instructions 42, the functions of each unit in the above embodiments are realized, for example, Figure 7 The functions of units 310 to 340 are shown.

[0198] Exemplarily, the computer-readable instructions 42 may be divided into one or more units, which are stored in the memory 41 and executed by the processor 40 to complete the present application. The one or more units may be a series of computer-readable instruction segments capable of completing specific functions, which are used to describe the execution process of the computer-readable instructions 42 in the terminal 4 for predicting air quality. For example, the computer-readable instructions 42 may be divided into a prediction unit, an acquisition unit, a determination unit, and a correction unit, and the specific functions of each unit are as described above.

[0199] The terminal for predicting air quality may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will appreciate that Figure 8 It is only an example of the terminal 4 for predicting air quality and does not constitute a limitation on the terminal for predicting air quality. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal for predicting air quality may also include input and output terminals, network access terminals, buses, etc.

[0200] The processor 40 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0201] The memory 41 may be an internal storage unit of the terminal for predicting air quality, such as a hard disk or memory of the terminal for predicting air quality. The memory 41 may also be an external storage terminal of the terminal for predicting air quality, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal for predicting air quality. Further, the memory 41 may also include both an internal storage unit and an external storage terminal of the terminal for predicting air quality. The memory 41 is used to store the computer-readable instructions and other programs and data required by the terminal. The memory 41 may also be used to temporarily store data that has been output or is to be output.

[0202] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for predicting air quality, characterized in that: include: Acquire second season characteristic data, where the second season characteristic data is used to characterize air quality data that is weakly correlated with seasons in historical air quality data; Converting the second season characteristic data into stationary non-white noise data; determining parameters required for constructing an air quality prediction model based on the stationary non-white noise data; Constructing the air quality prediction model based on the parameters and the preset function; Predicting the air quality data for the target time period based on the air quality prediction model to obtain an initial prediction result; Get historical air quality data; Preprocessing the historical air quality data to obtain first data; The trend item of the first data is determined by using a centralized moving average method, the trend item is averaged to obtain a first value, the first value is centrally processed to obtain a second value, and when the second value has periodic fluctuations, it is determined that the first data has seasonal characteristics; first seasonal characteristic data in the first data is obtained, and the first seasonal characteristic data is used to characterize the air quality data that is strongly correlated with the season in the historical air quality data; second data is obtained from the first seasonal characteristic data, and a seasonal factor is determined based on the second data and a preset formula; the second data is the historical data of the same period corresponding to the target time period in the first seasonal characteristic data; wherein the air quality data that is strongly correlated with the season refers to air quality data that fluctuates greatly due to seasonal factors; the preset formula is as follows: τ t represents the seasonal factor, μ Z represents the mean of the second data corresponding to different years, and t represents the time interval corresponding to the air quality data in each unit group data; The initial prediction result is corrected based on the seasonal factor to obtain a final prediction result corresponding to the air quality data in the target time period.

2. The method according to claim 1, characterized in that The preprocessing of the historical air quality data to obtain first data includes: Performing interpolation processing on the historical air quality data to obtain interpolation data; The interpolation data is subjected to denoising to obtain the first data.

3. The method according to claim 2, characterized in that The obtaining of first seasonal characteristic data in the first data includes: Dividing the first data into a plurality of unit group data; Determine the attribute value corresponding to each unit group data; the attribute value includes variance; The unit group data whose attribute value is greater than a preset threshold is obtained as the first seasonal characteristic data.

4. The method according to claim 1, characterized in that After constructing the air quality prediction model based on the parameters and the preset function, the method further includes: Get the validation dataset; The air quality prediction model is verified based on the verification data set, and the parameters of the air quality prediction model are adjusted according to the verification result.

5. The method according to claim 1, characterized in that The step of determining the parameters required for constructing the air quality prediction model based on the stationary non-white noise data includes: Performing autocorrelation analysis on the stationary non-white noise data to obtain a first analysis result; Performing partial autocorrelation analysis on the stationary non-white noise data to obtain a second analysis result; The parameter is determined based on the first analysis result and the second analysis result.

6. A device for predicting air quality, characterized in that: include: A prediction unit is used to obtain second season characteristic data, where the second season characteristic data is used to characterize air quality data that is weakly correlated with the season in historical air quality data; convert the second season characteristic data into stationary non-white noise data; and determine parameters required for constructing an air quality prediction model based on the stationary non-white noise data; Constructing the air quality prediction model based on the parameters and the preset function; Predicting the air quality data for the target time period based on the air quality prediction model to obtain an initial prediction result; An acquisition unit, used for acquiring historical air quality data; A determination unit, configured to pre-process the historical air quality data to obtain first data; The trend item of the first data is determined by using a centralized moving average method, the trend item is averaged to obtain a first value, the first value is centrally processed to obtain a second value, and when the second value has periodic fluctuations, it is determined that the first data has seasonal characteristics; first seasonal characteristic data in the first data is obtained, and the first seasonal characteristic data is used to characterize the air quality data that is strongly correlated with the season in the historical air quality data; second data is obtained from the first seasonal characteristic data, and a seasonal factor is determined based on the second data and a preset formula; the second data is the historical data of the same period corresponding to the target time period in the first seasonal characteristic data; wherein the air quality data that is strongly correlated with the season refers to air quality data that fluctuates greatly due to seasonal factors; the preset formula is as follows: τ t represents the seasonal factor, μ Z represents the mean of the second data corresponding to different years, and t represents the time interval corresponding to the air quality data in each unit group data; The correction unit is used to correct the initial prediction result based on the seasonal factor to obtain a final prediction result corresponding to the air quality data in the target time period.

7. A terminal for predicting air quality, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.