Pesticide production parameter-based pollution early warning method and system
By using information entropy and temporal cross-correlation analysis to filter and align pesticide production data, the problems of inaccurate feature selection and delayed detection in existing pollution early warning models are solved, achieving a more efficient pollution early warning effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOUTH CHINA INST OF ENVIRONMENTAL SCI MEP
- Filing Date
- 2026-04-21
- Publication Date
- 2026-07-31
AI Technical Summary
Existing attention-based pesticide production pollution early warning methods fail to distinguish and filter out driving features strongly correlated with pollution events during the calculation process. They are easily affected by redundant or noisy data streams and cannot detect or model the time delay relationship between parameter changes and pollutant emissions, thus affecting the accuracy and lead time of the early warning.
By acquiring multi-source time-series data from the pesticide production process, key features are selected using information entropy and temporal cross-correlation analysis. Temporal alignment and iterative weight allocation are then performed to generate context vectors that are input into a fully connected layer for pollution early warning.
It improves the accuracy and reliability of early warning of future pollution events, suppresses the interference of redundant and noisy data, detects the inherent time delay relationship between feature sequences, and improves the performance of the early warning model.
Smart Images

Figure CN122493624A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of early warning, and in particular relates to a pollution early warning method and system based on pesticide production parameters. Background Technology
[0002] The pesticide production process involves chemical reactions and technological flows, generating various pollutants such as wastewater, waste gas, and waste residue. Pesticide production companies accumulate process control data and plant environmental monitoring data. Deep learning models with attention mechanisms at their core can be used to process industrial time-series data and predict pollution events. Attention mechanisms, by calculating the correlation weights between different features, can detect long-distance dependencies in sequential data, improving the performance of predictive models. However, when applied to pesticide production scenarios, existing attention-based early warning methods, especially standard attention models, fail to distinguish and filter driving features strongly correlated with pollution events during the calculation process. This makes them susceptible to interference from redundant or noisy data streams, leading to a scattered focus of the model. The impact of parameter changes in different production processes on pollutant emissions has a time delay, and attention mechanisms lack explicit time-series alignment capabilities, failing to detect and model the lag in such causal relationships over time. Simple weighted summation and fusion methods are insufficient to express the synergistic effects between key features, limiting the model's insight into system state changes before pollution events occur, thus affecting the accuracy and lead time of early warnings. Summary of the Invention
[0003] To address the aforementioned technical problems, this invention provides a pollution early warning method and system based on pesticide production parameters, which solves the technical problems in the prior art.
[0004] In a first aspect, the present invention provides the following technical solution: a pollution early warning method based on pesticide production parameters, comprising: Multi-source time-series data from the pesticide production process is acquired, including production parameter data and environmental monitoring data. The multi-source time-series data is then processed into an input feature sequence. By applying three different linear mappings to the input feature sequence, a query sequence, a set of key sequences, and a set of value sequences are generated, respectively. For each key sequence in the key sequence set, the information entropy of the sequence within a preset time window is calculated, and an entropy-controlled similarity score is generated based on the mean of the dot product similarity between the key sequence and the query sequence and the information entropy; all key sequences are sorted in descending order based on the entropy-controlled similarity score, and a preset proportion of key sequences and their corresponding value sequences are selected to form a candidate key-value pair set. Initialize the route logarithm prior for each candidate key sequence in the candidate key-value pair set; execute the routing process within a preset number of iterations to obtain the route association coefficient; Each candidate value sequence is time-aligned according to the time offset determined by the corresponding key sequence; all aligned candidate value sequences are weighted and summed using the routing correlation coefficient to form a context vector; the context vector is flattened and then input into a pollution early warning model composed of fully connected layers to obtain an early warning signal representing the probability of pollution events occurring within a specific future time window.
[0005] Secondly, the present invention provides the following technical solution: a pollution early warning system based on pesticide production parameters, comprising the following modules: The mapping module is used to acquire multi-source time-series data from the pesticide production process, including production parameter data and environmental monitoring data, and to process the multi-source time-series data into an input feature sequence. By applying three different linear mappings to the input feature sequence, a query sequence, a set of key sequences, and a set of value sequences are generated respectively. The filtering module is used to calculate the information entropy of each key sequence in the key sequence set within a preset time window, and generate an entropy-controlled similarity score based on the mean of the dot product similarity between the key sequence and the query sequence and the information entropy; sort all key sequences in descending order based on the entropy-controlled similarity score, and filter out a preset proportion of key sequences and their corresponding value sequences to form a candidate key-value pair set. An initialization module is used to initialize the routing logarithm prior corresponding to each candidate key sequence in the candidate key-value pair set; and to execute the routing process within a preset number of iterations to obtain the routing correlation coefficient. The processing module is used to perform time-series alignment processing on each candidate value sequence according to the time offset determined by the corresponding key sequence; to perform weighted summation on all aligned candidate value sequences using the routing correlation coefficient, and to fuse them into a context vector; after flattening the context vector, it is input into a pollution early warning model composed of fully connected layers to obtain an early warning signal representing the probability of pollution events occurring within a specific future time window.
[0006] This invention utilizes information entropy to measure and filter the correlation between production parameters and environmental monitoring data, suppressing interference from redundant and noisy data. It employs time-series cross-correlation analysis to uncover the inherent time delay relationships between different feature sequences and performs time-series alignment, addressing the problem of insufficient model correlation capabilities. Through an iterative weight allocation mechanism, the aligned features are fused, fully extracting the deep-level correlations between multi-source data, improving the accuracy and reliability of early warnings for future pollution events, and providing strong technical support for environmental risk management in pesticide production processes. Attached Figure Description
[0007] Figure 1 This is a schematic diagram of the hardware device; Figure 2 A flowchart for a pollution early warning method based on pesticide production parameters; Figure 3 This is a schematic diagram of the overall architecture. Detailed Implementation
[0008] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0009] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0010] Reference Figure 1 , Figure 1 This is a hardware device diagram of an embodiment of the present invention. The embodiment of the present invention proposes a pollution early warning method based on pesticide production parameters, referring to... Figure 2 ,include: S1, acquire multi-source time-series data of the pesticide production process, the multi-source time-series data includes production parameter data and environmental monitoring data, and process the multi-source time-series data into an input feature sequence; by applying three different linear mappings to the input feature sequence, a query sequence, a set of key sequences and a set of value sequences are generated respectively; Production parameter data, such as reactor temperature, pipeline pressure, and material flow rate, and environmental monitoring data, such as wastewater COD, ammonia nitrogen, and pH, are read from the databases or historical data files of the Distributed Control System (DCS), Manufacturing Execution System (MES), and Environmental Management System (EMS), indexed by timestamps. For data with different sampling frequencies, the `resample` function in the Pandas library is used for resampling to unify the time granularity to the minute level, and the `merge_asof` function is used for time alignment. After alignment, the KNNImputer algorithm from the `impute` module of the scikit-learn library is used to impute missing values in the data. All numerical features are normalized to the range of 0 to 1. A sliding window method is used to construct samples, setting the window length to T and the step size to 1. Data from T consecutive time points are used to construct an input sample, where the sample dimension is T multiplied by the number of features. Three fully connected layers with different weight parameters and bias terms are initialized. In the PyTorch deep learning framework, this is the torch.nn.Linear module. The processed input feature sequence is input into the three fully connected layers respectively. After matrix multiplication and bias addition, the outputs are a query sequence Q, a set of key sequences K, and a set of value sequences V with the same dimension but different content.
[0011] As an optional implementation, processing the multi-source time-series data into an input feature sequence includes: Missing values are filled in for the acquired production parameter data and environmental monitoring data; min-max normalization is performed on all data sequences to scale the data values to a preset range; the normalized production parameter data sequence and environmental monitoring data sequence are concatenated based on timestamp alignment to obtain a multi-dimensional input feature sequence.
[0012] Missing values were checked in the acquired time-series data for each dimension. For any missing values found, linear interpolation was used to fill them in, ensuring the continuity of the data sequence. Min-max normalization was applied to all data sequences to uniformly scale the numerical range to a preset interval of [0,1], using the following formula: ,in and These are the minimum and maximum values of the data sequence on the training set. After normalization, the production parameter data vector and the environmental monitoring data vector with the same timestamp are concatenated. For example, if there are 15 production parameters and 5 environmental monitoring parameters, then at each timestamp, the 15-dimensional production parameter vector is concatenated with the 5-dimensional environmental monitoring vector to obtain a 20-dimensional feature vector, thus forming a multi-dimensional input feature sequence.
[0013] S2, for each key sequence in the key sequence set, calculate the information entropy of the sequence within a preset time window, and generate an entropy-controlled similarity score based on the mean of the dot product similarity between the key sequence and the query sequence and the information entropy; sort all key sequences in descending order based on the entropy-controlled similarity score, and select a preset proportion of key sequences and their corresponding value sequences to form a candidate key-value pair set; Iterate through each key sequence in the key sequence set. .for The histogram function from the NumPy library is used to discretize the continuous values of the sequence within a time window into B bins. The frequency of occurrence of each bin is calculated as a probability estimate. Based on the Shannon entropy formula, the information entropy is calculated using the log2 function from the NumPy library. The formula is the sum of the probabilities of all terms that are negative, multiplied by their logarithmic probabilities. Calculate the query sequence Q and the key sequence... The dot product of the transposes of the matrix yields a similarity matrix. The mean dot product similarity is then calculated by averaging all elements of this matrix. Set weighting coefficients. , Through formula Calculate the entropy-controlled similarity score, where This is the maximum possible entropy. The entropy-controlled similarity scores and indices of all key sequences are stored in a list. The sequences are sorted in descending order of their scores, and the top 10% of key sequences and their corresponding indices in the original set of value sequences are selected to obtain a candidate key-value pair set.
[0014] As an optional implementation, for each key sequence in the key sequence set, the information entropy of the sequence within a preset time window is calculated, and an entropy-controlled similarity score is generated based on the mean of the dot product similarity between the key sequence and the query sequence and the information entropy, including: Divide the data points of each key sequence within a preset time window into multiple equal-width intervals, and count the frequency of data points in each interval; The information entropy of the key sequence is calculated by summing the product of the frequency of each data point in each interval with the negative logarithm of that frequency (base 2). ; Calculate the dot product similarity matrix between the key sequence and the query sequence, and obtain the scalar similarity by averaging all elements of the dot product similarity matrix. ; Through formula The entropy-controlled similarity score was obtained, where, These are the weighting coefficients. The ideal information entropy is preset.
[0015] The scalar similarity is multiplied by a preset weight coefficient, and the information entropy is multiplied by the difference between 1 and the preset weight coefficient. The result of the multiplication of the scalar similarity is then subtracted from the result of the multiplication of the information entropy to obtain the entropy-controlled similarity score of the key sequence.
[0016] For any key sequence with a time window length of T Determine the range of the sequence data values. The range is then divided into B equally wide intervals, where B is a hyperparameter, preferably within the range [10, 50], for example, B = 32. Statistics. Falling into each interval The number of data points j=1,...,B Calculate frequency The information entropy of this key sequence Then, the entropy can be calculated using the Shannon entropy formula: For dot product similarity, assume the dimension of the query sequence Q is... Key sequence The dimension is Calculate the dot product similarity matrix between the two. , dimension Scalar similarity The arithmetic mean of all elements in matrix M is obtained as follows: Preset weighting coefficients The preferred range is [0.6, 0.9], for example, it can be set to Optionally, for multidimensional features, the entire sequence can be flattened and binned, or the information entropy of the multidimensional sequence can be calculated dimension by dimension.
[0017] S3, initialize the routing logarithm prior corresponding to each candidate key sequence in the candidate key-value pair set; execute the routing process within a preset number of iterations to obtain the routing correlation coefficient; Use the `torch.zeros` function to create a one-dimensional tensor of the same length as the number of candidate key sequences, as a prior for all route logarithms. Initialize all values to zero. Set the iteration count R to 3 and enter the for loop. In each iteration, use the torch.nn.functional.softmax function to calculate the current route logarithm prior tensor. Perform calculations to obtain the current routing correlation coefficient tensor. For each candidate key sequence The `correlate` function of the `signal` module in the SciPy library is called to calculate the time-series cross-correlation between the sequence and the query sequence Q. The mode is set to `full`. The `argmax` function of the NumPy library is used to find the index of the maximum value in the cross-correlation result sequence. The time offset is obtained by subtracting the sequence length minus one from this index. Use the roll function from the NumPy library to roll each candidate key sequence. According to the corresponding time offset Perform a cyclic shift to achieve temporal alignment, resulting in an aligned candidate key sequence. ; route correlation coefficient Dimension expansion is performed so that the coefficients can be broadcast multiplied with the aligned candidate key sequence set, and the weighted coefficients are then multiplied. Summing along the candidate key sequence dimension yields the global feature sequence G; for each aligned candidate key sequence... The sum of the element-wise products of the key sequence and the global feature sequence G, i.e., the inner product, is calculated, and the result is divided by the sequence length to obtain the protocol score. ; Logarithmic prior of the route With agreement score Perform element-wise addition and update the route logarithm prior. After looping R times, exit the loop and use the torch.nn.functional.softmax function again to perform a priori analysis on the route logarithm. Calculations are performed to obtain the routing correlation coefficient. .
[0018] As an optional implementation, the step of performing the routing process within a preset number of iterations to obtain the routing correlation coefficient specifically involves: In each iteration, the current route association coefficient is calculated by performing the Softmax function on all route log priors; The time offset corresponding to the maximum correlation coefficient is determined by calculating the time cross-correlation function between the query sequence and each candidate key sequence; After aligning each candidate key sequence according to the time offset corresponding to the sequence, the global feature sequence is obtained by weighted summation of all aligned candidate key sequences using the current routing correlation coefficient. The inner product of each aligned candidate key sequence and the global feature sequence is calculated and the average is taken as the protocol score. Update the route logarithmic prior using the aforementioned protocol score; After the iteration is completed, the route correlation coefficient is calculated by using the Softmax function based on the route logarithm prior.
[0019] As an optional implementation, the step of determining the time offset corresponding to the maximum correlation coefficient by calculating the temporal cross-correlation function between the query sequence and each candidate key sequence includes: Within the preset time delay range, the time-series cross-correlation function of the query sequence and each candidate key sequence is calculated by summing the products of the query sequence and each candidate key sequence under different time delays. Find the maximum value among all calculated time-series cross-correlation function values; The delay corresponding to the maximum value is determined as the time offset of the candidate key sequence.
[0020] To determine candidate key sequences Relative to the optimal time alignment of the query sequence Q, within a preset time delay range Internally calculate the time-series cross-correlation function of the two. This range is set based on process experience; for example, if the data sampling frequency is once per minute, it can be set to... This involves searching for the optimal latency within a 30-minute range before and after the target latency. For each latency... The cross-correlation value is calculated as follows: , where t is the time step. Calculate all value corresponding Then, find the maximum value among them. The delay corresponding to this maximum value. ,Right now , determined as candidate key sequence The time offset.
[0021] As an optional implementation, updating the route logarithmic prior using the protocol score includes: Calculate the inner product of each aligned candidate key sequence and the global feature sequence, and average all elements of the inner product result to obtain the protocol score in scalar form; The updated route logarithmic prior is obtained by adding the current iteration's route logarithmic prior to the calculated protocol score.
[0022] In the r-th iteration of the routing, the candidate key sequences are... Based on time offset Alignment Use the current route correlation coefficient to analyze all... Weighted summation yields the global feature sequence G. Calculate each... Protocol score with G This calculation is performed by taking the inner product point by point and then averaging the results: Obtain the scalar protocol score. Then, update the route logarithmic prior. Let the prior number of route logs at the beginning of the r-th iteration be . Then the updated route has a priori logarithm. for: Before the first iteration, all routes are logarithmic priors. All are initialized to 0.
[0023] S4, perform time-series alignment processing on each candidate value sequence according to the time offset determined by the corresponding key sequence; use the routing correlation coefficient to perform weighted summation on all aligned candidate value sequences and merge them into a context vector; after flattening the context vector, input it into a pollution early warning model composed of fully connected layers to obtain an early warning signal representing the probability of pollution events occurring within a specific future time window.
[0024] Each value sequence in the candidate value sequence set The value sequence corresponds to the key sequence. Determined time offset Similarly, the roll function from the NumPy library is used for timing alignment to obtain the aligned candidate value sequence. The routing correlation coefficient To expand the dimensions, use the torch.sum function. Weighted Summing is performed along the candidate value sequence dimension to obtain the fused context vector C. The `torch.flatten` function in PyTorch is called to convert the two-dimensional context vector C into a one-dimensional vector. A pollution warning model is constructed using the `torch.nn.Sequential` container, containing two `torch.nn.Linear` fully connected layers, one `torch.nn.ReLU` activation function, and one output layer. The output layer is a single-neuron `torch.nn.Linear` layer connected to a `torch.nn.Sigmoid` activation function. The flattened one-dimensional context vector is input into the model. After layer-by-layer forward propagation, the Sigmoid activation function outputs a floating-point number between 0 and 1. This value represents the probability of a pollution event occurring within a specific future time window. When this probability exceeds a preset threshold, such as 0.8, a warning signal is issued. Figure 3 It is output through the application layer.
[0025] As an optional implementation, the step of using the routing correlation coefficient to perform a weighted summation of all aligned candidate value sequences and fusing them into a context vector includes: The context vector is obtained by multiplying each aligned candidate value sequence by the routing correlation coefficient corresponding to the sequence and summing all the product results.
[0026] After the routing process iteration is completed, the routing correlation coefficient is obtained. Set. For each candidate value sequence According to the key sequence corresponding to the sequence Determined time offset Perform the same timing alignment process to obtain the aligned value sequence. Assuming each It is a dimension of The matrix, where T is the sequence length. Let C be the dimension of the value vector. The context vector C is also... A matrix of dimension 1, calculated as a weighted sum of all aligned sequences of values: , where i iterates through all candidate key-value pairs. Multiplication is a scalar. With matrix scalar multiplication, addition is matrix addition.
[0027] As an optional implementation, the input is fed into a pollution early warning model composed of fully connected layers to obtain an early warning signal representing the probability of pollution events occurring within a specific future time window, including: Flatten the context vector into a one-dimensional vector according to a preset order; The one-dimensional vector is input into a first fully connected layer containing a preset number of neurons and a preset activation function; The output of the first fully connected layer is input into an output layer containing a single neuron and a sigmoid activation function to obtain the warning signal.
[0028] Dimension is The context vector C is flattened, for example, by row-major order, and transformed into a dimensionless vector. A one-dimensional vector. Assume T=120, representing data from the past 2 hours. After flattening, a 7680-dimensional vector is obtained. This vector is then input into the pollution early warning model. The model consists of two fully connected layers: the first layer contains N neurons, with N preferably in the range of [128, 512], for example, N=256, and the activation function is a modified linear unit; the second layer contains one neuron, and the activation function is the Sigmoid function. The Sigmoid function compresses the output value to the (0,1) interval, and this output value is the early warning signal, representing the probability of a pollution event occurring within a specific future time window.
[0029] The pollution early warning model is preferably a fully connected neural network, with the input being a data structure of dimension [missing information]. The context vector C is flattened to obtain a one-dimensional vector x. The network structure consists of a hidden layer and an output layer. The hidden layer contains N neurons, and the weight matrix is... The bias vector is And using the modified linear unit ReLU as the activation function, the formula for calculating the output h is: The output layer contains one neuron with weights of 1. , bias is And using the Sigmoid function as the activation function, the formula for calculating the output y is: ,in The output is a scalar value y between 0 and 1, representing the probability of a pollution event occurring within a specific future time window.
[0030] The implementation of this early warning method begins with the preprocessing of multi-source time-series data. For 15 production parameters (temperature, pressure, flow rate) collected by sensors on the pesticide production line, and 5 environmental parameters (VOCs, SO2, PM2.5) collected by environmental monitoring points in the plant area, linear interpolation is used to fill in occasional missing values during data transmission or collection. To eliminate dimensional differences between different parameters, all 20 parameter sequences are min-max normalized, scaling the sequence values uniformly to the [0,1] interval. Based on strict timestamp alignment, the normalized production parameters and environmental monitoring parameters are concatenated at each time point to obtain a time series containing 20 feature dimensions, which serves as the input feature. After linear transformation, this sequence generates a query sequence Q, a key sequence K, and a value sequence V for attention calculation.
[0031] In the feature selection stage, an entropy-controlled similarity scoring mechanism is used to evaluate and filter features rich in information. For each key sequence, information entropy is calculated on the data distribution within the time window. This is achieved by dividing the numerical range into 32 equally wide intervals and statistically analyzing their frequencies. Information entropy represents the inherent uncertainty of the feature. Simultaneously, the mean dot product similarity between the key sequence and the query sequence is calculated, representing the correlation with the current query state. A weighted formula is used to combine the similarity with an entropy-controlled penalty term constructed based on the information entropy to obtain an entropy-controlled similarity score. This score tends to select features that are highly relevant to the query and are not overly chaotic or flat. Based on the scores, the top 30% of key sequences and their corresponding value sequences are selected to form a candidate set.
[0032] The selected candidate features enter the route alignment and fusion stage. The core of this stage is to find an optimal time offset for each candidate feature and determine the weight of that offset's contribution to the result. By calculating the temporal cross-correlation function between the query sequence and each candidate key sequence within a delay range of [-30, +30] minutes, the delay corresponding to the maximum correlation coefficient is used as the time offset for that key sequence. In a routing process comprising three iterations, the routing weights of each key sequence are iteratively adjusted according to the protocol between the aligned key sequence and an updated global feature. After the iterations, the determined routing weights are used to perform a weighted summation of the value sequences aligned according to the corresponding time offsets, thereby fusing them into a context vector.
[0033] For example, a context vector of dimension (120, 64) is flattened into a 7680-dimensional vector and input into a fully connected network consisting of a hidden layer with 256 ReLU neurons and an output layer with 1 Sigmoid neuron. This network is a pollution warning model. The input to this model is the flattened one-dimensional vector x, and the network structure involves linear transformation and activation through a hidden layer. The calculation formula is as follows: The warning signal is calculated through the output layer, and the calculation formula is as follows: Output a value y between 0 and 1, which is the probability warning signal of a pollution event occurring within the next hour.
[0034] To verify the effectiveness of key modules in the scheme, verification experiments were conducted on this invention. The dataset used was real production and environmental monitoring data from a pesticide chemical company for one year, containing 35,040 time points, with a sampling frequency of once every 15 minutes. The data was divided into training, validation, and test sets in a 7:1.5:1.5 ratio. The early warning task was to predict whether the concentration of volatile organic compounds exceeded the standard one hour in advance. All experiments used the same preprocessing method and downstream fully connected early warning model, and maintained consistent hyperparameters such as a time window length of 120, a weight coefficient of 0.7, a maximum latency of 30, and 3 routing iterations. Two control groups were set up: control group A removed the entropy control mechanism and used only dot product similarity for feature selection; control group B removed the temporal alignment and routing modules and used a standard self-attention mechanism for feature fusion.
[0035] The specific experimental data are as follows: The complete model proposed in this application performed best on the test set, achieving an accuracy of 96.3%, precision of 89.1%, recall of 91.3%, and an F1 score of 0.902. Control group A, the model that only used dot product similarity for filtering, achieved an accuracy of 94.5%, precision of 86.5%, recall of 87.7%, and an F1 score of 0.871. Control group B, the model using the standard self-attention mechanism, had the lowest performance across all metrics, with an accuracy of 92.1%, precision of 84.2%, recall of 82.8%, and an F1 score of 0.835. The data shows that the use of each module improved performance.
[0036] Compared to the complete model and control group A, the F1 score improved by 3.1 percentage points, demonstrating the effectiveness of the entropy-controlled similarity scoring mechanism. This mechanism not only combines the relevance between features and queries but also represents the information content of the features themselves, avoiding the selection of ineffective features that are too stable or full of random noise, thus filtering out more representative candidate sequences. Compared to control group A and control group B, the F1 score improved by 3.6 percentage points, illustrating the superiority of the temporal alignment and routing modules. Temporal cross-correlation alignment can detect the inter-variable delay effects existing in industrial processes, while routing, through iterative updates of protocol scores, achieves weight allocation and feature fusion, generating a context vector with stronger information representation capabilities, thus improving the performance of the early warning model.
[0037] This invention also proposes a pollution early warning system based on pesticide production parameters, comprising the following modules: The mapping module is used to acquire multi-source time-series data from the pesticide production process, including production parameter data and environmental monitoring data, and to process the multi-source time-series data into an input feature sequence. By applying three different linear mappings to the input feature sequence, a query sequence, a set of key sequences, and a set of value sequences are generated respectively. The filtering module is used to calculate the information entropy of each key sequence in the key sequence set within a preset time window, and generate an entropy-controlled similarity score based on the mean of the dot product similarity between the key sequence and the query sequence and the information entropy; sort all key sequences in descending order based on the entropy-controlled similarity score, and filter out a preset proportion of key sequences and their corresponding value sequences to form a candidate key-value pair set. An initialization module is used to initialize the routing logarithm prior corresponding to each candidate key sequence in the candidate key-value pair set; and to execute the routing process within a preset number of iterations to obtain the routing correlation coefficient. The processing module is used to perform time-series alignment processing on each candidate value sequence according to the time offset determined by the corresponding key sequence; to perform weighted summation on all aligned candidate value sequences using the routing correlation coefficient, and to fuse them into a context vector; after flattening the context vector, it is input into a pollution early warning model composed of fully connected layers to obtain an early warning signal representing the probability of pollution events occurring within a specific future time window.
[0038] As an optional implementation, the step of performing the routing process within a preset number of iterations to obtain the routing correlation coefficient specifically involves: In each iteration, the current route association coefficient is calculated by performing the Softmax function on all route log priors; The time offset corresponding to the maximum correlation coefficient is determined by calculating the time cross-correlation function between the query sequence and each candidate key sequence; After aligning each candidate key sequence according to the time offset corresponding to the sequence, the global feature sequence is obtained by weighted summation of all aligned candidate key sequences using the current routing correlation coefficient. The inner product of each aligned candidate key sequence and the global feature sequence is calculated and the average is taken as the protocol score. Update the route logarithmic prior using the aforementioned protocol score; After the iteration is completed, the route correlation coefficient is calculated by using the Softmax function based on the route logarithm prior.
[0039] As an optional implementation, for each key sequence in the key sequence set, the information entropy of the sequence within a preset time window is calculated, and an entropy-controlled similarity score is generated based on the mean of the dot product similarity between the key sequence and the query sequence and the information entropy, including: Divide the data points of each key sequence within a preset time window into multiple equal-width intervals, and count the frequency of data points in each interval; The information entropy of the key sequence is calculated by summing the product of the frequency of each data point in each interval with the negative logarithm of that frequency (base 2). ; Calculate the dot product similarity matrix between the key sequence and the query sequence, and obtain the scalar similarity by averaging all elements of the dot product similarity matrix. ; Through formula The entropy-controlled similarity score was obtained, where, These are the weighting coefficients. The ideal information entropy is preset.
[0040] As an optional implementation, processing the multi-source time-series data into an input feature sequence includes: Missing values are filled in for the acquired production parameter data and environmental monitoring data; min-max normalization is performed on all data sequences to scale the data values to a preset range; the normalized production parameter data sequence and environmental monitoring data sequence are concatenated based on timestamp alignment to obtain a multi-dimensional input feature sequence.
[0041] As an optional implementation, the step of determining the time offset corresponding to the maximum correlation coefficient by calculating the temporal cross-correlation function between the query sequence and each candidate key sequence includes: Within the preset time delay range, the time-series cross-correlation function of the query sequence and each candidate key sequence is calculated by summing the products of the query sequence and each candidate key sequence under different time delays. Find the maximum value among all calculated time-series cross-correlation function values; The delay corresponding to the maximum value is determined as the time offset of the candidate key sequence.
[0042] As an optional implementation, updating the route logarithmic prior using the protocol score includes: Calculate the inner product of each aligned candidate key sequence and the global feature sequence, and average all elements of the inner product result to obtain the protocol score in scalar form; The updated route logarithmic prior is obtained by adding the current iteration's route logarithmic prior to the calculated protocol score.
[0043] As an optional implementation, the step of using the routing correlation coefficient to perform a weighted summation of all aligned candidate value sequences and fusing them into a context vector includes: The context vector is obtained by multiplying each aligned candidate value sequence by the routing correlation coefficient corresponding to the sequence and summing all the product results.
[0044] As an optional implementation, the input is fed into a pollution early warning model composed of fully connected layers to obtain an early warning signal representing the probability of pollution events occurring within a specific future time window, including: Flatten the context vector into a one-dimensional vector according to a preset order; The one-dimensional vector is input into a first fully connected layer containing a preset number of neurons and a preset activation function; The output of the first fully connected layer is input into an output layer containing a single neuron and a sigmoid activation function to obtain the warning signal.
[0045] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0046] The functional modules shown in the above-described block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0047] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0048] The aspects of this application have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0049] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A pollution early warning method based on pesticide production parameters, characterized in that, include: Multi-source time-series data from the pesticide production process is acquired, including production parameter data and environmental monitoring data. The multi-source time-series data is then processed into an input feature sequence. By applying three different linear mappings to the input feature sequence, a query sequence, a set of key sequences, and a set of value sequences are generated, respectively. For each key sequence in the key sequence set, the information entropy of the sequence within a preset time window is calculated, and an entropy-controlled similarity score is generated based on the mean of the dot product similarity between the key sequence and the query sequence and the information entropy; all key sequences are sorted in descending order based on the entropy-controlled similarity score, and a preset proportion of key sequences and their corresponding value sequences are selected to form a candidate key-value pair set. Initialize the route logarithm prior for each candidate key sequence in the candidate key-value pair set; execute the routing process within a preset number of iterations to obtain the route association coefficient; Each candidate value sequence is time-aligned according to the time offset determined by the corresponding key sequence. The routing correlation coefficient is used to perform a weighted summation of all aligned candidate value sequences to form a context vector. After flattening the context vector, it is input into a pollution early warning model composed of fully connected layers to obtain an early warning signal representing the probability of pollution events occurring within a specific future time window.
2. The method according to claim 1, characterized in that, The process of performing the routing procedure within a preset number of iterations to obtain the routing correlation coefficient is as follows: In each iteration, the current route association coefficient is calculated by performing the Softmax function on all route log priors; The time offset corresponding to the maximum correlation coefficient is determined by calculating the time cross-correlation function between the query sequence and each candidate key sequence; After aligning each candidate key sequence according to the time offset corresponding to the sequence, the global feature sequence is obtained by weighted summation of all aligned candidate key sequences using the current routing correlation coefficient. The inner product of each aligned candidate key sequence and the global feature sequence is calculated and the average is taken as the protocol score. Update the route logarithmic prior using the aforementioned protocol score; After the iteration is completed, the route correlation coefficient is calculated by using the Softmax function based on the route logarithm prior.
3. The method according to claim 1, characterized in that, For each key sequence in the key sequence set, the information entropy of the sequence within a preset time window is calculated, and an entropy-controlled similarity score is generated based on the mean of the dot product similarity between the key sequence and the query sequence and the information entropy, including: Divide the data points of each key sequence within a preset time window into multiple equal-width intervals, and count the frequency of data points in each interval; The information entropy of the key sequence is calculated by summing the product of the frequency of each data point in each interval with the negative logarithm of that frequency (base 2). ; Calculate the dot product similarity matrix between the key sequence and the query sequence, and obtain the scalar similarity by averaging all elements of the dot product similarity matrix. ; Through formula The entropy-controlled similarity score was obtained, where, These are the weighting coefficients. The ideal information entropy is preset.
4. The method according to claim 1, characterized in that, The step of processing the multi-source time-series data into an input feature sequence includes: Missing values are filled in for the acquired production parameter data and environmental monitoring data; min-max normalization is performed on all data sequences to scale the data values to a preset range; the normalized production parameter data sequence and environmental monitoring data sequence are concatenated based on timestamp alignment to obtain a multi-dimensional input feature sequence.
5. The method according to claim 2, characterized in that, The step of determining the time offset corresponding to the maximum correlation coefficient by calculating the temporal cross-correlation function between the query sequence and each candidate key sequence includes: Within the preset time delay range, the time-series cross-correlation function of the query sequence and each candidate key sequence is calculated by summing the products of the query sequence and each candidate key sequence under different time delays. Find the maximum value among all calculated time-series cross-correlation function values; The delay corresponding to the maximum value is determined as the time offset of the candidate key sequence.
6. The method according to claim 2, characterized in that, The step of updating the route logarithmic prior using the protocol score includes: Calculate the inner product of each aligned candidate key sequence and the global feature sequence, and average all elements of the inner product result to obtain the protocol score in scalar form; The updated route logarithmic prior is obtained by adding the current iteration's route logarithmic prior to the calculated protocol score.
7. The method according to claim 1, characterized in that, The step of using the routing correlation coefficient to perform a weighted summation of all aligned candidate value sequences and fusing them into a context vector includes: The context vector is obtained by multiplying each aligned candidate value sequence by the routing correlation coefficient corresponding to the sequence and summing all the product results.
8. The method according to claim 1, characterized in that, The input is fed into a pollution early warning model composed of fully connected layers to obtain an early warning signal representing the probability of pollution events occurring within a specific future time window, including: Flatten the context vector into a one-dimensional vector according to a preset order; The one-dimensional vector is input into a first fully connected layer containing a preset number of neurons and a preset activation function; The output of the first fully connected layer is input into an output layer containing a single neuron and a sigmoid activation function to obtain the warning signal.
9. A pollution early warning system based on pesticide production parameters, characterized in that, Includes the following modules: The mapping module is used to acquire multi-source time-series data from the pesticide production process, including production parameter data and environmental monitoring data, and to process the multi-source time-series data into an input feature sequence. By applying three different linear mappings to the input feature sequence, a query sequence, a set of key sequences, and a set of value sequences are generated respectively. The filtering module is used to calculate the information entropy of each key sequence in the key sequence set within a preset time window, and generate an entropy-controlled similarity score based on the mean of the dot product similarity between the key sequence and the query sequence and the information entropy; sort all key sequences in descending order based on the entropy-controlled similarity score, and filter out a preset proportion of key sequences and their corresponding value sequences to form a candidate key-value pair set. An initialization module is used to initialize the routing logarithm prior corresponding to each candidate key sequence in the candidate key-value pair set; and to execute the routing process within a preset number of iterations to obtain the routing correlation coefficient. The processing module is used to perform time-series alignment processing on each candidate value sequence according to the time offset determined by the key sequence corresponding to the sequence; The routing correlation coefficient is used to perform a weighted summation of all aligned candidate value sequences to form a context vector. After flattening the context vector, it is input into a pollution early warning model composed of fully connected layers to obtain an early warning signal representing the probability of pollution events occurring within a specific future time window.
10. The system according to claim 9, characterized in that, The process of performing the routing procedure within a preset number of iterations to obtain the routing correlation coefficient is as follows: In each iteration, the current route association coefficient is calculated by performing the Softmax function on all route log priors; The time offset corresponding to the maximum correlation coefficient is determined by calculating the time cross-correlation function between the query sequence and each candidate key sequence; After aligning each candidate key sequence according to the time offset corresponding to the sequence, the global feature sequence is obtained by weighted summation of all aligned candidate key sequences using the current routing correlation coefficient. The inner product of each aligned candidate key sequence and the global feature sequence is calculated and the average is taken as the protocol score. Update the route logarithmic prior using the aforementioned protocol score; After the iteration is completed, the route correlation coefficient is calculated by using the Softmax function based on the route logarithm prior.