A Multi-Parameter Monitoring Data Correction Method Based on a Teacher-Student Model
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HENAN SNOW CITY SOFT CO LTD
- Filing Date
- 2026-02-10
- Publication Date
- 2026-05-26
Smart Images

Figure CN122087265A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of data calibration for air quality monitoring equipment, and more particularly to a method for correcting multi-parameter monitoring data. Background Technology
[0002] With increasing public awareness of environmental protection, low-cost and easy-to-deploy air quality monitoring equipment has become an important data support for air pollution prevention and control. Compared with traditional high-cost monitoring stations, it is cheaper, easier to install and maintain, and can cover a wider range of areas. However, it has two major pain points: First, electrochemical sensors are easily affected by environmental factors, resulting in large deviations and low reliability of monitoring data; second, the traditional manual calibration mode is inefficient and difficult to adapt to the needs of large-scale deployment.
[0003] Air quality monitoring equipment, combined with IoT technology, enables refined, grid-based monitoring of air pollution, representing a new approach to environmental monitoring. While air quality monitoring equipment can achieve more precise grid-based monitoring, its limitations stem from hardware costs. Core sensing components, such as electrochemical and laser scattering sensors, are susceptible to interference from environmental factors like temperature, humidity, and air pressure. Furthermore, with prolonged use, component aging leads to sensitivity degradation and slower response times, severely impacting the accuracy and reliability of monitoring data and limiting the practical value of grid-based monitoring networks. Due to environmental and equipment factors, calibration is necessary to improve the accuracy of air quality monitoring data. Therefore, the calibration of air quality monitoring equipment data is of paramount importance.
[0004] Air quality monitoring equipment data calibration algorithms are mainly divided into three categories: 1. Machine learning calibration method, which establishes a mapping relationship between sensor output and measured values, and optimizes calibration coefficients to improve measurement accuracy; 2. Statistical calibration method, which constructs statistical models and corrects parameters, adjusting calibration coefficients to ensure data measurement accuracy; 3. Historical data analysis calibration method, which mines the changing patterns of historical sensor data, adjusts calibration coefficients accordingly, and enhances the accuracy and reliability of long-term operation. While each of these three calibration algorithms has its advantages, they all share a common core weakness—they generally rely on real reference data. Acquiring such data faces two major bottlenecks: First, the density of national / provincial monitoring stations is limited, and their coverage is mostly concentrated in urban areas, making it difficult to obtain effective reference data in suburban areas, industrial parks, and other monitoring blind spots; second, data from national / provincial monitoring stations is usually released hourly or daily, resulting in a time mismatch with the minute-level sampling frequency of sensors; and the accumulation of sufficient training data through long-term observation takes too long, making it difficult to quickly address data drift caused by sensor component aging and sudden environmental changes.
[0005] Current research in this field has limitations. For example, invention patent CN120181833 A discloses a method and system for the operation and maintenance management of air quality monitoring equipment based on the Internet of Things (IoT), relating to the field of air quality monitoring equipment management technology. It improves monitoring accuracy by real-time correction of data drift through environmental parameter compensation algorithms; optimizes air quality prediction performance by using a carp population optimization algorithm to obtain an improved air quality prediction network; constructs a hybrid network of LoRaWAN and NB-IoT, dynamically adjusting the acquisition frequency according to risk level to reduce communication load; combines IoT health sub-models and Cox proportional hazards models to predict equipment failures, and plans the optimal maintenance path through the TSP algorithm to improve operation and maintenance efficiency; and dynamically optimizes equipment deployment based on Gaussian process regression algorithms. These inventions achieve a closed-loop management chain of "sensing-prediction-transmission-maintenance-optimization," significantly improving data accuracy, communication efficiency, and equipment reliability, providing a low-cost, adaptive solution for air quality monitoring equipment. However, in terms of data calibration, only simple temperature compensation calibration is considered, which cannot fit the nonlinear relationship caused by complex environmental factors and fails to fully address the interference of complex environmental factors on monitoring accuracy. This limitation may lead to a decrease in data reliability under varying meteorological conditions.
[0006] The invention patent with publication number CN119643787A discloses a method for calibrating atmospheric pollutant sensor data suitable for deployment on embedded devices. This method includes acquiring raw response data from different sensors at different concentrations under different atmospheric environments after temperature compensation, along with corresponding temperature, humidity, air pressure data, and sampling time; simultaneously collecting the actual concentration values of the corresponding detected objects from national or provincial monitoring stations at the corresponding time points; preprocessing the obtained data to obtain the final dataset; using a random forest algorithm as the teacher model and a gradient boosting machine algorithm as the student model, and optimizing the hyperparameters of the gradient boosting machine and random forest algorithms using the Ivy League algorithm; substituting the optimal hyperparameter solutions found into the corresponding algorithms, and retraining the teacher and student models using these hyperparameter combinations; deploying and updating the model on an embedded device, reducing the model size to achieve embedded deployment while ensuring accuracy. However, this method heavily relies on data from national monitoring stations, is only for single-device calibration, and does not consider collaborative calibration of multiple devices, resulting in insufficient adaptability.
[0007] Patent CN118095080A discloses an environmental air quality monitoring micro-station data correction system and method, belonging to the field of environmental monitoring technology. It utilizes a cloud server to calibrate environmental air quality monitoring micro-station data, saving manpower and resources and improving the timeliness and relevance of calibration. By using AOD data, national, provincial, municipal, and township station data, geographic data, and meteorological data, it constructs high-quality air quality monitoring data with high spatiotemporal resolution, enhancing the scientific rigor of analysis and model construction. The high spatiotemporal resolution geographic and meteorological data are incorporated into the calibration model calculation, fully considering the impact of geographic and meteorological conditions on the monitoring results of the environmental air quality monitoring micro-stations. Furthermore, the high spatiotemporal resolution geographic and meteorological data are both raster data, possessing geographic and temporal continuity, and can better reflect the spatial heterogeneity of geographic and meteorological conditions. This method considers the differences in particulate matter types caused by regional differences and relies on high spatiotemporal resolution geographic data. However, it is clear that high spatiotemporal resolution geographic data is not easy to obtain and still relies on data from national control stations, failing to overcome the bottleneck of reference data dependence. Summary of the Invention
[0008] To address the technical problem that existing data calibration methods generally rely on real reference data, this invention proposes a multi-parameter monitoring data calibration method based on a teacher-student model. This method utilizes a fusion of dual-attention LSTM-MLP and Extra Trees (Extreme Random Trees) for pollutant concentration data calibration, achieving high-precision local calibration of pollutant concentrations and automated calibration of air quality monitoring equipment data, effectively improving data accuracy and management efficiency. This invention is adaptable to the computational constraints of embedded air quality monitoring devices and meets the large-scale deployment requirements of grid-based monitoring.
[0009] To achieve the above objectives, the technical solution of the present invention is as follows:
[0010] To address the issues of long-term key information forgetting, lack of differentiation among multi-parameter weights, hyperparameter susceptibility to local optima, and poor noise resistance in deep learning models, this invention constructs a cloud-based high-precision model with dual attention-LSTM-MLP+AFSA (Artificial Fish Swarm Algorithm) hyperparameter optimization. By focusing on long-term key time steps through temporal attention and dynamically allocating multi-feature weights through parameter attention, combined with the global optimization capability of AFSA, the calibration accuracy and robustness of six types of pollutants are improved.
[0011] To address the problems of remote air quality monitoring equipment lacking national control station references, the tendency to misjudge local pollution during stable periods of single pollutant assessments, and unreliable training data due to a lack of consensus in single-station validation, this invention proposes a background period selection scheme combining multi-pollutant joint CUSUM (Cumulative Sum Control Chart) and multi-site consensus validation. This scheme uses weighted joint bias to avoid misjudgments of single pollutants and relies on a consensus mechanism based on overlapping change points at multiple stations to accurately select background periods free from local interference when no reference data is available, providing high-confidence training data for the student model. A multi-parameter monitoring data correction method based on a teacher-student model is also presented, with the following steps:
[0012] Step 1: Obtain the time series of multivariate air pollutants related to multiple air quality monitoring devices and preprocess them to obtain multivariate time series. The multivariate time series and the normalized real concentrations of the corresponding national control stations constitute the air quality monitoring device dataset.
[0013] Step 2: Construct a cloud-based teacher model. Use the dataset from the reference air quality monitoring equipment closest to the national control station to construct a supervised dataset to train the cloud-based teacher model, and use the AFSA algorithm to optimize the model parameters.
[0014] Step 3: Select multivariate time series from relatively stable periods in the air quality monitoring equipment dataset as local training samples. Input the local training samples into the predicted concentration obtained by the pre-trained cloud teacher model as the corresponding label to train the Extra Trees student model. Optimize the model parameters using the AFSA algorithm. Process the real-time time series collected by the air quality monitoring equipment using the pre-trained Extra Trees student model to obtain the prediction results.
[0015] Preferably, obtaining different atmospheric environments The monitoring data from the air quality monitoring equipment includes K-type pollutants and Q-type meteorological parameters. The collection period for the true concentration values of K-type pollutants at the national control station is D days.
[0016] The monitoring data is minute-level concentration data, including the raw concentration data of pollutant type k at the m-th station at time t. Meteorological parameter data of type q at station m and meteorological parameter data at hour h. ;
[0017] Hourly concentration data from national monitoring stations This represents the true concentration value of pollutant of type k at hour h.
[0018] in, , Hourly time steps 30-second time step ;
[0019] The preprocessing implementation method includes:
[0020] Time alignment: The average of multiple sampling results from air quality monitoring equipment within one hour is used as hourly concentration data. ;
[0021] hourly concentration data Data points exceeding a reasonable range are directly removed; missing data are filled using the mean of valid data from adjacent time points.
[0022] Min-Max normalization was used to normalize the filled hourly concentration data. Meteorological parameter data Hourly concentration data from national monitoring stations The numerical range was unified to the interval [0, 1], and normalized concentration data were obtained. Meteorological parameter data and concentration data ;
[0023] Normalized air quality monitoring equipment dataset { , A multivariate time series including the m-th station and the h-th hour: The true concentration sequence is composed of the normalized true concentrations of pollutant of category k and the h-th hour from the national monitoring station. .
[0024] Preferably, the cloud-based teacher model is a dual-attention-LSTM-MLP model, comprising a parametric attention mechanism, an LSTM module, a temporal attention mechanism, and a two-layer MLP structure connected in sequence.
[0025] Both the parametric attention mechanism and the temporal attention mechanism are fully connected neural networks terminated by a Softmax classification function. These networks consist of a fully connected layer I, a non-linear activation layer, a normalization layer, a fully connected layer II, and a weight normalization layer, connected sequentially. The parametric attention mechanism applies the following parameters to the training samples: The parameter attention weight matrix is obtained by processing the final hidden state output by the LSTM module through the temporal attention mechanism.
[0026] The LSTM module consists of four sequentially connected deep LSTM networks;
[0027] Training samples The weighted input features, obtained by element-wise multiplication with the parameter attention weight matrix, are input into the first layer of the LSTM module's deep LSTM network. The final hidden state output by the fourth layer of the deep LSTM network is used as the input to the temporal attention mechanism. The final hidden state is multiplied element-wise with the temporal attention weight matrix and then summed along the time step dimension to obtain the context vector. The two-layer MLP structure performs data dimensionality reduction on the context vector. The dimensionality-reduced features are mapped to the concentration values of K-type pollutants through the fully connected layer III to obtain the normalized predicted concentrations of K-type pollutants of the reference air quality monitoring device ref.
[0028] Preferably, the fully connected layer I maps the input low-dimensional training samples or final hidden states to a high-dimensional feature space through a learnable weight matrix and bias terms, thus obtaining high-dimensional features; the nonlinear activation layer uses a Gaussian error linear operation function to process the high-dimensional features. Perform a nonlinear transformation to obtain the activated features. The normalization layer affects the activated features. Normalization is performed to obtain the normalized high-dimensional attention features. Fully connected layer II compresses high-dimensional features into one-dimensional raw scores using learnable weight matrices, resulting in the raw score matrix. The weight normalization layer passes through Function along parameter dimension For the original score matrix Normalization is performed so that the sum of the weights of the feature parameters of the training samples at each time step is 1, thus obtaining the parametric attention weight matrix or the temporal attention weight matrix.
[0029] A four-layer deep LSTM network is connected sequentially to extract and learn input training samples hierarchically. The approach to complex temporal dependencies and dynamic patterns is as follows:
[0030] The first deep LSTM layer serves as the basic temporal feature extraction layer, taking weighted input features as input and outputting a 64-dimensional temporal hidden state. The second deep LSTM layer is the parameter coupling relationship deepening layer: taking the 64-dimensional temporal hidden state output from the first deep LSTM layer as input, it strengthens the nonlinear correlation learning between multiple parameters, reorganizes and deepens the temporal hidden state, and outputs a 96-dimensional temporal hidden state. The third deep LSTM layer is the long-term dependency enhancement layer: taking the 96-dimensional temporal hidden state output from the second deep LSTM layer as input, it strengthens the transmission and preservation of effective features over long periods, suppresses short-term random noise interference, and outputs a 128-dimensional temporal hidden state. The fourth deep LSTM layer is the high-quality feature output layer: taking the 128-dimensional temporal hidden state output from the third deep LSTM layer as input, it integrates and abstracts the features from the first three deep LSTM layers, outputting a well-structured and information-dense temporal feature encoding, and outputting a 128-dimensional final hidden state, which is then passed to the temporal attention mechanism.
[0031] In the two-layer MLP structure, the first layer reduces the context vector to 64 dimensions and uses the Swish function as the activation function; the second layer reduces the 64-dimensional data to 32 dimensions and uses the Swish function as the activation function; the 32-dimensional features are mapped to K outputs through the fully connected layer III, and each output corresponds to the normalized predicted concentration of a class of pollutants from the reference air quality monitoring device ref.
[0032] Preferably, the method for constructing the supervised dataset is as follows: using the sliding window technique, the normalized air quality monitoring equipment dataset {} is preprocessed and defined as the reference air quality monitoring equipment (ref) closest to the national control station. , The supervised dataset U is reconstructed; the supervised dataset is then randomly divided in a 7:3 ratio. Divided into training subsets With verification subset ;in, To reference the multivariate time series composed of the normalized concentration data of the air quality monitoring equipment at the h-th hour and meteorological parameter data, The normalized true concentration sequence of the h-th hour from the national control station;
[0033] The sliding window technique is implemented as follows: window parameters are defined as follows: window length is 13; sliding step size is 1; reconstruction rule: the multivariate time series under the t1-th window is used as the training sample of the reference air quality monitoring device ref for 12 consecutive hours. ,in, For the reference air quality monitoring device ref under the t1-th window Hourly multivariate time series, For the reference air quality monitoring device ref under the t1-th window A multivariate time series of hours, where T is the transpose of a vector or matrix; the prediction target is the true concentration sequence within the t1-th window. The reconstructed supervised dataset
[0034] [13,24D], where n represents the number of multivariate time series in the reference air quality monitoring device ref.
[0035] Preferably, the method of training the dual-attention-LSTM-MLP model using a supervised dataset and optimizing the model parameters using the AFSA algorithm is as follows:
[0036] (1) Encoding of artificial fish individuals: The five hyperparameters to be optimized, including learning rate, MLP Dropout, LSTM Dropout, maximum number of training iterations of LSTM, and number of hidden units of LSTM, are mapped to the position vector of artificial fish individuals, and each position component corresponds to the value of a hyperparameter;
[0037] (2) Foraging behavior: A new location is randomly generated within the foraging radius of the current location of each artificial fish individual, and the fitness value of the new location is calculated by the fitness function; if the fitness value of the new location is better than the fitness value of the current artificial fish individual, the current artificial fish individual moves to the new location; otherwise, the new location is randomly generated again, and if there is still no better location, the current location remains unchanged.
[0038] (3) Grouping behavior: Calculate the number of other artificial fish within the foraging radius of each artificial fish individual and their average fitness value; if the average fitness value of the surrounding artificial fish individual is better than the fitness value of the current artificial fish individual, and the crowding is less than the preset threshold, then the current artificial fish individual moves to the average position of the surrounding artificial fish individual; if the crowding is too high, then return to foraging behavior.
[0039] (4) Chasing behavior: Find the artificial fish individual with the best fitness value in the current fish group; for each artificial fish individual, calculate the distance between itself and the best individual. If the distance is within the foraging radius and the fitness value of the best individual is better than that of the current artificial fish individual, then the current artificial fish individual moves a certain distance towards the best individual; otherwise, perform foraging behavior.
[0040] (5) Random behavior: If an artificial fish fails to find a better location after foraging, gathering, and tail chasing behaviors, it will perform random behavior and randomly generate a new location.
[0041] (6) Iterative update and termination: Each time all artificial fish complete the foraging → swarming → tail chasing → random behavior, it is considered as one round of iteration; update the optimal fitness value of the fish group and the corresponding hyperparameter combination. If the current optimal fitness value does not decrease for 5 consecutive rounds, or reaches the preset maximum number of iterations, then terminate the optimization process and output the final optimal hyperparameter combination.
[0042] Preferably, the method for selecting multivariate time series data from relatively stable periods in the air quality monitoring equipment dataset as local training samples is as follows:
[0043] 1) Single-site multi-pollutant cusum change point detection: For the m-th site, a joint bias cumulative model is constructed by integrating K types of pollutants to capture the concentration change of any pollutant;
[0044] 2) Multi-site change point consensus verification: Find the change point moments that multiple air quality monitoring equipment points experience together, and determine the stable background period;
[0045] 3) Determine the background time period based on the stable background time period to obtain the background time period dataset for each air quality monitoring device.
[0046] Preferably, the method for constructing a joint deviation accumulation model to capture sudden changes in the concentration of any pollutant is as follows: A reference vector is constructed based on the normalized concentration data of each air quality monitoring device for the first hour; the deviation vector between the normalized concentration of pollutant type K at the m-th station and the corresponding reference vector at the h-th hour is calculated. Then the weighted joint bias , The weight vector is used; the bias is jointly determined using the Cusum algorithm. Accumulate weights to obtain the cumulative sum at step t; set control limits. When the cumulative sum value at step t is... Determine the m-th station and the h-th hour as change points, and record the set of change points. Where m_change is the number of change points at the m-th station;
[0047] The step of determining the stable background period is as follows: collect the set of change points from all air quality monitoring devices. Iterate through each variable point as a candidate variable point. Set time window For any candidate variable moment Statistics fall within the time window The number of variable points within the range, count_hold; let the consensus threshold be threshold = If the number of points changes Then determine the candidate turning point time. For global variables, we can obtain the set of global variables. Where ALL_change is the number of global change points;
[0048] The method for determining the background time period is as follows: calculating the global change point set. The time interval between adjacent global change points Select time interval The longest time interval is selected as the candidate background segment; if there are two or more candidate background segments with equal time intervals, the weighted joint deviation mean of all air quality monitoring devices within each candidate background segment is calculated. Select the weighted joint bias mean within the candidate background segment and The smallest time period is used as the background time period; the background time period dataset for the m-th site. ;in, This refers to the current time period.
[0049] Preferably, the background time period dataset of the m-th site is... Multivariate time series Substituting the local training samples into the trained dual-attention LSTM-MLP model yields the predicted concentrations of pollutants of class K, denoted as labels. , For the m-th site, the k-th type of pollutant, the... Predicted concentration for one hour;
[0050] Background time period dataset Multivariate time series Labels output by the cloud-based teacher model Aligning by time steps, construct the training dataset for the Extra Trees student model. The training dataset T is randomly divided into training subsets in a 7:3 ratio. With verification subset .
[0051] Preferably, the fitness function of the dual-attention-LSTM-MLP model during training is the validation subset. mean square error ;in, To verify subset The number of samples, It is the L2 norm. It is a verification subset The predicted values of the validation samples, It verifies the true value of the sample;
[0052] The dual-attention LSTM-MLP model uses a training subset during training. mean square error As a loss function, and: ;in, For training subset The number of samples, These are the predicted values from the training samples. These are the true values of the training samples;
[0053] The cumulative weighted update formula is: the cumulative sum at step t. , where the initial value , Let be the cumulative sum at step t-1;
[0054] The time interval ;
[0055] The weighted joint bias mean of the current candidate background segment ;in, The total number of hourly time steps within the candidate background segment, where seg represents the current candidate background segment and the corresponding hourly time step interval;
[0056] The AFSA algorithm is used to globally optimize the hyperparameters of the Extra Trees student model, including the number of decision trees and the maximum depth of a single decision tree. The core parameters of the AFSA algorithm from step two are used, only adjusting the encoding dimension of the artificial fish individuals to 2-dimensional. This is done to validate the subset. mean square error As the fitness function, the loss function of the Extra Trees student model uses the mean squared error of the Extra Trees student model.
[0057] Compared with the prior art, the specific problem solved by this invention is reflected in:
[0058] 1. Construct an AFSA-optimized high-precision dual-attention-LSTM-MLP teacher model. For six types of air pollutants, it integrates artificial fish swarm algorithm and dual-attention mechanism to effectively solve the problems of long-term information dilution, fixed weights of multiple parameters, and hyperparameters easily getting trapped in local optima in traditional models.
[0059] 2. A background time period screening method combining multi-pollutant joint bias, CUSUM, and multi-site consensus verification is proposed to solve the problem that remote air quality monitoring equipment has no national control station reference and is difficult to determine background concentration due to interference from local pollution sources, thus providing high-confidence training data for student models.
[0060] 3. Design an AFSA-optimized lightweight Extra Trees (Extreme Random Trees) student model, which is trained using background time period data combined with soft labels from the teacher model. This model is adapted to the embedded computing power constraints of remote air quality monitoring equipment, addressing the pain points of environmental heterogeneity and difficulty in model updates, and achieving a balance between calibration accuracy and lightweight design.
[0061] 4. To address the challenges of model deployment and updates for remote air quality monitoring equipment, as well as the limitations of computing power, an AFSA-optimized Extra Trees (Extreme Random Tree) student model + cloud-based collaborative closed-loop solution is designed. By optimizing core parameters such as the number of trees and maximum depth using AFSA, the model can be adapted to the computing power constraints of embedded devices. Attached Figure Description
[0062] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, 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.
[0063] Figure 1 This is a flowchart of the present invention.
[0064] Figure 2 This is a flowchart of the data preprocessing process of the present invention.
[0065] Figure 3 This is a flowchart of the cloud-based high-precision model training process of the present invention.
[0066] Figure 4 This is a flowchart illustrating the construction of the calibration model for the air quality monitoring equipment of the present invention.
[0067] Figure 5 This is a data flow diagram of the present invention.
[0068] Figure 6 This is a scatter plot of the actual and predicted values of the cloud-based high-precision model of the present invention.
[0069] Figure 7 A time series diagram showing the true and predicted values of a calibration model for an air quality monitoring device. Detailed Implementation
[0070] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0071] like Figure 1 As shown, a multi-parameter air quality calibration system includes the following steps:
[0072] Step 1: Obtain time series data related to multivariate air pollutants from multiple air quality monitoring devices and perform preprocessing to obtain an air quality monitoring device dataset.
[0073] The data used in this invention primarily comes from the company's independently developed environmental protection equipment IoT cloud platform. This cloud platform utilizes object models (a digital modeling method for devices in the IoT field, which abstracts the attributes, functions, and communication protocols of devices into standardized models to achieve unified device management and data interaction) to achieve standardized management of air quality monitoring equipment. It can comprehensively record equipment location information, operating status data (including wireless module signal strength, motherboard power supply voltage, and LED display status), equipment accessory information, maintenance records, fault records, calibration records, and equipment measurement data. Simultaneously, it collects data on six types of pollutants monitored by the air quality monitoring equipment. Along with four types of meteorological parameters (temperature, humidity, wind speed, and air pressure, which can be obtained from the corresponding regional weather forecasts), these meteorological parameters collectively influence the formation and diffusion of pollutants, providing the model with more comprehensive information.
[0074] Using an environmental protection equipment IoT cloud platform to obtain data under different atmospheric conditions The monitoring data from each device constitutes a dataset, including K=6 types of pollutants ( ) and Q=4 types of meteorological parameters (temperature T, humidity H, wind speed V, air pressure P), and data on 6 types of pollutants from national monitoring stations ( The data collection period is D days, and the specific dimension is defined as: air quality monitoring equipment number. Pollutant type code (1-6 correspond to the above 6 types of pollutants); meteorological parameter number (1-4 correspond to the four meteorological parameters mentioned above, respectively). 30-second time step. Among them, 2880 represents the number of data entries per day at the 30-second level; hourly time steps Total number of hours within the data collection period.
[0075] Based on the above dimensional definitions, the core data symbols and their corresponding meanings are as follows: minute-level concentration data from air quality monitoring equipment: for the m-th station ( The kth type of pollutant ( ), at time t The original data is Hourly concentration data from national monitoring stations Represents the kth type of pollutant ( The actual concentration value in the h-th hour. Meteorological parameter data. Represents the m-th station ( The qth type of meteorological parameter () ), data for the hth hour.
[0076] To improve the model's adaptability and accuracy, systematic preprocessing of concentration and meteorological data is necessary, such as... Figure 2 As shown, the specific processing steps are described below:
[0077] Step 1: Time Alignment
[0078] Because air quality monitoring equipment takes multiple samples within one hour, the average of these samples is used as the hourly sampling result, thus ensuring consistency with the hourly data from national monitoring stations. (Hourly concentration data from air quality monitoring equipment)
[0079]
[0080] in, This is the set of 30-second time steps corresponding to the h-th hour.
[0081] Step 2: Outlier removal and missing value filling
[0082] If air quality monitoring equipment generates abnormal concentration data, it needs to be processed. For example, a threshold can be set based on the actual physical range of pollutants, and data points exceeding this range can be considered outliers and removed directly. Missing data can be filled by averaging the valid data from adjacent time points to ensure data continuity. The method for averaging is as follows: Hourly concentration data from air quality monitoring equipment...
[0083]
[0084] in, and These are the concentration data for the m-th station and the k-th pollutant at the h-1 hour and h+1 hour, respectively.
[0085] Step 3: Data Normalization
[0086] The core is to separate different pollutants (such as...) The numerical range of (etc.) is unified to the [0, 1] interval to eliminate the differences in the dimensions of different pollutants (such as ppm and ...). This accelerates model convergence and improves accuracy. Here, Min-Max Scaling is used. First, the maximum and minimum values of the dataset are estimated, and the resulting scale is applied to the dataset. For data requiring correction, this scale is also used for normalization.
[0087] Minimum value of data for pollutant category k after filling all air quality monitoring equipment:
[0088] ;
[0089] The maximum value of the filled data for pollutant category k from all air quality monitoring devices:
[0090] ;
[0091] Minimum value of Class q meteorological parameter data from all air quality monitoring equipment:
[0092] ;
[0093] The maximum value of the qth type meteorological parameter data from all air quality monitoring equipment:
[0094] ;
[0095] The global minimum value of data from the national monitoring station for pollutant k: ;
[0096] The global maximum value of data from the national monitoring station for pollutant k: .
[0097] The normalized concentration data and meteorological parameter data are respectively
[0098] ;
[0099] ;
[0100] ;
[0101] The normalized air quality monitoring equipment dataset can be obtained { , The following is a multivariate time series data, including the h-th hour from the m-th air quality monitoring device: As input features, input features The data includes normalized data of 6 types of pollutants and 4 types of meteorological parameters, with a dimension of 1×10.
[0102] Normalized true concentration of pollutant of category k at national monitoring station on the hth hour True concentration Label data used for model training.
[0103] Step 2: Construct a cloud-based teacher model and train it using the dataset from the reference air quality monitoring device closest to the national control station. Optimize the model parameters using the AFSA algorithm.
[0104] Currently, machine learning-based algorithms are being applied to air quality forecasting in some regions, providing a reference for improving the performance of air quality monitoring equipment. This invention utilizes a dual-attention-LSTM-MLP model as the core architecture of the cloud-based teacher model. As a special recurrent neural network with memory capabilities, it excels at time-series data modeling, accurately capturing the temporal dependencies of monitoring data, adapting to both long and short time-series prediction needs, and deeply mining the temporal evolution patterns and multi-parameter correlation characteristics of pollutant concentrations. Based on the reference air quality monitoring equipment (ref) closest to the national control station, as identified in step one, the preprocessed data from that station is used as the core input, coupled with the corresponding national control station's actual concentration values as labels, to train the teacher model, ensuring the model's calibration capability for pollutant concentrations.
[0105] like Figure 3 As shown, the detailed approach to model training is as follows:
[0106] Step 1: Sliding Window Reconstruction (Unsupervised to Supervised): Using the sliding window technique, the multivariate time series data of the reference air quality monitoring equipment (ref) preprocessed in Step 1 is reconstructed. , The data is reconstructed to transform unsupervised time series data into supervised training data.
[0107] The input characteristics and actual concentration of the reference air quality monitoring device (ref) are respectively...
[0108]
[0109]
[0110] The dataset is reconstructed using the sliding window technique. Window parameters are defined as follows: window length is 13 (containing the historical 12 hours of input + the predicted target for the next 1 hour); sliding step size is 1. Reconstruction rule: For the t1-th window, the input sequence is...
[0111]
[0112] in, The reference air quality monitoring equipment ref is the value at hour t1 after the preprocessing in step one. The input feature sequence of the reference air quality monitoring device ref for 12 consecutive hours under the t1-th window. For the reference air quality monitoring device ref under the t1-th window Input characteristics of hours. For the reference air quality monitoring device ref under the t1-th window The input features for each hour. T is the transpose of a vector or matrix.
[0113] The prediction target is the actual concentration value. The data is obtained directly from the hourly data of the Chinese control stations in step one after Min-Max normalization, and is completely time-aligned with the hourly data of the reference air quality monitoring equipment ref.
[0114] The reconstructed dataset is a supervised dataset.
[0115] [13,24D]. n represents the total amount of data in the reference air quality monitoring device ref.
[0116] Dataset partitioning: The supervised dataset was randomly partitioned in a 7:3 ratio. Divided into training subsets With verification subset .
[0117] Step 2: Construct a dual attention-LSTM-MLP model, which includes a parametric attention mechanism, an LSTM module, a temporal attention mechanism, and a two-layer MLP structure connected in sequence.
[0118] Here we propose a dual attention-LSTM-MLP model and optimize it using AFSA (Artificial Fish Swarm Algorithm).
[0119] 1. Dual Attention - LSTM
[0120] This invention constructs a 4-layer deep LSTM network to extract and learn input sequences hierarchically. Complex temporal dependencies and dynamic patterns.
[0121] The first layer of the deep LSTM network serves as the basic temporal feature extraction layer:
[0122] The input is a 10-dimensional time-series data (batch_size, seq_len, 10) weighted by the parameter attention; where batch_size is the batch size of samples for each training session, with a value of 32 (balancing the training efficiency of the reference air quality monitoring equipment data with cloud computing power consumption), and seq_len is the time step length of the input sequence, with a value of 12 (corresponding to 12 hours of historical data); the weighted input is obtained by multiplying the original input features of the reference air quality monitoring equipment (ref) element-wise with the parameter attention weights, and the output is a 64-dimensional temporal hidden state (batch_size, seq_len, 64), which is passed to the second layer of the deep LSTM network.
[0123] The second layer of the deep LSTM network is a layer that deepens the parameter coupling relationship:
[0124] The input is the 64-dimensional temporal hidden state (batch_size, seq_len, 64) output from the first-layer deep LSTM network.
[0125] The core function is to explore the coupling relationship between pollutants and meteorological parameters. The processing logic is as follows: based on the features of the previous layer, the nonlinear correlation learning between multiple parameters is enhanced through the LSTM network, the hidden state is reorganized and the features are deepened, and a 96-dimensional temporal hidden state (batch_size, seq_len, 96) is output and passed to the third layer deep LSTM network.
[0126] The third layer of the deep LSTM network is a long-term dependency reinforcement layer:
[0127] The input is the 96-dimensional temporal hidden state (batch_size, seq_len, 96) output from the second-layer deep LSTM network.
[0128] The core function is to solve the problem of dilution of long-term temporal information and capture cross-time-period dependencies. Processing logic: Relying on the long memory characteristics of LSTM networks, it enhances the transmission and retention of effective features over long time periods, suppresses short-term random noise interference, and outputs a 128-dimensional temporal hidden state (batch_size, seq_len, 128), which is then passed to the 4th layer deep LSTM network.
[0129] The fourth layer of the deep LSTM network is a high-quality feature output layer:
[0130] The input is the 128-dimensional temporal hidden state (batch_size, seq_len, 128) output from the 3rd layer deep LSTM network.
[0131] The core function is to integrate and abstract the features of the first three layers, and output a well-structured and information-dense temporal feature encoding to provide high-quality input for subsequent temporal attention. The processing logic is as follows: the hidden state of the previous layer is weighted and integrated, redundant information is filtered out, the core correlation features between pollutant concentration and meteorological parameters in the reference air quality monitoring equipment ref data are retained, and a 128-dimensional final hidden state (batch_size, seq_len, 128) is output and directly passed to the temporal attention layer.
[0132] This invention introduces two new attention mechanisms: parametric attention mechanism and temporal attention mechanism.
[0133] The model does not treat the 10 input features of the reference air quality monitoring device (ref) equally. A parametric attention mechanism is designed, which automatically learns and assigns a weight to each feature through a lightweight attention sub-network, identifying which parameters (such as a specific pollutant or meteorological factor) are most critical to the current correction task. The parametric attention mechanism is a small, fully connected neural network (MLP, multilayer perceptron) connected to a Softmax classification function at its terminals. The calculation process is as follows:
[0134] Step 1: Fully Connected Layer I (Linear1): Input dimension is input_dim=10 (6 pollutants + 4 meteorological parameters), output dimension is attention_dim=32 (attention feature dimension), used to map the low-dimensional raw parameters to a high-dimensional feature space, obtaining sufficient expressive power to capture the nonlinear laws of parameter importance. Its mathematical expression is: High-dimensional features
[0135]
[0136] in, Here is the learnable weight matrix (10×32 dimensions) for fully connected layer I. This is the bias term (dimension 32). The input time series parameter matrix (dimension (batch_size, seq_len, 10) of the reference air quality monitoring device ref corresponds to the input sequence reconstructed by the sliding window. .
[0137] Step 2: Nonlinear Activation Layer (GELU): For high-dimensional features A nonlinear transformation is performed to accommodate the complex relationship between parameter importance and parameter values (such as the different effects of high and low humidity on pollutant diffusion). The mathematical expression is as follows:
[0138]
[0139] in, It uses Gaussian error linear units, which can improve the stability of training.
[0140] Step 3: Normalization Layer (LayerNorm): Normalizes the activated features Normalization is performed to eliminate numerical differences between feature dimensions and stabilize the training gradient. The mathematical expression is:
[0141]
[0142] in, The normalized high-dimensional attention features For layer-level normalization, the feature dimensions of each sample are normalized to avoid the shortcomings of batch normalization which relies on batch data, thus adapting to the training scenario of time-series data from reference air quality monitoring equipment. The normalization dimension is the attention feature dimension (32-dimensional).
[0143] Step 4: Fully Connected Layer II (Linear2): Input dimension is 32, output dimension is 1, and it contains no bias term (bias=False). It is used to compress high-dimensional features into one-dimensional raw scores, avoiding the bias term interfering with the fair distribution of parameter weights. The mathematical expression is:
[0144]
[0145] in, This is the learnable weight matrix (32×1 dimension) for the fully connected layer II. The original score matrix (dimension (batch_size, seq_len, 10, 1)).
[0146] Step 5: Weight Normalization Layer (Softmax): Normalizes the original score matrix along the parameter dimension (dim=-1). Normalization is performed so that the sum of the weights of the 10 parameters at each time step is 1, resulting in the final parameter attention weight matrix, mathematically expressed as:
[0147]
[0148] in, The parameter is the attention weight matrix, with dimensions (batch_size, seq_len, 10). As a normalized exponential function, the original score can be mapped to the [0,1] interval, and the weights of the same dimension sum to 1, thus realizing the quantitative allocation of parameter importance.
[0149] The input characteristic sequence of the reference air quality monitoring equipment will be used. With attention weight matrix Element-wise multiplication yields a weighted result (batch_size, seq_len, 10), which serves as the input to the first layer of the deep LSTM network. This mechanism allows the model to automatically learn and emphasize which input features are most critical to the correction task, enhancing the model's interpretability.
[0150] This invention designs a temporal attention mechanism that assigns weights to the output of the LSTM network at each time step, allowing the model to focus on the most important "critical moments" in history, rather than simply using the state of the last time step. The neural network structure of the temporal attention mechanism is the same as that of the parametric attention mechanism, but here the input dimension is hidden_dim=128 (the dimension of the hidden state output of the LSTM). The calculation process is: Linear(128 -> 32) -> GELU -> LayerNorm -> Linear(32 -> 1) -> Softmax.
[0151] Each value is between 0 and 1, and the sum of the weights of all time steps in the same sequence is 1. Processing logic: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] depth LSTM networks The output hidden state (referencing air quality monitoring equipment data, dimension (batch_size, seq_len, 128)) is multiplied element-wise with the temporal attention weights (dimensional (batch_size, seq_len, 1)), and then summed along the time step dimension to obtain a condensed context vector (dimensional (batch_size, 128)), thus achieving feature focusing at key time steps.
[0152] The parameter attention weighting mechanism enables dynamic parameter selection, while the temporal attention weighting mechanism focuses on key time steps. Together, they enable the model to accurately capture the complex nonlinear relationship between pollutants and meteorology. The parameter attention weights conform to common business sense (e.g., high weights for pollutants themselves during periods of pollution, and high weights for wind speed / humidity during periods of meteorological abrupt changes), while the temporal attention weights can accurately locate key time steps (e.g., periods of pollution accumulation, and nodes of meteorological abrupt changes), facilitating business validation and adjustment of model results.
[0153] 2. MLP processing
[0154] A two-layer MLP structure was constructed, with the input data being the context vector (batch_size, 128) output by the temporal attention mechanism. This structure was used to map the high-dimensional temporal features to the calibration concentrations of six pollutants. The specific design is as follows:
[0155] The first layer of the MLP reduces the data to 64 dimensions, and the activation function used is the Swish function: ; where x is the input feature vector of this layer (dimension 128).
[0156] The second MLP layer further reduces the data to 32 dimensions, and the activation function is still Swish. Output layer: The 32-dimensional features are mapped to 6 output values through a fully connected layer. The weight dimension of the fully connected layer is 32×6, and the bias term dimension is 6. Each output corresponds to the normalized calibration concentration of a type of pollutant from the reference air quality monitoring device. The dropout probability candidate set of the MLP is [0.1, 0.2, 0.3], which is used to suppress model overfitting. The optimal value is determined by the subsequent AFSA algorithm.
[0157] Step 3: Train the dual attention-LSTM-MLP model using a supervised dataset and optimize the model parameters using the AFSA algorithm.
[0158] Artificial Fish Swarm Optimization (AFSA), as a swarm intelligence optimization algorithm, is particularly suitable for global optimization in high-dimensional, nonlinear, and nonconvex parameter spaces. Here, we use the Artificial Fish Swarm Optimization (AFSA) algorithm to optimize model parameters. The specific steps are as follows:
[0159] Step 1. Hyperparameter Definition
[0160] The hyperparameter settings include: learning rate: 1e-4, 1e-3, 1e-2; MLP Dropout: 0.1, 0.2, 0.3; LSTM network Dropout: 0.1, 0.2, 0.3; maximum number of training iterations for the LSTM module: 100, 200, 300; number of hidden units in the LSTM network: 64, 128, 256.
[0161] Step 2. Initialize AFSA algorithm parameters
[0162] The AFSA algorithm parameters are set as follows: artificial fish population size is 50, maximum number of iterations is 30, foraging radius is 0.2, clustering factor is 0.6, tail-chasing factor is 0.9, and number of attempts is 10. The hyperparameters to be optimized are encoded as artificial fish individuals to construct the initial fish population.
[0163] Step 3. Definition of Fitness Function
[0164] To verify subset mean square error As a fitness function, a smaller fitness value indicates a better combination of hyperparameters, and its expression is:
[0165]
[0166] in, To verify subset The number of samples, It is an L2 norm. It is the predicted value of the validation sample. It verifies the true value of the sample.
[0167] Step 4. Definition of the loss function
[0168] During training, a training subset is used. mean square error As a loss function, it measures the deviation between the model's predicted values and the actual values, and its expression is:
[0169]
[0170] in, For training subset The number of samples, It is an L2 norm. It is the model's prediction of the training samples. These are the true values of the training samples.
[0171] Step 5. AFSA Optimization Process
[0172] The artificial fish swarm algorithm achieves global hyperparameter optimization by simulating the foraging, swarming, tail-chasing, and random behaviors of artificial fish. Combined with the model training scenario, the specific execution steps are as follows:
[0173] (1) Encoding of artificial fish individuals: The five hyperparameters to be optimized (learning rate, MLP Dropout, LSM Dropout, maximum number of training iterations of LSTM, number of hidden units of LSTM) are mapped to the position vector of artificial fish. Each position component corresponds to the value of a hyperparameter. The dimension of the position vector is consistent with the number of hyperparameters to be optimized (5 dimensions) to ensure that the combination of hyperparameters corresponds one-to-one with the artificial fish individual.
[0174] (2) Foraging behavior (core optimization behavior): For each artificial fish individual, a new location (new hyperparameter combination) is randomly generated near its current location (within the foraging radius), and the fitness value of the new location is calculated; if the fitness value of the new location is better than the fitness value of the current individual, the current individual moves to the new location; otherwise, the trial is repeated (the number of trials is the preset 10 times). If there is still no better location after the trial, the current location remains unchanged.
[0175] (3) Grouping behavior (avoiding local optima): Calculate the number of other artificial fish around each artificial fish individual (within the foraging radius) and their average fitness value; if the average fitness value of the surrounding artificial fish is better than the fitness value of the current individual, and the crowding (number of surrounding artificial fish / population size) is less than the preset threshold (0.3), then the current individual moves to the average position of the surrounding artificial fish (update the hyperparameter combination); if the crowding is too high, then abandon grouping and continue to perform foraging behavior to avoid the fish group gathering causing the search to fall into the local optimum area.
[0176] (4) Chasing behavior (accelerating convergence): Find the artificial fish individual with the best fitness value in the current fish group (optimal hyperparameter combination); for each artificial fish individual, calculate the distance between itself and the best individual. If the distance is within the foraging radius and the fitness value of the best individual is better than that of the current individual, then the current individual moves a certain distance towards the best individual (the movement step size is controlled by the chasing factor, 0.9); otherwise, continue to execute the foraging behavior. Chasing behavior can make the fish group quickly move towards the global optimal solution, improving the convergence speed of optimization.
[0177] (5) Random behavior (global exploration): If an artificial fish individual still fails to find a better position after foraging, gathering, and tail chasing behaviors, then random behavior is executed to randomly generate a new position (hyperparameter combination) to ensure that the fish group can explore different regions of the hyperparameter space and further avoid getting trapped in local optima.
[0178] (6) Iteration update and termination: Each time all artificial fish complete the behavior execution (foraging → grouping → tail chasing → random), it is considered as one round of iteration; update the optimal fitness value of the fish group and the corresponding hyperparameter combination. If the current optimal fitness value does not decrease for 5 consecutive rounds, or reaches the preset maximum number of iterations (30 rounds), then terminate the optimization process and output the final optimal hyperparameter combination.
[0179] Step 3: Air Quality Monitoring Equipment Calibration Model Construction: Select multivariate time series from relatively stable periods in the air quality monitoring equipment dataset as training samples. Input the training samples into the predicted concentration obtained from the trained cloud teacher model as the corresponding label to train a lightweight Extra Trees student model. Then, use the AFSA algorithm to optimize the model parameters to obtain the trained lightweight Extra Trees student model. Use the lightweight Extra Trees student model to process the time series collected in real time by the air quality monitoring equipment to obtain the prediction results.
[0180] This invention first selects relatively stable periods in the monitoring data of air quality monitoring equipment within a region (during which pollutant concentrations fluctuate slightly and meet stability standards after time window variance verification). High-confidence results are obtained by correcting sensor biases based on data from these relatively stable periods. Then, a new dataset is constructed using this data as the core training source and the output of a high-precision cloud-based teacher model as soft labels. Based on this dataset, a lightweight student model is trained using the Extra Trees algorithm for hyperparameter optimization. Finally, this student model is used to calibrate air quality monitoring equipment, adapting to the embedded computing power constraints of air quality monitoring equipment while inheriting the accuracy of cloud-based calibration, completely eliminating reliance on reference data from national monitoring stations.
[0181] like Figure 4 As shown, the concept of this invention is as follows:
[0182] Step 1: Single-site multi-pollutant cusum variable point detection
[0183] For the m-th station, 6 types of pollutants are integrated ( A joint bias cumulative model is constructed to capture concentration abrupt changes of any pollutant.
[0184] Step 1. Reference Vector Construction: Based on the normalized data of the first hour (hourly time step h=1) of each air quality monitoring device, construct a reference vector. .
[0185] Step 2. Weighted Joint Deviation Calculation for Multiple Pollutants: Deviation vectors between the six pollutant categories and the reference vector at the m-th station and the h-th hour: ;
[0186] To highlight the weights of key pollutants, a weight vector is introduced here. Then the weighted joint bias is: .
[0187] Step 3. Accumulation, Update, and Change Point Determination
[0188] Accumulated weighted joint bias using the cusum algorithm Accumulation and update formula for detecting concentration abrupt changes: , where the initial value , For the cumulative sum of steps t-1, Let be the cumulative sum over t steps.
[0189] Single-site change detection: setting control limits ,when Determine the m-th station and the h-th hour as "change points" and record the set of change points.
[0190] ;
[0191] Where m_change is the number of change points at the m-th station. Control limits It can be set to a fixed value, or it can be adjusted appropriately according to the pollution situation. For example, the threshold needs to be increased in severely polluted areas and decreased in clean areas.
[0192] Step 2: Multi-site consensus verification
[0193] This step aims to identify the common turning point experienced by multiple air quality monitoring devices, thereby determining the stable background period. The steps are as follows:
[0194] Step 1. Collect the variable point set of all air quality monitoring devices. Iterate through each variable point as a candidate variable point. ;
[0195] Step 2. Set the time window It can be set to For any candidate variable moment Statistics fall within the time window The number of variable points within the range is denoted as the variable point count_hold.
[0196] Step 3. Set the consensus threshold = If the number of points changes Then determine the candidate turning point time. For global variable points (where most stations in the region experience synchronous abrupt changes, such as sudden pollution or large-scale weather changes, only one of the multiple candidate variable points within the same time window is retained as a global variable), the global variable point set can be obtained. For the global variable set By arranging the data chronologically, the entire monitoring period can be divided into multiple consecutive time intervals. Each interval contains no regional-level pollution abrupt changes, providing a basis for subsequent background period screening. ALL_change represents the number of all global change points.
[0197] Step 3: Determine the background time period
[0198] Calculate the global variable set The time interval between adjacent global change points
[0199] ;
[0200] Select time interval The longest time interval was selected as the candidate background interval. Within this interval, there were no regional concentration abrupt changes, the pollutant concentration was closest to the background concentration, and the monitoring values of all air quality monitoring equipment showed synchronous small fluctuations.
[0201] If there are two or more candidate background segments with equal time intervals, calculate the weighted joint mean of the deviations of all air quality monitoring devices within each candidate background segment, using the following formula:
[0202] ;
[0203] in, This represents the total number of hourly time steps within the candidate background segment, and seg represents the current candidate background segment (corresponding to the hourly time step interval). This is the weighted joint mean of the current candidate background segments.
[0204] Select the weighted joint bias mean within the candidate background segment and The smallest time period is used as background.
[0205] After selecting the background time period, the background time period dataset can be obtained for the air quality monitoring device m.
[0206]
[0207] in, The currently selected background time period.
[0208] Step 4: Student Model Training for Single Air Quality Monitoring Equipment
[0209] Background Time Dataset Since the dataset itself lacks labels representing actual values from national monitoring stations, this invention utilizes an optimal teacher model pre-trained in the cloud to predict background time period datasets. The predicted output of the teacher model is then used as a "soft label," paired with the input data from air quality monitoring equipment during the background time period to construct a supervised training dataset for the student model, completely eliminating reliance on national monitoring station reference data. The specific steps are as follows:
[0210] U-1. Background time period dataset
[0211]
[0212] Where m is the site of the model to be trained. It contains normalized data of 6 types of pollutants and 4 types of meteorological parameters, with a dimension of 1×10. express The hourly time in the time series feature vector. Substituting the values into the dual-attention-LSTM-MLP model from step two, we can obtain the calibrated concentrations of the six pollutants, denoted as soft labels.
[0213]
[0214] in, For the m-th site, the k-th type of pollutant, the... The calibration concentration is measured every hour.
[0215] U-2. Training set construction
[0216] Time series dataset The temporal feature vectors are aligned with the soft labels output by the cloud-based teacher model by time step to construct the training set for the Extra Trees algorithm:
[0217]
[0218] Dataset partitioning: Randomly divided into training subsets in a 7:3 ratio. With verification subset .
[0219] U-3.Extra Trees Algorithm Training
[0220] The AFSA algorithm is used to globally optimize the core hyperparameters of the Extra Trees student model, ensuring that the model is lightweight while maintaining calibration accuracy. The specific steps are as follows:
[0221] Step 1. Hyperparameter Definition
[0222] Define the number of decision trees Maximum depth of a single decision tree After AFSA global optimization, the optimal combination of these two hyperparameters will be obtained. This data can then be used to build the final Extra Trees model and eventually deployed on the corresponding site.
[0223] Step 2. Initialize AFSA algorithm parameters
[0224] Using the core AFSA parameters from step two (population size 50, maximum number of iterations 30, foraging radius 0.2, etc.), we only adjusted the individual encoding dimension of the artificial fish to 2-dimensional (corresponding to 2 hyperparameters to be optimized) to ensure optimization efficiency and global optimization capability.
[0225] Step 3. Definition of Fitness Function
[0226] To verify subset mean square error As a fitness function, a smaller fitness value indicates a better combination of hyperparameters, and its expression is:
[0227]
[0228] in To verify subset The number of samples, It is an L2 norm. In Time period It is the predicted value of the validation sample. It verifies the true value of the sample.
[0229] Step 4. Definition of Loss Function
[0230] The loss function here uses mean squared error. :
[0231]
[0232] in, For training set The number of samples, It is an L2 norm. In Time period These are the predicted values from the training samples. These are the true values of the training samples.
[0233] Step 5. Optimization Process
[0234] Repeat step two of the AFSA optimization process (individual encoding → foraging → clustering → tail chasing → randomization → iteration termination) to output the optimal hyperparameter combination of the student model.
[0235] Step 5. Model Saving and Deployment
[0236] The model saving and distribution process is as follows Figure 5 As shown.
[0237] Step 1. Model Saving: After the student model on the air quality monitoring device side is generated (training completed in Step 3), the platform compresses the training results and saves them into MINI IO, forming a deployable model module file.
[0238] Step 2. Model Deployment: After model training is complete, the platform's training result processing module receives the training results and the model storage address. Based on the HJ212 environmental data transmission protocol, the platform sends a command to the terminal air quality monitoring device, notifying the terminal that model training is complete, and also deploys the storage address of the model file in MINI IO. If the device does not return a confirmation receipt within the valid time limit of the command, the platform will execute a limited retransmission mechanism (e.g., 3 times). If retransmission fails, the device will be marked as "deployment abnormal," and a platform alarm will be triggered. After receiving the confirmation receipt, the platform updates the model deployment status to "deployed."
[0239] Step 3. Model Acquisition: The terminal device's HJ212 processing module parses the transmitted data, pushes the model address to the HTTP module, and notifies the HTTP module to download the model. The terminal device's HTTP module, based on the sent storage address, downloads the corresponding model module from the cloud platform's MINI IO, decompresses the model package, and stores the model in the designated location, completing local deployment. After model deployment, the terminal device uses a small amount of local historical monitoring data for model inference verification (verifying that the model output format is normal, there are no inference errors, and the accuracy meets preset requirements). If verification is successful, the terminal sends a successful model deployment receipt to the platform via the HJ212 protocol, and the platform updates the model deployment status to "deployed," completing the entire process. If verification fails, the terminal sends a deployment failure receipt to the platform (with the reason for failure), the platform marks the device as "deployment abnormal" and triggers an alarm, requiring manual investigation before re-executing the deployment process. Subsequently, the terminal device will use the new model for data processing and will use the HJ212 protocol to send the new data back to the cloud platform for the next model generation.
[0240] To address the issue of decreased calibration accuracy caused by sensor aging and long-term environmental changes, a cloud-based collaborative iterative update mechanism is designed to achieve dynamic optimization of the student model. The specific process is as follows:
[0241] (1) Each air quality monitoring device uploads local calibration data and real-time monitoring data to the Internet of Things cloud platform in real time. The cloud platform collects historical data from all air quality monitoring devices and uses the data from the previous month on the 1st of each month to filter out the latest stable period data (using the methods in Sections 3.1 to 3.3 to re-filter new background periods).
[0242] (2) Using the latest filtered background time period data, we input the cloud teacher model to generate new soft labels and construct a new student model training dataset.
[0243] (3) The Extra Trees student model was retrained using AFSA hyperparameter optimization to obtain the optimized new generation student model.
[0244] (4) The cloud platform will push the optimized student model to all air quality monitoring devices in batches. The air quality monitoring devices will automatically update the model to achieve continuous improvement in calibration accuracy and form a closed-loop management of "cloud optimization → edge deployment → data feedback → cloud iteration".
[0245] Specific implementation examples of the present invention are described below:
[0246] 1. Training a high-precision model based on air quality monitoring equipment.
[0247] Based on the technical solution in step two, this case selects a certain air quality monitoring device as a reference air quality monitoring device (without tall buildings or industrial pollution sources obstructing the view, and the monitoring environment is consistent with the national control station). The specific implementation process is as follows:
[0248] (1) Dataset construction: Collect synchronous monitoring data of the reference air quality monitoring equipment and the corresponding national control station for 30 consecutive days (D=30). The reference air quality monitoring equipment collects second-level data (including 6 types of pollutants + 4 types of meteorological parameters), and the national control station collects hourly-level real concentration data of 6 types of pollutants. Following the preprocessing process in step one, complete time alignment, outlier removal, missing value filling, and Min-Max normalization to obtain the preprocessed dataset.
[0249] (2) Dataset reconstruction and partitioning: Using the sliding window technique in step two, the multivariate time series data preprocessed by the reference air quality monitoring equipment is reconstructed into supervised training data. The input is a feature sequence of 12 consecutive hours (6 types of pollutants + 4 types of meteorological parameter normalized data), and the output is the normalized true concentration of pollutants at the national control station in the 13th hour. The reconstructed dataset is divided into a training subset and a validation subset in a 7:3 ratio for model training and hyperparameter optimization.
[0250] (3) Model training and AFSA optimization: Construct a dual attention-LSTM-MLP model, and perform global hyperparameter optimization using the AFSA algorithm according to the hyperparameter search range set in step two, to train a subset. For training data, validation subsets To validate the data, model training was conducted, ultimately resulting in a fully trained cloud-based teacher model.
[0251] A scatter plot of the true values on the test set versus the model predictions is shown below. Figure 6 As shown. At this time The MSE is 5.90, and the R² is 0.89; The MSE is 17.59, and the R² is 0.76; The MSE is 1.37, and R² = 0.87; The MSE is 7.63, and the R² is 0.92; The MSE is 14.56, and the R² is 0.79; The MSE is 0.03 and the R² is 0.83.
[0252] pass Figure 6 The following conclusions can be drawn: Overall, the scatter distribution of the model predictions and actual values for all pollutants is close to the diagonal, indicating that the model's predictions fit the actual concentrations at national monitoring stations well, verifying the high-precision calibration capability of the dual-attention-LSTM-MLP teacher model. Looking at individual pollutants, NO2 (R²=0.92), PM2.5 (R²=0.89), and SO2 (R²=0.87) showed the best fit and lower MSE, indicating that the model can accurately capture the temporal evolution and meteorological correlation characteristics of these pollutants. PM10 (R²=0.76) and O3 (R²=0.79) had relatively low R² and relatively high MSE, mainly because these pollutants are more affected by wind speed and diffusion conditions, resulting in stronger temporal fluctuations, but overall they still maintained a high level of fit, meeting the calibration requirements of the cloud-based teacher model. CO had the lowest MSE (0.03) and a stable fit, as its concentration changes were relatively gradual, making it easy for the model to capture its variation patterns.
[0253] 2. Construction of a calibration model for an air quality monitoring device
[0254] Following the steps in step three, the observation data from an air quality monitoring device is fed into the model constructed in step two. The model's prediction results and the air quality monitoring device's observation results form a new dataset, which can be used to train an Extra Trees model. The time-series plot of the actual values on the test set versus the model's prediction results is shown below. Figure 7 As shown. At this time The MSE is 8.15, and the R² is 0.70; The MSE is 8.48, and the R² is 0.88; The MSE is 1.57, and R² = 0.77; The MSE is 15.92, and the R² is 0.75; The MSE is 13.02, and the R² is 0.72; The MSE is 0.02 and the R² is 0.79.
[0255] pass Figure 7 The data above shows that the predicted curves of the student model are highly consistent with the observed curves of the air quality monitoring equipment, and can accurately follow the temporal changes in pollutant concentrations. In particular, the occurrence times of concentration peaks and troughs are basically synchronized, which verifies the real-time calibration capability of the student model. The R² values of various pollutants are all above 0.70, and the MSE is controlled within a reasonable range. Even without reference data from national control stations, high-precision calibration can still be achieved, solving the calibration problem of remote air quality monitoring equipment without reference data.
[0256] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A multi-parameter monitoring data correction method based on a teacher-student model, characterized in that, The steps are as follows: Step 1: Obtain the time series of multivariate air pollutants related to multiple air quality monitoring devices and preprocess them to obtain multivariate time series. The multivariate time series and the normalized real concentrations of the corresponding national control stations constitute the air quality monitoring device dataset. Step 2: Construct a cloud-based teacher model. Use the dataset from the reference air quality monitoring equipment closest to the national control station to construct a supervised dataset to train the cloud-based teacher model, and use the AFSA algorithm to optimize the model parameters. Step 3: Select the multivariate time series of relatively stable periods in the air quality monitoring equipment dataset as local training samples, input the local training samples into the predicted concentration obtained by the trained cloud teacher model as the corresponding label, and train the Extra Trees student model. The AFSA algorithm was used to optimize the model parameters; the trained Extra Trees student model was used to process the time series data collected in real time by the air quality monitoring equipment to obtain the prediction results.
2. The multi-parameter monitoring data correction method based on the teacher-student model according to claim 1, characterized in that, Obtaining different atmospheric environments The monitoring data from the air quality monitoring equipment includes K-type pollutants and Q-type meteorological parameters. The collection period for the true concentration values of K-type pollutants at the national control station is D days. The monitoring data is minute-level concentration data, including original concentration data of the kth type of pollutants of the mth station at the tth time ; meteorological parameter data of the qth type of meteorological parameters of the mth station at the hth hour ; National control station hourly concentration data represents the true value of the concentration of the kth pollutant in the hth hour. wherein, , , hourly time steps 30-second level time steps ; The preprocessing implementation method includes: Time alignment: average the multiple sampling results of the air quality monitoring device within 1 hour as the hourly concentration data ; The hourly concentration data Data points beyond reasonable range are directly rejected; missing data are filled with the mean of valid data at adjacent time. The filled hourly concentration data is normalized by Min-Max normalization , meteorological parameter data , and the numerical range of the hourly concentration data of the national control station is unified to the interval [0, 1], and normalized concentration data , meteorological parameter data , and concentration data are obtained, respectively; The normalized air quality monitoring device dataset , includes a multivariate time series of the mth site, the hth hour: , a true concentration sequence of the kth pollutant, the hth hour of the national control station .
3. The multi-parameter monitoring data correction method based on a teacher-student model according to claim 1 or 2, characterized in that, The cloud-based teacher model is a dual-attention-LSTM-MLP model, which includes a parametric attention mechanism, an LSTM module, a temporal attention mechanism, and a two-layer MLP structure connected in sequence. Both the parametric attention mechanism and the temporal attention mechanism are fully connected neural networks terminated by a Softmax classification function. These networks consist of a fully connected layer I, a non-linear activation layer, a normalization layer, a fully connected layer II, and a weight normalization layer, connected sequentially. The parametric attention mechanism applies the following parameters to the training samples: The parameter attention weight matrix is obtained by processing the final hidden state output by the LSTM module through the temporal attention mechanism. The LSTM module consists of four sequentially connected deep LSTM networks; Training samples The weighted input features obtained by element-wise multiplication of the parameter attention weight matrix are input into the first layer of the LSTM network, and the final hidden state output by the fourth layer of the LSTM network is taken as the input of the time sequence attention mechanism. The final hidden state is element-wise multiplied by the time sequence attention weight matrix, and then summed along the time step dimension to obtain a context vector. The 2-layer MLP structure is used to reduce the dimension of the context vector, and the reduced features are mapped to the concentration values of K types of pollutants through the full connection layer III to obtain the normalized prediction concentration of K types of pollutants of the reference air quality monitoring device ref.
4. The multi-parameter monitoring data correction method based on the teacher-student model according to claim 3, characterized in that, The fully connected layer I maps the input low-dimensional training samples or the final hidden state to a high-dimensional feature space through a learnable weight matrix and bias terms, thereby obtaining high-dimensional features. The nonlinear activation layer adopts a Gaussian error linear operation function on high-dimensional features to perform nonlinear transformation to obtain activated features ; Normalization layer for activated features Normalization is performed to obtain the normalized high-dimensional attention features. Fully connected layer II compresses high-dimensional features into one-dimensional raw scores using learnable weight matrices, resulting in the raw score matrix. The weight normalization layer passes through Function along parameter dimension For the original score matrix Normalization is performed so that the sum of the weights of the feature parameters of the training samples at each time step is 1, thus obtaining the parametric attention weight matrix or the temporal attention weight matrix. A four-layer deep LSTM network is connected sequentially to extract and learn input training samples hierarchically. The approach to complex temporal dependencies and dynamic patterns is as follows: The first deep LSTM layer serves as the basic temporal feature extraction layer, taking weighted input features as input and outputting a 64-dimensional temporal hidden state. The second deep LSTM layer is the parameter coupling relationship deepening layer: taking the 64-dimensional temporal hidden state output from the first deep LSTM layer as input, it strengthens the nonlinear correlation learning between multiple parameters, reorganizes and deepens the temporal hidden state, and outputs a 96-dimensional temporal hidden state. The third deep LSTM layer is the long-term dependency enhancement layer: taking the 96-dimensional temporal hidden state output from the second deep LSTM layer as input, it strengthens the transmission and preservation of effective features over long periods, suppresses short-term random noise interference, and outputs a 128-dimensional temporal hidden state. The fourth deep LSTM layer is the high-quality feature output layer: taking the 128-dimensional temporal hidden state output from the third deep LSTM layer as input, it integrates and abstracts the features from the first three deep LSTM layers, outputting a well-structured and information-dense temporal feature encoding, and outputting a 128-dimensional final hidden state, which is then passed to the temporal attention mechanism. In the two-layer MLP structure, the first layer reduces the context vector to 64 dimensions and uses the Swish function as the activation function; the second layer reduces the 64-dimensional data to 32 dimensions and uses the Swish function as the activation function; the 32-dimensional features are mapped to K outputs through the fully connected layer III, and each output corresponds to the normalized predicted concentration of a class of pollutants from the reference air quality monitoring device ref.
5. The multi-parameter monitoring data correction method based on the teacher-student model according to claim 4, characterized in that, The method for constructing the supervised dataset is as follows: Using the sliding window technique, the pre-processed, clearly defined reference air quality monitoring equipment (ref) closest to the national control station is normalized into a dataset of air quality monitoring equipment. , The dataset is reconstructed to obtain a supervised dataset U; the supervised dataset is then randomly divided in a 7:3 ratio. Divided into training subsets With verification subset ;in, To reference the multivariate time series composed of the normalized concentration data of the air quality monitoring equipment at the h-th hour and meteorological parameter data, The normalized true concentration sequence of the h-th hour from the national control station; The sliding window technique is implemented as follows: window parameters are defined as follows: window length is 13; sliding step size is 1; reconstruction rule: the multivariate time series under the t1-th window is used as the training sample of the reference air quality monitoring device ref for 12 consecutive hours. ,in, For the reference air quality monitoring device ref under the t1-th window Hourly multivariate time series, For the reference air quality monitoring device ref under the t1-th window A multivariate time series of hours, where T is the transpose of a vector or matrix; the prediction target is the true concentration sequence within the t1-th window. The reconstructed supervised dataset [13,24D], where n represents the number of multivariate time series in the reference air quality monitoring device ref.
6. The multi-parameter monitoring data correction method based on a teacher-student model according to claim 4 or 5, characterized in that, The method for training a dual-attention-LSTM-MLP model using a supervised dataset and optimizing the model parameters using the AFSA algorithm is as follows: (1) Encoding of artificial fish individuals: The five hyperparameters to be optimized, including learning rate, MLP Dropout, LSTM Dropout, maximum number of training iterations of LSTM, and number of hidden units of LSTM, are mapped to the position vector of artificial fish individuals, and each position component corresponds to the value of a hyperparameter; (2) Foraging behavior: A new location is randomly generated within the foraging radius of the current location of each artificial fish individual, and the fitness value of the new location is calculated by the fitness function; if the fitness value of the new location is better than the fitness value of the current artificial fish individual, the current artificial fish individual moves to the new location. Otherwise, if a new position is randomly generated repeatedly and no better position is found, the current position is kept unchanged. (3) Grouping behavior: Calculate the number of other artificial fish within the foraging radius of each artificial fish individual and the average fitness value; If the average fitness value of the surrounding artificial fish is better than the fitness value of the current artificial fish, and the crowding is less than a preset threshold, then the current artificial fish moves to the average position of the surrounding artificial fish; if the crowding is too high, then it returns to foraging behavior. (4) Chasing behavior: Find the artificial fish individual with the best fitness value in the current fish group; for each artificial fish individual, calculate the distance between itself and the best individual. If the distance is within the foraging radius and the fitness value of the best individual is better than that of the current artificial fish individual, then the current artificial fish individual moves a certain distance towards the best individual; otherwise, perform foraging behavior. (5) Random behavior: If an artificial fish fails to find a better location after foraging, gathering, and tail chasing behaviors, it will perform random behavior and randomly generate a new location. (6) Iterative update and termination: Each time all artificial fish complete the foraging → swarming → tail chasing → random behavior, it is considered as one round of iteration; update the optimal fitness value of the fish group and the corresponding hyperparameter combination. If the current optimal fitness value does not decrease for 5 consecutive rounds, or reaches the preset maximum number of iterations, then terminate the optimization process and output the final optimal hyperparameter combination.
7. The multi-parameter monitoring data correction method based on the teacher-student model according to claim 6, characterized in that, The method for selecting multivariate time series data from relatively stable periods in the air quality monitoring equipment dataset as local training samples is as follows: 1) Single-site multi-pollutant cusum change point detection: For the m-th site, a joint bias cumulative model is constructed by integrating K types of pollutants to capture the concentration change of any pollutant; 2) Multi-site change point consensus verification: Find the change point moments that multiple air quality monitoring equipment points experience together, and determine the stable background period; 3) Determine the background time period based on the stable background time period to obtain the background time period dataset for each air quality monitoring device.
8. The multi-parameter monitoring data correction method based on the teacher-student model according to claim 7, characterized in that, The method for constructing a joint deviation accumulation model to capture sudden changes in the concentration of any pollutant is as follows: A reference vector is constructed based on the normalized concentration data of each air quality monitoring device for the first hour; the deviation vector between the normalized concentration of pollutant type K at the m-th station and the corresponding reference vector at the h-th hour is calculated. Then the weighted joint bias , The weight vector is used; the bias is jointly determined using the Cusum algorithm. Accumulate weights to obtain the cumulative sum at step t; set control limits. When the cumulative sum value at step t is Determine the m-th station and the h-th hour as change points, and record the set of change points. Where m_change is the number of change points at the m-th station; The step of determining the stable background period is as follows: collect the set of change points from all air quality monitoring devices. Iterate through each variable point as a candidate variable point. Set time window For any candidate variable moment Statistics fall within the time window The number of variable points within the range, count_hold; let the consensus threshold be threshold = If the number of points changes Then determine the candidate turning point time. For global variables, we can obtain the set of global variables. Where ALL_change is the number of global change points; The method for determining the background time period is as follows: calculating the global change point set. The time interval between adjacent global change points Select time interval The longest time interval is selected as the candidate background segment; if there are two or more candidate background segments with equal time intervals, the weighted joint deviation mean of all air quality monitoring devices within each candidate background segment is calculated. Select the weighted joint bias mean within the candidate background segment and The smallest time period is used as the background time period; the background time period dataset for the m-th site. ;in, This refers to the current time period.
9. The multi-parameter monitoring data correction method based on a teacher-student model according to claim 7 or 8, characterized in that, The background time period dataset of the m-th site Multivariate time series Substituting the local training samples into the trained dual-attention LSTM-MLP model yields the predicted concentrations of pollutants of class K, denoted as labels. , For the m-th site, the k-th type of pollutant, the... Predicted concentration for one hour; Background time period dataset Multivariate time series Labels output by the cloud-based teacher model Aligning by time steps, construct the training dataset for the Extra Trees student model. The training dataset T is randomly divided into training subsets in a 7:3 ratio. With verification subset .
10. The multi-parameter monitoring data correction method based on the teacher-student model according to claim 9, characterized in that, The fitness function of the dual-attention-LSTM-MLP model during training is the validation subset. Mean square error ;in, To verify subset The number of samples, It is the L2 norm. It is a verification subset The predicted values of the validation samples, It verifies the true value of the sample; The dual-attention LSTM-MLP model uses a training subset during training. Mean square error As a loss function, and: ;in, For training subset The number of samples, These are the predicted values from the training samples. These are the true values of the training samples; The cumulative weighted update formula is: the cumulative sum at step t. , where the initial value , Let be the cumulative sum at step t-1; The time interval ; The weighted joint bias mean of the current candidate background segment ;in, The total number of hourly time steps within the candidate background segment, where seg represents the current candidate background segment and the corresponding hourly time step interval; The AFSA algorithm is used to globally optimize the hyperparameters of the Extra Trees student model, including the number of decision trees and the maximum depth of a single decision tree. The core parameters of the AFSA algorithm from step two are used, only adjusting the encoding dimension of the artificial fish individuals to 2-dimensional. This is done to validate the subset. Mean square error As the fitness function, the loss function of the Extra Trees student model uses the mean squared error of the Extra Trees student model.
Citation Information
Patent Citations
Ambient air quality monitoring micro-station data correction system and method
CN118095080A
Atmospheric pollutant sensor data calibration method suitable for being deployed at embedded terminal
CN119643787A
Air quality monitoring platform operation maintenance management method and system based on Internet of Things
CN120181833A