Multi-parameter atmospheric environment quality intelligent monitoring system based on Internet of Things
By adaptively constructing a weighted mean square error loss function and adjusting the weights and biases of the LSTM model, the problem of decreased accuracy caused by differences in pollutant parameter prediction errors was solved, thus achieving stable and accurate monitoring of atmospheric environmental quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANDONG CARBON EMISSION INFORMATION TECHNOLOGY CO LTD
- Filing Date
- 2026-01-26
- Publication Date
- 2026-05-05
AI Technical Summary
Existing LSTM models, when monitoring atmospheric environmental quality, suffer from a decline in overall prediction accuracy due to differences in the prediction errors of pollutant parameters, and are unable to effectively capture the overall evolution pattern of atmospheric environmental quality.
By analyzing the degree of disorder in the distribution of prediction errors among various pollutant parameters and the degree of correlation between concentration data, an adaptive weighted mean square error loss function is constructed, and the weights and biases of the LSTM model are adjusted to suppress unrepresentative errors caused by sudden and localized abnormal fluctuations.
This improves the stability and accuracy of the LSTM model in monitoring atmospheric environmental quality, prevents the model from being dominated by non-representative errors, and captures the overall evolution pattern of atmospheric environmental quality.
Smart Images

Figure CN121978276A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a multi-parameter intelligent monitoring system for atmospheric environmental quality based on the Internet of Things. Background Technology
[0002] With the acceleration of urbanization and the increase in transportation and industrial emissions, air pollution has had a significant impact on public health, the ecological environment, and socio-economic development. Currently, by acquiring multiple pollutants and related environmental parameters in the atmosphere in real time and continuously, and using LSTM prediction models to scientifically assess and predict the trend of air quality, the prediction results are mapped to the air quality sub-indices (IAQI) of each pollutant. Then, the primary pollutant is determined based on the maximum value of each sub-indice, forming the overall air quality index (AQI), and finally, the corresponding air quality level is obtained. This helps governments and management departments to understand the patterns of environmental changes, provides the public with health protection references, and guides daily travel and life decisions.
[0003] The LSTM prediction model uses the prediction errors of each pollutant parameter as the optimization objective for backpropagation training and constructs the loss function using mean squared error. However, since atmospheric environmental monitoring points are often directly exposed to complex urban activity environments, their surrounding environmental conditions may change significantly in a short period of time. For example, in urban roadside monitoring scenarios, dense traffic and frequent starts and stops during morning and evening rush hours can cause a significant increase in exhaust emission intensity in local areas within a short period of time; in residential areas or construction areas, temporary construction, material storage, and dust-generating operations may also affect local atmospheric composition within a certain time window. That is, different types of pollutants may have significantly different response modes and response intensities to environmental changes. Some pollutant parameters directly affected by local emissions (such as NO2, PM2.5, etc.) may also be affected. 10 Pollutants such as PM2.5 may experience rapid increases or significant fluctuations in concentration over several sampling periods. In contrast, pollutant parameters more influenced by photochemical reactions, regional transport, or meteorological conditions (such as O3 and SO2) tend to show smaller fluctuations and relatively stable trends within the same timeframe. In LSTM prediction models, the prediction errors of pollutant parameters with abrupt changes or drastic fluctuations are significantly larger than those of other pollutant parameters. During backpropagation, the differences in prediction errors among different pollutant parameters lead to inconsistent gradient effects on model parameter updates, resulting in pollutant parameters with larger prediction errors having a greater impact on model weight and bias updates. If the mean squared error is still used to construct the loss function, pollutant parameters with larger prediction errors tend to occupy a larger proportion of the loss function, causing the model to focus more on short-term, localized changes, thus weakening its ability to learn the overall evolution of atmospheric environmental quality. Ultimately, this manifests as decreased prediction stability or reduced overall prediction accuracy.
[0004] Therefore, how to adaptively construct a loss function based on the data variation characteristics of various pollutant parameters, and thus improve the accuracy of monitoring atmospheric environmental quality using LSTM models, has become an urgent problem to be solved. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a multi-parameter intelligent monitoring system for atmospheric environmental quality based on the Internet of Things, in order to solve the problem of how to adaptively construct a loss function based on the data change characteristics of each pollutant parameter, thereby improving the accuracy of monitoring atmospheric environmental quality using the LSTM model.
[0006] This invention provides a multi-parameter intelligent atmospheric environmental quality monitoring system based on the Internet of Things, including a memory, a processor, and a computer program stored in the memory and running on the processor. The system is characterized in that the processor executes the computer program to perform the following steps:
[0007] Within the target area, the concentration data of each pollutant parameter at each time point within a preset time period up to the current time is obtained. In the process of using the LSTM model to predict the concentration data of each pollutant parameter at future time points, the target time when the distribution of prediction errors among each pollutant parameter is uneven is obtained based on the degree of disorder in the distribution of prediction errors among each pollutant parameter at each time point within the preset time period.
[0008] For any target time, based on the difference in prediction error between each pollutant parameter and other pollutant parameters at that target time, and the degree of correlation between the concentration data of each pollutant parameter and other pollutant parameters within the local time range of that target time, the adaptive parameter weights of each pollutant parameter at that target time are obtained.
[0009] Based on the adaptive parameter weights of each pollutant parameter at any target time, an adaptive weighted mean square error loss function is constructed for that target time. Based on the adaptive weighted mean square error loss function at each target time and the mean square error loss function at each other time, the concentration prediction values of each pollutant parameter at future time are obtained in the fully connected layer of the LSTM model. Based on the concentration prediction values of each pollutant parameter at future time, the atmospheric environmental quality of the target area at future time is intelligently monitored.
[0010] Preferably, the step of obtaining the target time when the distribution of prediction errors among various pollutant parameters is uneven based on the degree of disorder in the distribution of prediction errors among various pollutant parameters at each moment within a preset time period includes:
[0011] For any moment within a preset time period, calculate the average and median of the prediction errors of all pollutant parameters at that moment. Use the absolute value of the difference between the average and the median as the independent variable of the hyperbolic tangent function to obtain the first distribution dispersion of the prediction errors among the various pollutant parameters at that moment.
[0012] Calculate the deviation from the mean of the prediction error of each pollutant parameter at any given time, and use the sum of all deviations from the mean as the independent variable of the hyperbolic tangent function to obtain the second distribution dispersion of the prediction error among each pollutant parameter at any given time.
[0013] Calculate the mean between the first distribution dispersion and the second distribution dispersion to obtain the distribution disorder of the prediction error between each pollutant parameter at any given time. If the distribution disorder is greater than a preset distribution disorder threshold, then the given time is recorded as the target time.
[0014] Preferably, the step of obtaining the adaptive parameter weights of each pollutant parameter at any target time based on the difference in prediction errors between each pollutant parameter and other pollutant parameters at any target time, and the degree of correlation between the concentration data of each pollutant parameter and other pollutant parameters within a local time range at any target time, includes:
[0015] For any pollutant parameter, based on the difference in prediction error between the pollutant parameter and other pollutant parameters at any target time, a first weighted feature value of the pollutant parameter at any target time is obtained.
[0016] Based on the degree of correlation between the concentration data of any pollutant parameter and other pollutant parameters within a local time range of any target time, a second weighted feature value of any pollutant parameter at any target time is obtained.
[0017] Calculate the sum between the first weight feature value and the second weight feature value to obtain the comprehensive weight of any pollutant parameter at any target time. Obtain the comprehensive weight of each pollutant parameter at any target time. Calculate the proportion of the comprehensive weight of any pollutant parameter at any target time in the comprehensive weight of all pollutant parameters to obtain the adaptive parameter weight of any pollutant parameter at any target time.
[0018] Preferably, obtaining the first weighted feature value of any pollutant parameter at any target time based on the difference in prediction error between any pollutant parameter and other pollutant parameters at any target time includes:
[0019] Calculate the mean of the prediction errors of all other pollutant parameters at any target time, calculate the absolute value of the difference between the prediction error of any pollutant parameter at any target time and the mean, obtain the deviation of the prediction error of any pollutant parameter from other pollutant parameters at any target time, and use the negative of the prediction error deviation as the independent variable of an exponential function with the natural constant as the base, to obtain the degree of consistency of the error level between any pollutant parameter and other pollutant parameters at any target time.
[0020] Based on the fluctuation level of the prediction error of any pollutant parameter within a local time range at any target time, the stability of the prediction error of any pollutant parameter within a local time range at any target time is obtained.
[0021] The sum of the consistency of the error level and the stability is calculated to obtain the first weighted characteristic value of any pollutant parameter at any target time.
[0022] Preferably, the step of obtaining the stability of the prediction error of any pollutant parameter within a local time range at any target time based on the fluctuation level of the prediction error of any pollutant parameter within a local time range at any target time includes:
[0023] The prediction error of any pollutant parameter at each moment within a first preset local time range before any target time is obtained. The prediction error of any pollutant parameter at each moment within the first preset local time range before any target time, and the prediction error at any target time are combined to form a prediction error sequence. The first-order difference sequence of the prediction error sequence is obtained. The product between any two adjacent data in the first-order difference sequence is calculated. If the product is less than 0, the sign XOR value between any two adjacent data is recorded as 1. If the product is greater than or equal to 0, the sign XOR value between any two adjacent data is recorded as 0.
[0024] Obtain the sign XOR value between every two adjacent data in the first-order difference sequence, calculate the sum of all sign XOR values, and obtain the fluctuation degree of the prediction error of any pollutant parameter within the local time range of any target time. Use the negative of the fluctuation degree as the independent variable of an exponential function with the natural constant as the base, and obtain the stability degree of the prediction error of any pollutant parameter within the local time range of any target time.
[0025] Preferably, obtaining the second weighted feature value of any pollutant parameter at any target time based on the correlation degree between the concentration data of any pollutant parameter and other pollutant parameters within a local time range of any target time includes:
[0026] For any other pollutant parameter, the concentration data of the pollutant parameter and the other pollutant parameter are obtained at each time point within a second preset local time range up to the target time point, respectively, and the concentration data sequences corresponding to the pollutant parameter and the other pollutant parameter are obtained. The Pearson correlation coefficient between the concentration data sequence corresponding to the pollutant parameter and the concentration data sequence corresponding to the other pollutant parameter is calculated, and the mean between the Pearson correlation coefficient and the constant 1 is recorded as the degree of correlation between the pollutant parameter and the other pollutant parameter.
[0027] Obtain the degree of correlation between any pollutant parameter and each other pollutant parameter, calculate the average of all correlation degrees, and obtain the overall degree of correlation between any pollutant parameter and other pollutant parameters within a local time range at any target time.
[0028] Calculate the range of all correlation degrees, subtract the range from the constant 1 to obtain the correlation stability between any pollutant parameter and other pollutant parameters within a local time range at any target time.
[0029] The sum of the overall correlation degree and the correlation stability degree is calculated to obtain the second weighted feature value of any pollutant parameter at any target time.
[0030] Preferably, the step of intelligently monitoring the atmospheric environmental quality of the target area at future times based on the predicted concentration values of various pollutant parameters includes:
[0031] Based on the predicted concentration values of various pollutant parameters at future times, the air quality index of each pollutant parameter at future times is obtained. Based on the air quality index, the air quality level of the target area at future times is obtained. Based on the air quality level, intelligent monitoring of the atmospheric environmental quality of the target area at future times is realized.
[0032] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows:
[0033] This invention analyzes the distribution structure of prediction errors among various pollutant parameters at each time point. It performs adaptive weighting operations only when the prediction error distribution among pollutant parameters is uneven at the target time point, suppressing non-representative errors introduced by sudden, localized abnormal fluctuations without disrupting the model's conventional learning mechanism. Based on the differences in prediction errors between each pollutant parameter and other pollutant parameters at each target time point, as well as the correlation between concentration data of each pollutant parameter and other pollutant parameters, adaptive parameter weights for each pollutant parameter at each target time point are comprehensively obtained. An adaptive weighted mean square error loss function is constructed based on these adaptive parameter weights. This function is used to perform backpropagation, adjusting the weights and biases within the LSTM model. This enables effective monitoring of atmospheric environmental quality based on multiple pollutant parameters, preventing the LSTM model from being dominated by non-representative errors, and better capturing the overall evolution of atmospheric environmental quality, thereby improving the stability and accuracy of atmospheric environmental quality monitoring using the LSTM model. Attached Figure Description
[0034] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0035] Figure 1 This is a flowchart of a multi-parameter intelligent monitoring method for atmospheric environmental quality based on the Internet of Things, provided in Embodiment 1 of the present invention. Detailed Implementation
[0036] Embodiments of this disclosure are described in detail below, with examples of these embodiments illustrated in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting it.
[0037] It should be noted that the terms "first," "second," etc., used in this disclosure and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure.
[0038] To illustrate the technical solution of the present invention, specific embodiments are described below.
[0039] This invention provides an IoT-based intelligent monitoring system for multi-parameter atmospheric environmental quality, including a processor and a memory. The processor executes a computer program stored in the memory to implement an IoT-based intelligent monitoring method for multi-parameter atmospheric environmental quality. Figure 1 As shown, this IoT-based multi-parameter intelligent monitoring method for atmospheric environmental quality includes the following steps:
[0040] Step S101: Obtain the concentration data of each pollutant parameter within the target area at each time point within the preset time period up to the current time. In the process of using the LSTM model to predict the concentration data of each pollutant parameter at future time points, obtain the target time when the prediction error distribution among each pollutant parameter is uneven based on the degree of disorder in the distribution of prediction errors among each pollutant parameter at each time point within the preset time period.
[0041] The target area is any region whose atmospheric environmental quality needs to be monitored. PM2.5 (fine particulate matter with a diameter of 2.5 micrometers or less) and PM2.5 (fine particulate matter with a diameter of 2.5 micrometers or less) are included. 10 (Particulate matter with a diameter less than or equal to 10 micrometers), NO2 (nitrogen dioxide), SO2 (sulfur dioxide), CO (nitric oxide), O3 (ozone) etc. are used as pollutant parameters to monitor the atmospheric environmental quality of the target area based on the monitoring data of each pollutant parameter. There are no restrictions here. The implementer can set the pollutant parameters according to the specific scenario, but the number of pollutant parameters cannot be less than 2. Using relevant sensors, the monitoring data of each pollutant parameter is collected once per minute. There are no restrictions here. The implementer can set the collection frequency according to the specific scenario. At the same time, the collected monitoring data is preprocessed to obtain the concentration data of each pollutant parameter, so as to map the monitoring data of each pollutant parameter to a unified dimension or range (such as 0-1) to avoid gradient update bias in model training due to differences in magnitude. Among them, data preprocessing includes but is not limited to: (1) removing extreme outliers by statistical methods (such as box plot method); (2) performing reasonable interpolation on missing data (such as interpolation of the mean of adjacent time points); (3) performing deviation standardization processing on the obtained monitoring data of each pollutant parameter to obtain the corresponding concentration data. Data preprocessing is an existing technology and will not be elaborated here. In this embodiment of the invention, a pre-trained LSTM model is obtained, and the concentration data at each time point within the 6 hours up to the current time is used as input data to predict the concentration data of various pollutant parameters at future time points. That is, the preset time period is set to 6 hours, which is not limited here. The implementer can set the length of the preset time period according to the specific scenario.
[0042] In traditional methods, when using pre-trained LSTM models to predict the concentration of various pollutant parameters at future times, the LSTM model typically uses the mean squared error (MSE) to construct the loss function. However, because atmospheric environmental monitoring points are often directly exposed to complex urban activity environments, their surrounding environmental conditions can change significantly in a short period. For example, in urban roadside monitoring scenarios, dense traffic and frequent starts and stops during morning and evening rush hours can cause a significant increase in exhaust emission intensity in a local area within a short time. Around residential or construction areas, temporary construction, material storage, and dust-generating operations can also affect local atmospheric composition within a certain time window. That is, different types of pollutants may respond significantly to environmental changes in their manner and intensity. Some pollutant parameters directly affected by local emissions (such as NO2 and PM2.5) may also be affected. 10 Pollutant parameters such as PM2.5, which are significantly influenced by photochemical reactions, regional transport, or meteorological conditions (e.g., O3, SO2), tend to show smaller fluctuations and relatively stable trends in concentration. In LSTM models, the prediction errors of pollutant parameters with abrupt changes or drastic fluctuations are significantly larger than those of other pollutant parameters. During backpropagation training, the differences in prediction errors among different pollutant parameters lead to inconsistent gradient effects on model parameter updates. Consequently, pollutant parameters with larger prediction errors have a greater impact on model weight and bias updates. If the mean squared error is still used to construct the loss function, pollutant parameters with larger prediction errors tend to occupy a larger proportion of the loss function, causing the model to focus more on short-term, localized changes. This weakens the model's ability to learn the overall evolution of atmospheric environmental quality, ultimately resulting in decreased prediction stability or overall prediction accuracy. Therefore, this invention proposes an idea that adaptively adjusts the weights of each pollutant parameter in the loss function construction based on the data change characteristics of each pollutant parameter, so as to prevent the LSTM model from being dominated by non-representative errors, so as to better capture the overall evolution law of atmospheric environmental quality and thus improve the accuracy of atmospheric environmental quality prediction.
[0043] Considering that under normal conditions, the variation amplitude and prediction error of various pollutant parameters are usually of similar magnitude, and their prediction errors have strong continuity and consistency over time, constructing the loss function using an equal-weighting approach (i.e., mean squared error, MSE) helps the LSTM model learn the long-term correlation between different pollutant parameters in a balanced manner during backpropagation training, thereby forming a stable characterization of the overall evolution of atmospheric environmental quality. Based on this, this scheme does not treat the custom weighting of each pollutant parameter as a routine operation, but only activates this mechanism when the prediction errors of each pollutant parameter exhibit significantly inconsistent variation characteristics. That is, when some pollutant parameters experience abnormal fluctuations due to sudden, localized emissions or short-term environmental disturbances, and their prediction errors are significantly amplified numerically and become unbalanced with other pollutant parameters, by applying different weights to the prediction errors of different pollutant parameters in the loss function, the model is guided to reasonably allocate the impact of each parameter error on model updates during backpropagation. This suppresses the non-representative errors introduced by sudden, localized abnormal fluctuations without disrupting the model's normal learning mechanism.
[0044] Therefore, the first step is to determine the target time when the prediction error distribution among the various pollutant parameters is uneven, based on the degree of disorder in the distribution of prediction errors at each time point. Specifically:
[0045] Taking the s-th time step as an example, the average and median of the prediction errors for all pollutant parameters at the s-th time step are calculated. The prediction errors originate from the hidden states of the corresponding time steps in the LSTM model; this is existing technology and will not be elaborated further here. The absolute value of the difference between the average and the median is used as the independent variable of the hyperbolic tangent function to obtain the first distributional dispersion of the prediction errors among the pollutant parameters at the s-th time step. The deviations from the mean of the prediction errors for each pollutant parameter at the s-th time step are calculated. The sum of all deviations from the mean is used as the independent variable of the hyperbolic tangent function to obtain the second distributional dispersion of the prediction errors among the pollutant parameters at the s-th time step. The mean of the first and second distributional dispersions is calculated to obtain the degree of disorder in the distribution of the prediction errors among the pollutant parameters at the s-th time step.
[0046] In one embodiment, the formula for calculating the degree of disorder in the distribution of prediction errors among various pollutant parameters at time s is as follows:
[0047]
[0048] in, This represents the degree of disorder in the distribution of prediction errors among various pollutant parameters at time s, where m represents the number of all pollutant parameters. This represents the prediction error of the i-th pollutant parameter at time s. ,in, This represents the concentration data of the i-th pollutant parameter at time s. This represents the predicted value of the concentration data of the i-th pollutant parameter at time s. This represents the median of the prediction errors for each pollutant parameter at time s. This represents the hyperbolic tangent function, used to restrict the output to [0, 1]. Represents the absolute value symbol.
[0049] It should be noted that, The larger the value, the more skewed the distribution of prediction errors for each pollutant parameter at time s, and thus... The larger the value, the stronger the influence of local or sudden factors on individual pollutant parameters at time s, resulting in a significant skewness in the prediction error. In this case, when constructing the loss function, different weights should be applied to the prediction errors of different pollutant parameters. The larger the value, the more the prediction error of individual pollutant parameters deviates from the overall level at time s; that is, the more discrete the distribution of prediction errors for each pollutant parameter at time s. The larger the value, the stronger the influence of local or sudden factors on individual pollutant parameters at time s, resulting in a significant skewness in the prediction error. In this case, when constructing the loss function, different weights should be applied to the prediction errors of different pollutant parameters.
[0050] because The value range is [0, 1]. Therefore, this scheme compromises by using the center of the value range, 0.5, as a reference threshold. That is, the preset distribution disorder threshold is set to 0.5. No restrictions are imposed here; implementers can set it according to specific scenarios. Then the s-th moment is recorded as the target moment.
[0051] Similarly, when acquiring all target times, some pollutant parameters may exhibit abnormal fluctuations due to localized, short-term environmental disturbances or sudden emissions. These abnormal fluctuations have a strong potential impact on the backpropagation training and prediction of the LSTM model. Therefore, when constructing the loss function, different weights should be applied to the prediction errors of different pollutant parameters to suppress the non-representative errors introduced by sudden, localized abnormal fluctuations. For times other than the target times, these are referred to as other times. Since the distribution of prediction errors among various pollutant parameters is relatively consistent at other times, in order not to disrupt the model's normal learning mechanism, the weights of each pollutant parameter in the loss function at other times are not adjusted. That is, the mean squared error (MSE) is used to construct the loss function for other times.
[0052] Step S102: For any target time, based on the difference in prediction error between each pollutant parameter and other pollutant parameters at the target time, and the degree of correlation between the concentration data of each pollutant parameter and other pollutant parameters within the local time range of the target time, obtain the adaptive parameter weights of each pollutant parameter at the target time.
[0053] The purpose of assigning different weights to the prediction errors of different pollutant parameters is to suppress prediction errors that lack overall representativeness introduced by sudden and localized abnormal fluctuations during the backpropagation training of the LSTM model, preventing them from dominating model parameter updates. Pollutant parameters often experience sudden and localized abnormal fluctuations due to factors such as traffic peaks, construction dust, and local emissions during specific periods. These fluctuations often only affect a few pollutant parameters and are short-lived. The corresponding prediction errors are numerically significantly larger than those of other parameters, but they do not represent the overall evolution trend of atmospheric environmental quality. Based on this, this scheme first obtains the first weighted feature value of each pollutant parameter at the target time by measuring the deviation of the prediction error of a single pollutant parameter from the prediction errors of other pollutant parameters. This allows for the quantitative identification of pollutant parameters affected by localized anomalies.
[0054] Taking the target time t and the i-th pollutant parameter as an example, the specific method for obtaining the first weighted feature value of the i-th pollutant parameter at the target time t is as follows:
[0055] Calculate the mean of the prediction errors of all other pollutant parameters (except for the i-th pollutant parameter) at the target time t. Calculate the absolute value of the difference between the prediction error of the i-th pollutant parameter at the target time t and the mean. Obtain the deviation of the prediction error of the i-th pollutant parameter from other pollutant parameters at the target time t. Use the negative of the deviation as the independent variable of an exponential function with the natural constant as the base to obtain the degree of consistency of the error level between the i-th pollutant parameter and other pollutant parameters at the target time t.
[0056] To avoid being misled by instantaneous fluctuations or occasional noise in weight allocation, it is necessary to further combine the fluctuation characteristics of the prediction error of the i-th pollutant parameter within the recent historical time window. This is to maintain the model's ability to learn the overall trend of atmospheric environmental quality changes while suppressing non-representative abnormal errors. Specifically, this involves obtaining the prediction error of the i-th pollutant parameter at each moment within a first preset local time range before the target time t, and combining the prediction error of the i-th pollutant parameter at each moment within the first preset local time range before the target time t with the prediction error at the target time t to form a prediction error sequence. The first-order difference sequence of the prediction error sequence is then obtained, and the product between any two adjacent data in the first-order difference sequence is calculated. If the product is less than 0, the sign XOR value between any two adjacent data is recorded as 1; if the product is greater than or equal to 0, the sign XOR value between any two adjacent data is recorded as 0. In other words, an XOR operation is performed on the sign bit between any two adjacent data.
[0057] Obtain the sign XOR value between every two adjacent data in the first-order difference sequence, calculate the sum of all sign XOR values, and obtain the fluctuation degree of the prediction error of the i-th pollutant parameter within the local time range of the target time t. Use the negative of the fluctuation degree as the independent variable of the exponential function with the natural constant as the base, and obtain the stability degree of the prediction error of the i-th pollutant parameter within the local time range of the target time t.
[0058] The sum of the consistency of the error level and the stability is calculated to obtain the first weighted feature value of the i-th pollutant parameter at the target time t.
[0059] In one embodiment, the formula for calculating the first weighted eigenvalue of the i-th pollutant parameter at target time t is as follows:
[0060]
[0061]
[0062] in, This represents the first weighted eigenvalue of the i-th pollutant parameter at target time t. Let represent the prediction error of the i-th pollutant parameter at target time t, and m represent the number of all pollutant parameters. This indicates the first preset local time range. Let represent the prediction error of the i-th pollutant parameter at time r-1. Let represent the prediction error of the i-th pollutant parameter at time r. Let represent the prediction error of the i-th pollutant parameter at time r+1. and That is, two adjacent data points in a first-order difference sequence. This represents the signed XOR value between two adjacent data points in a first-order difference sequence. This represents an exponential function with the natural constant as its base.
[0063] It should be noted that, The larger the value, the more the prediction error of the i-th pollutant parameter deviates from the overall prediction error level of the other pollutant parameters, and thus... The smaller the value, the more likely the i-th pollutant parameter at the target time t is to be strongly affected by local or short-term factors. The prediction error of the i-th pollutant parameter at the target time t lacks overall representativeness. In this case, the weight of the i-th pollutant parameter in the construction of the loss function should be appropriately reduced. The larger the value, the more frequent the fluctuations in the prediction error of the i-th pollutant parameter within the local time range of the target time t; that is, the less linearly stable the change in the prediction error of the i-th pollutant parameter. The smaller the value, the more likely the i-th pollutant parameter at the target time t is to be subject to short-term disturbances. In this case, the weight of the i-th pollutant parameter in the construction of the loss function should be appropriately reduced.
[0064] Among them, for the first preset local time range The settings, Setting the value too high can cause short-term anomalies to be "averaged out" by long-term stable periods, significantly diluting the volatility index; setting it too low may amplify single-point measurement noise, and equipment jitter and instantaneous sampling errors may also be treated as "abnormal fluctuations." Considering that the duration of sudden, localized abnormal fluctuations often ranges from several minutes to tens of minutes, while the data acquisition frequency in this solution is once per minute, the setting should be... That is, the first preset local time range is set to 15 times before the target time t. There is no restriction here, and the implementer can set it according to the actual environmental conditions of the target area.
[0065] Thus, by analyzing the deviation of the measurement error of the i-th pollutant parameter at the target time t from the prediction error of other pollutant parameters, the first weighted characteristic value of the i-th pollutant parameter at the target time t is obtained.
[0066] Furthermore, considering that in real-world scenarios, different pollutant parameters are often not independent of each other, but rather influenced by the same emission source, meteorological conditions, or regional transport processes, exhibiting strong interconnected changes within a certain time window. For example, when traffic emissions increase, NO2, PM2.5, and PM2.5... 10Pollutant parameters may rise synchronously; under changes in light conditions or regional transport, O3 and other gaseous pollutants may also exhibit phased correlations. Therefore, it is necessary to analyze the correlation characteristics among various pollutant parameters to identify which pollutant parameter changes are more consistent with the common evolution trend under the current environment from the perspective of multi-parameter overall linkage. When a pollutant parameter maintains a high correlation with other pollutant parameters, it indicates that the change in the concentration data of that pollutant parameter is more likely to reflect regional or overall environmental changes, and the corresponding prediction error of that pollutant parameter is highly representative. In this case, the weight of that pollutant parameter in the construction of the loss function should be appropriately increased. Conversely, when the correlation between a pollutant parameter and other pollutant parameters is low or even shows a significant divergence, the deviation in the prediction error of that pollutant parameter is more likely to originate from local or independent disturbances. The prediction error of that pollutant parameter has limited ability to characterize the overall evolution of atmospheric environmental quality, and the weight of that pollutant parameter in the construction of the loss function should be appropriately reduced.
[0067] Based on the above analysis, in this embodiment of the invention, the second weighted feature value of the i-th pollutant parameter at target time t is obtained according to the degree of correlation between the concentration data of the i-th pollutant parameter and other pollutant parameters within a local time range of the target time t. Specifically:
[0068] For any other pollutant parameter, the concentration data of the i-th pollutant parameter and the other pollutant parameter at each moment within a second preset local time range up to the target time t are obtained respectively, resulting in the concentration data sequences corresponding to the i-th pollutant parameter and the other pollutant parameter. The second preset local time range is set to 15 minutes, which is not limited here and can be set by the implementer according to the specific scenario. The Pearson correlation coefficient between the concentration data sequence corresponding to the i-th pollutant parameter and the concentration data sequence corresponding to the other pollutant parameter is calculated. Since the Pearson correlation coefficient has a range of [-1, 1], for ease of analysis, its range needs to be controlled within [0, 1]. This is achieved by taking the average between the Pearson correlation coefficient and the constant 1 as the degree of correlation between the i-th pollutant parameter and the other pollutant parameter. The Pearson correlation coefficient is existing technology and will not be elaborated here.
[0069] Obtain the correlation degree between the i-th pollutant parameter and each other pollutant parameter, calculate the mean of all correlation degrees, and obtain the overall correlation degree between the i-th pollutant parameter and other pollutant parameters within the local time range of the target time t;
[0070] Calculate the range of all correlation degrees, subtract the range from the constant 1 to obtain the correlation stability between the i-th pollutant parameter and other pollutant parameters within the local time range of the target time t;
[0071] The sum of the overall correlation degree and the correlation stability degree is calculated to obtain the second weighted feature value of the i-th pollutant parameter at the target time t.
[0072] In one embodiment, the formula for calculating the second weighted eigenvalue of the i-th pollutant parameter at target time t is:
[0073]
[0074] in, This represents the second weighted eigenvalue of the i-th pollutant parameter at target time t. This represents the Pearson correlation coefficient between the i-th pollutant parameter and the j-th other pollutant parameters. This refers to the degree of correlation between the i-th pollutant parameter and other pollutant parameters, where m represents the total number of pollutant parameters. This represents the maximum value of the Pearson correlation coefficient between the i-th pollutant parameter and every other pollutant parameter. That is, the maximum value among all degrees of association. This represents the minimum value of the Pearson correlation coefficients between the i-th pollutant parameter and every other pollutant parameter. That is, the minimum value among all degrees of association.
[0075] It should be noted that, The larger the value, the more consistent the changing trend of the i-th pollutant parameter with other pollutant parameters, and the better the changing trend of the concentration data of the i-th pollutant parameter reflects the overall evolution law of atmospheric environmental quality. The larger the value, the greater the weight of the i-th pollutant parameter in the construction of the loss function should be. The smaller the value, the smaller the difference in the correlation between the i-th pollutant parameter and other different pollutant parameters. This indicates that the correlation between the i-th pollutant parameter and most other pollutant parameters is relatively stable and consistent, with fewer abnormal fluctuations. Furthermore, the trend of the concentration data of the i-th pollutant parameter better reflects the overall evolution of atmospheric environmental quality. The larger the value, the greater the weight of the i-th pollutant parameter in the loss function construction should be.
[0076] Thus, by leveraging the correlation characteristics between the i-th pollutant parameter and other pollutant parameters, the second weighted feature value of the i-th pollutant parameter at target time t is obtained. Furthermore, by combining the first and second weighted feature values of the i-th pollutant parameter at target time t, the adaptive parameter weights of the i-th pollutant parameter at target time t are obtained and used to construct the loss function. Specifically:
[0077] Calculate the sum between the first weight feature value and the second weight feature value to obtain the comprehensive weight of the i-th pollutant parameter at the target time t. Obtain the comprehensive weight of each pollutant parameter at the target time t. Calculate the proportion of the comprehensive weight of the i-th pollutant parameter at the target time t in the comprehensive weight of all pollutant parameters to obtain the adaptive parameter weight of the i-th pollutant parameter at the target time t.
[0078] In one embodiment, the formula for calculating the adaptive parameter weight of the i-th pollutant parameter at the target time t is:
[0079]
[0080] in, This represents the adaptive parameter weight of the i-th pollutant parameter at target time t. This represents the first weighted eigenvalue of the i-th pollutant parameter at target time t. represents the second weighted characteristic value of the i-th pollutant parameter at the target time t, and m represents the number of all pollutant parameters.
[0081] It should be noted that, The smaller the value, the more the prediction error of the i-th pollutant parameter deviates from the overall prediction error level of the other pollutant parameters, and the more significant and drastic the fluctuations are within the local time range of the target time t. This indicates that the i-th pollutant parameter at target time t is more likely to be strongly affected by local or short-term factors, and the prediction error of the i-th pollutant parameter at target time t lacks overall representativeness. In this case, the weight of the i-th pollutant parameter in the construction of the loss function should be appropriately reduced. The smaller; The smaller the value, the more inconsistent the changing trends of the i-th pollutant parameter with other pollutant parameters are within the local time range of the target time t. The less the changing trend of the concentration data of the i-th pollutant parameter reflects the overall evolution of atmospheric environmental quality, the less the weight of the i-th pollutant parameter should be in the construction of the loss function. The smaller.
[0082] Thus, the adaptive parameter weights of the i-th pollutant parameter at the target time t are obtained.
[0083] Step S103: Based on the adaptive parameter weights of each pollutant parameter at any target time, construct the adaptive weighted mean square error loss function at any target time. Based on the adaptive weighted mean square error loss function at each target time and the mean square error loss function at each other time, obtain the concentration prediction values of each pollutant parameter at future time in the fully connected layer of the LSTM model. Based on the concentration prediction values of each pollutant parameter at future time, intelligently monitor the atmospheric environmental quality of the target area at future time.
[0084] Following the method for obtaining the adaptive parameter weights of the i-th pollutant parameter at target time t in step S102, the adaptive parameter weights of each pollutant parameter at target time t are obtained, and then the adaptive weighted mean square error loss function at target time t is constructed. Its function expression is as follows:
[0085]
[0086] in, This represents the adaptive weighted mean square error loss function at the target time t. This represents the adaptive parameter weight of the i-th pollutant parameter at target time t. denoted by , where represents the prediction error of the i-th pollutant parameter at the target time t, and m represents the number of all pollutant parameters.
[0087] Similarly, an adaptive weighted mean squared error loss function is obtained for each target time step. This function is then used as the optimization objective for backpropagation training of the model, guiding the adjustment of weights and biases within the LSTM model. Since the loss function already considers the weights of various pollutant parameters during calculation, the LSTM model automatically amplifies the error contribution of high-weight parameters while weakening the influence of low-weight parameters when calculating gradients. Subsequently, the LSTM model updates the weights and biases in its network based on this gradient information: errors in high-weight parameters drive the network to more fully adjust the corresponding connection strengths and gating mechanisms to more accurately fit the overall trend of atmospheric environmental quality changes; while prediction errors of low-weight pollutant parameters do not significantly change the network structure, thus preventing local anomalies from dominating the backpropagation training of the LSTM model.
[0088] For the loss function at times other than the target time, the weights of each pollutant parameter in the loss function are not adjusted; that is, the loss function is still constructed using an equal-weight method, specifically using the mean squared error (MSE). This is denoted as the mean squared error loss function. Taking the d-th other time as an example, the expression for the mean squared error loss function at the d-th other time is: Based on the adaptive weighted mean square error loss function at each target time and the mean square error loss function at each other time in the LSTM model, the concentration data of each pollutant parameter at future time are predicted, and the predicted concentration values of each pollutant parameter at future time are obtained. Using the LSTM model for prediction is an existing technology, which will not be elaborated here.
[0089] Furthermore, based on the predicted concentrations of various pollutant parameters at future times, the Air Quality Index (AQI) for each pollutant parameter at those future times is obtained. Then, based on the AQI, the air quality level of the target area at those future times is obtained, achieving intelligent monitoring of the atmospheric environmental quality of the target area at those future times. The intelligent monitoring of atmospheric environmental quality based on air quality levels is an existing technology and will not be elaborated upon here.
[0090] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A multi-parameter intelligent atmospheric environmental quality monitoring system based on the Internet of Things, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it performs the following steps: Within the target area, the concentration data of each pollutant parameter at each time point within a preset time period up to the current time is obtained. In the process of using the LSTM model to predict the concentration data of each pollutant parameter at future time points, the target time when the distribution of prediction errors among each pollutant parameter is uneven is obtained based on the degree of disorder in the distribution of prediction errors among each pollutant parameter at each time point within the preset time period. For any target time, based on the difference in prediction error between each pollutant parameter and other pollutant parameters at that target time, and the degree of correlation between the concentration data of each pollutant parameter and other pollutant parameters within the local time range of that target time, the adaptive parameter weights of each pollutant parameter at that target time are obtained. Based on the adaptive parameter weights of each pollutant parameter at any target time, an adaptive weighted mean square error loss function is constructed for that target time. Based on the adaptive weighted mean square error loss function at each target time and the mean square error loss function at each other time, the concentration prediction values of each pollutant parameter at future time are obtained in the fully connected layer of the LSTM model. Based on the concentration prediction values of each pollutant parameter at future time, the atmospheric environmental quality of the target area at future time is intelligently monitored.
2. The IoT-based multi-parameter intelligent atmospheric environmental quality monitoring system according to claim 1, characterized in that, The step of obtaining the target time when the distribution of prediction errors among various pollutant parameters is uneven, based on the degree of disorder in the distribution of prediction errors among various pollutant parameters at each moment within a preset time period, includes: For any moment within a preset time period, calculate the average and median of the prediction errors of all pollutant parameters at that moment. Use the absolute value of the difference between the average and the median as the independent variable of the hyperbolic tangent function to obtain the first distribution dispersion of the prediction errors among the various pollutant parameters at that moment. Calculate the deviation from the mean of the prediction error of each pollutant parameter at any given time, and use the sum of all deviations from the mean as the independent variable of the hyperbolic tangent function to obtain the second distribution dispersion of the prediction error among each pollutant parameter at any given time. Calculate the mean between the first distribution dispersion and the second distribution dispersion to obtain the distribution disorder of the prediction error between each pollutant parameter at any given time. If the distribution disorder is greater than a preset distribution disorder threshold, then the given time is recorded as the target time.
3. The IoT-based multi-parameter intelligent atmospheric environmental quality monitoring system according to claim 1, characterized in that, The step of obtaining the adaptive parameter weights of each pollutant parameter at any target time based on the difference in prediction errors between each pollutant parameter and other pollutant parameters at any target time, and the degree of correlation between the concentration data of each pollutant parameter and other pollutant parameters within a local time range at any target time, includes: For any pollutant parameter, based on the difference in prediction error between the pollutant parameter and other pollutant parameters at any target time, a first weighted feature value of the pollutant parameter at any target time is obtained. Based on the degree of correlation between the concentration data of any pollutant parameter and other pollutant parameters within a local time range of any target time, a second weighted feature value of any pollutant parameter at any target time is obtained. Calculate the sum between the first weight feature value and the second weight feature value to obtain the comprehensive weight of any pollutant parameter at any target time. Obtain the comprehensive weight of each pollutant parameter at any target time. Calculate the proportion of the comprehensive weight of any pollutant parameter at any target time in the comprehensive weight of all pollutant parameters to obtain the adaptive parameter weight of any pollutant parameter at any target time.
4. The IoT-based multi-parameter intelligent atmospheric environmental quality monitoring system according to claim 3, characterized in that, The step of obtaining the first weighted feature value of any pollutant parameter at any target time based on the difference in prediction error between any pollutant parameter and other pollutant parameters at any target time includes: Calculate the mean of the prediction errors of all other pollutant parameters at any target time, calculate the absolute value of the difference between the prediction error of any pollutant parameter at any target time and the mean, obtain the deviation of the prediction error of any pollutant parameter from other pollutant parameters at any target time, and use the negative of the prediction error deviation as the independent variable of an exponential function with the natural constant as the base, to obtain the degree of consistency of the error level between any pollutant parameter and other pollutant parameters at any target time. Based on the fluctuation level of the prediction error of any pollutant parameter within a local time range at any target time, the stability of the prediction error of any pollutant parameter within a local time range at any target time is obtained. The sum of the consistency of the error level and the stability is calculated to obtain the first weighted characteristic value of any pollutant parameter at any target time.
5. The IoT-based multi-parameter intelligent atmospheric environmental quality monitoring system according to claim 4, characterized in that, The step of obtaining the stability of the prediction error of any pollutant parameter within a local time range at any target time, based on the fluctuation level of the prediction error of any pollutant parameter within a local time range at any target time, includes: The prediction error of any pollutant parameter at each moment within a first preset local time range before any target time is obtained. The prediction error of any pollutant parameter at each moment within the first preset local time range before any target time, and the prediction error at any target time are combined to form a prediction error sequence. The first-order difference sequence of the prediction error sequence is obtained. The product between any two adjacent data in the first-order difference sequence is calculated. If the product is less than 0, the sign XOR value between any two adjacent data is recorded as 1. If the product is greater than or equal to 0, the sign XOR value between any two adjacent data is recorded as 0. Obtain the sign XOR value between every two adjacent data in the first-order difference sequence, calculate the sum of all sign XOR values, and obtain the fluctuation degree of the prediction error of any pollutant parameter within the local time range of any target time. Use the negative of the fluctuation degree as the independent variable of an exponential function with the natural constant as the base, and obtain the stability degree of the prediction error of any pollutant parameter within the local time range of any target time.
6. The IoT-based multi-parameter intelligent atmospheric environmental quality monitoring system according to claim 3, characterized in that, The step of obtaining a second weighted feature value for any pollutant parameter at any target time based on the correlation between the concentration data of any pollutant parameter and other pollutant parameters within a local time range at any target time includes: For any other pollutant parameter, the concentration data of the pollutant parameter and the other pollutant parameter are obtained at each time point within a second preset local time range up to the target time point, respectively, and the concentration data sequences corresponding to the pollutant parameter and the other pollutant parameter are obtained. The Pearson correlation coefficient between the concentration data sequence corresponding to the pollutant parameter and the concentration data sequence corresponding to the other pollutant parameter is calculated, and the mean between the Pearson correlation coefficient and the constant 1 is recorded as the degree of correlation between the pollutant parameter and the other pollutant parameter. Obtain the degree of correlation between any pollutant parameter and each other pollutant parameter, calculate the average of all correlation degrees, and obtain the overall degree of correlation between any pollutant parameter and other pollutant parameters within a local time range at any target time. Calculate the range of all correlation degrees, subtract the range from the constant 1 to obtain the correlation stability between any pollutant parameter and other pollutant parameters within a local time range at any target time. The sum of the overall correlation degree and the correlation stability degree is calculated to obtain the second weighted feature value of any pollutant parameter at any target time.
7. The intelligent monitoring system for multi-parameter atmospheric environmental quality based on the Internet of Things according to claim 1, characterized in that, The method of intelligently monitoring the air quality of the target area in the future based on the predicted concentration values of various pollutant parameters includes: Based on the predicted concentration values of various pollutant parameters at future times, the air quality index of each pollutant parameter at future times is obtained. Based on the air quality index, the air quality level of the target area at future times is obtained. Based on the air quality level, intelligent monitoring of the atmospheric environmental quality of the target area at future times is realized.