Intelligent data analysis method based on chemical production line wastewater
By constructing an improved Ball Tree structure, optimizing the index by combining time decay and dimensional importance weights, and using iterative reweighted least squares and Mahalanobis distance to determine the state of wastewater in chemical production lines, the problems of high false alarm rate and slow retrieval speed in existing technologies are solved, achieving more efficient and accurate wastewater state analysis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-12
- Publication Date
- 2026-03-24
AI Technical Summary
Existing wastewater monitoring methods for chemical production lines ignore the correlation between various indicators, resulting in high false alarm and false negative rates. Furthermore, existing index structures do not fully utilize data characteristics when selecting split directions and split points, affecting retrieval speed and accuracy.
An improved Ball Tree structure is constructed, and the weighted covariance matrix is optimized by calculating the time decay coefficient and the dimension importance weight. The splitting pivot point is determined by iterative reweighted least squares method, and the wastewater status is determined by combining Mahalanobis distance and dimension importance weight during the query process.
It improves the accuracy and reliability of chemical wastewater status analysis, reduces false alarm and false negative rates, and enhances the stability of the index structure and query efficiency.
Smart Images

Figure CN121148536B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data analysis, and in particular relates to an intelligent data analysis method based on wastewater from chemical production lines. Background Technology
[0002] With increasing environmental awareness, real-time and accurate monitoring and analysis of wastewater discharged from chemical production lines has become crucial. Chemical wastewater is typically characterized by complex composition, diverse pollutants, and large concentration fluctuations. To achieve effective monitoring and early warning of anomalies in wastewater, online monitoring systems are primarily used. These systems deploy multiple sensors at the discharge outlet to continuously collect various time-series data, including: pH value, chemical oxygen demand (COD), biochemical oxygen demand (BOD), ammonia nitrogen, total phosphorus, heavy metal ion concentration, turbidity, temperature, and flow rate. Fixed upper and lower thresholds are set for individual or a few key indicators, triggering an alarm when the monitored value exceeds the threshold. However, this simple monitoring method ignores the correlation between various indicators, easily leading to high false alarm and false negative rates.
[0003] Existing technologies also employ models such as Support Vector Machines (SVM) and Decision Trees for monitoring. While these models can learn complex patterns in data, in practical applications, especially when real-time online analysis is required, they often rely on rapid similarity lookups. This involves quickly finding the most similar historical samples in a historical database based on the current sample and using this as the basis for judgment. To improve query efficiency, spatial index structures (such as KD-Tree and BallTree) are commonly used. However, BallTrees typically employ random selection, choosing the dimension with the largest variance, or simple mean / median strategies when selecting split directions and split points, failing to utilize the inherent characteristics of the data, such as the differences between dimensions. How to optimize the index structure and similarity metrics using the characteristics of chemical wastewater data to improve retrieval speed and the accuracy of the final results is a pressing technical problem in this field. Summary of the Invention
[0004] To address the aforementioned problems, this invention provides an intelligent data analysis method based on wastewater from chemical production lines.
[0005] An intelligent data analysis method based on wastewater from chemical production lines includes the following steps:
[0006] S1, acquire multidimensional wastewater data, including sampled values, timestamps, and status labels of multiple monitoring indicators;
[0007] S2, construct an improved Ball Tree structure to index multidimensional wastewater data. The recursive partitioning process of the tree nodes includes:
[0008] (1) For the set of data points within the nodes to be divided, calculate the time decay coefficient based on the timestamp of each data point, calculate the dimension importance weight based on the kurtosis coefficient of the data point set on each monitoring indicator dimension, and calculate the weighted covariance matrix by combining the time decay coefficient and the dimension importance weight.
[0009] (2) Perform eigenvalue decomposition on the weighted covariance matrix and take the eigenvector corresponding to the largest eigenvalue as the main splitting direction;
[0010] (3) Project the data points within the node to the main splitting direction, use the iterative reweighted least squares method to calculate the M-estimate of the one-dimensional projection value, use the M-estimate as the splitting pivot point, and divide the data points into two subsets based on the splitting pivot point to generate child nodes;
[0011] S3. Based on the constructed tree structure, a K-nearest neighbor query is performed on the input sample to be analyzed. During the query process, Mahalanobis distance, which is the inverse of the weighted covariance matrix of each node, is used to obtain the historical wastewater data of the K nearest neighbors. The current wastewater status is determined by comprehensively using the status labels of the K nearest neighbor historical wastewater data and the dimension importance weights of the leaf nodes to which the K nearest neighbor historical wastewater data belong.
[0012] Furthermore, by deploying multiple sensors on the chemical production line, a series of wastewater monitoring indicators are collected at regular intervals to form a d-dimensional indicator vector;
[0013] At the same time, a collection timestamp is recorded for each indicator vector, and its corresponding production status label is marked by experts or a historical event database.
[0014] Furthermore, in S2, the weighted covariance matrix obtained in (1) has a dimension of d×d, and in (2), the eigenvalue decomposition operation is performed on the weighted covariance matrix of the dimension of d×d to obtain d eigenvalues and d corresponding eigenvectors.
[0015] Select the largest eigenvalue, and the corresponding eigenvector is the direction with the largest variance of the data in the local space of the node. Determine the corresponding eigenvector as the main splitting direction of the current node.
[0016] Furthermore, in (3), each d-dimensional data point within a node is multiplied by the d-dimensional feature vector of the main splitting direction to obtain a one-dimensional projection value set.
[0017] Further, in (3), the iterative process initializes a center estimate. In each iteration, based on the residual between each projection point and the current center estimate, the weight is calculated for each projection point using the weight function. The new weighted average is calculated using these weights as the center estimate for the next iteration. This process is repeated until the center estimate converges. The converged value is the split pivot point.
[0018] Furthermore, in S2, the process of calculating the time decay coefficient based on the timestamp of each data point and calculating the dimensional importance weight based on the kurtosis coefficient of the data point set on each monitoring indicator dimension includes the following steps:
[0019] For the i-th data point within a node, the formula for calculating the time decay coefficient is: ,in The current system time. The timestamp of data point i;
[0020] For the j-th monitoring indicator dimension, the method for calculating the dimension importance weight is as follows:
[0021] Calculate the kurtosis coefficient of all data points within a node in dimension j. Through formula Normalization is performed to obtain the importance weights of dimension j. ,in It is the sum of the absolute values of the kurtosis coefficients of all dimensions;
[0022] If the sum of the absolute values of the kurtosis coefficients of all dimensions is zero, then the importance weights of each dimension are equal.
[0023] Furthermore, in S2, the process of calculating the weighted covariance matrix by combining the time decay coefficient and the dimensional importance weight includes the following steps:
[0024] Using the time decay coefficient Calculate the weighted mean vector of the data point set. ,in The data point vector;
[0025] Weighted covariance matrix The Middle Line 1 The elements of the column are calculated using the following formula: ;
[0026] in For data points In dimensions The value on, Weighted mean vector The One portion, and Dimensions and dimensions Importance weights.
[0027] Furthermore, in S2, the process of calculating the M-estimate of the one-dimensional projection value using the iterative reweighted least squares method and using the M-estimate as the split pivot point includes the following steps:
[0028] The M-estimate is initialized to the median of the one-dimensional projected values;
[0029] In each iteration, the residual of each projected value is calculated based on the current M-estimate. Based on the residual, the Bisquare weighting function is used to calculate a new weight for each projected value. The weighted average of the projected values is used as the updated M-estimate for this iteration.
[0030] Repeat the above iterative steps until the absolute value of the difference between two consecutive M-estimates is less than 1. The convergent value is used as the split pivot point.
[0031] Furthermore, in S3, the process of using Mahalanobis distance, which is the inverse of the weighted covariance matrix of each node, as the metric matrix during the query process includes the following steps:
[0032] For the input sample x to be analyzed and the historical data points y within the tree node, the Mahalanobis distance is calculated as follows: ,in This is the weighted covariance matrix corresponding to the tree nodes. It is the inverse of the weighted covariance matrix. It is the transpose of the vector (xy).
[0033] Furthermore, the process of comprehensively determining the current wastewater status by utilizing the status labels of the K nearest neighbor historical wastewater data and the importance weights of the leaf nodes to which the K nearest neighbor historical wastewater data belong includes the following steps:
[0034] Calculate the difference between the sample to be analyzed and the i-th nearest neighbor in each monitoring indicator dimension, and combine the dimension importance weight of the leaf node to which the i-th nearest neighbor belongs to calculate the voting weight of the i-th nearest neighbor; among them, the nearest neighbor with a smaller difference from the sample to be analyzed in the dimension with higher importance weight has a higher voting weight.
[0035] Iterate through the K nearest neighbors, sum up the voting weights of the nearest neighbors with the same state label, and get the total weight corresponding to each state label;
[0036] The state label with the highest total weight is taken as the current wastewater state of the sample to be analyzed.
[0037] The beneficial effects are as follows: This invention improves the accuracy and reliability of chemical wastewater status analysis by constructing an improved Ball Tree structure to index multidimensional wastewater data and employing a nearest neighbor query strategy. During tree construction, a time decay coefficient and kurtosis-based dimensional importance weights are introduced to calculate the weighted covariance matrix, ensuring that data partitioning considers both the timeliness of samples and the influence of key monitoring indicators. The use of the M-estimate based on iterative reweighted least squares as the splitting pivot point suppresses the interference of outliers and noise on the tree structure, enhancing the stability of the index. During the query phase, the current wastewater status is comprehensively determined by utilizing the status labels of the K nearest neighbor historical wastewater data and the dimensional importance weights of the leaf nodes to which the K nearest neighbor historical wastewater data belong, thus more accurately measuring the similarity between samples. Attached Figure Description
[0038] Figure 1 A flowchart of an intelligent data analysis method based on wastewater from a chemical production line;
[0039] Figure 2 Schematic diagram for determining the main splitting direction;
[0040] Figure 3 This is a schematic diagram of K-nearest neighbor classification and state determination;
[0041] Figure 4 This is a diagram illustrating the importance weights of dimensions. Detailed Implementation
[0042] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Those skilled in the art should understand that the embodiments described below are only some, not all, of the embodiments disclosed. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0043] An embodiment of the intelligent data analysis method based on chemical production line wastewater provided by this invention:
[0044] like Figure 1 As shown, the intelligent data analysis method for wastewater from chemical production lines includes the following steps:
[0045] S1 acquires multidimensional wastewater data, including sampled values, timestamps, and status labels for multiple monitoring indicators.
[0046] Multiple sensors deployed on the chemical production line periodically collect a series of wastewater monitoring indicators, such as pH value, chemical oxygen demand (COD), turbidity, conductivity, and temperature, forming a d-dimensional indicator vector. Simultaneously, a collection timestamp is recorded for each indicator vector, and its corresponding production status label (e.g., normal, Class A fault, Class B fault) is annotated by experts or a historical event database. These integrated data records together construct a multidimensional wastewater dataset for analysis. Each data record contains a monitoring indicator vector, a timestamp, and a status label.
[0047] S2, construct an improved Ball Tree structure to index multidimensional wastewater data. The recursive partitioning process of the tree nodes includes:
[0048] (1) For the set of data points within the nodes to be divided, calculate the time decay coefficient based on the timestamp of each data point, calculate the dimension importance weight based on the kurtosis coefficient of the data point set on each monitoring indicator dimension, and calculate the weighted covariance matrix by combining the time decay coefficient and the dimension importance weight.
[0049] For a node containing N data points, the current baseline time is obtained, typically the latest timestamp in the data point set. For the i-th data point within the node, the time decay coefficient is calculated using an exponential decay function. For the data within the node, the kurtosis coefficient of each monitoring indicator dimension (i.e., the j-th dimension of the data sequence) is calculated. The kurtosis coefficient values of each dimension are normalized to obtain the importance weight of the j-th dimension. A weighted covariance matrix is calculated. The element in the j-th row and k-th column of the weighted covariance matrix is the sum of the weighted covariances of all N data points, divided by the sum of the total time decay coefficients. The weighted covariance of each data point is equal to: the time decay coefficient of the i-th data point × the importance weight of the j-th dimension × the importance weight of the k-th dimension × (the value of the i-th data point in the j-th dimension - the weighted mean of the j-th dimension) × (the value of the i-th data point in the k-th dimension - the weighted mean of the k-th dimension).
[0050] (2) Perform eigenvalue decomposition on the weighted covariance matrix and take the eigenvector corresponding to the largest eigenvalue as the main splitting direction;
[0051] Perform eigenvalue decomposition on the d×d weighted covariance matrix calculated in the previous step to obtain d eigenvalues and d corresponding eigenvectors. Select the largest eigenvalue; the corresponding eigenvector represents the direction with the largest variance in the local space of the node. Determine the corresponding eigenvector as the principal splitting direction of the current node, such as... Figure 2 As shown.
[0052] (3) Project the data points within the node to the main splitting direction, use the iterative reweighted least squares method to calculate the M-estimate of the one-dimensional projection value, use the M-estimate as the splitting pivot point, and divide the data points into two subsets based on the splitting pivot point to generate child nodes;
[0053] Each d-dimensional data point within a node is multiplied by the d-dimensional eigenvector along the main split direction to obtain a one-dimensional set of projected values. To eliminate the influence of outlier projected values, an iterative reweighted least squares method is used to find the center position M-estimate of the one-dimensional set. The iterative process initializes a center estimate (e.g., the median). In each iteration, based on the residuals between each projected point and the current center estimate, a weight is calculated for each projected point using a weighting function (e.g., the Huber function or the Bisquare function), with points having larger residuals receiving smaller weights. These weights are used to calculate a new weighted average as the center estimate for the next iteration, and this process is repeated until the center estimate converges. The converged value is the split pivot point. Data points within a node whose projected values are less than or equal to the split pivot point are assigned to the left child node, and the remaining data points are assigned to the right child node, completing one split.
[0054] S3. Based on the constructed tree structure, a K-nearest neighbor query is performed on the input sample to be analyzed. During the query process, Mahalanobis distance, which is the inverse of the weighted covariance matrix of each node, is used to obtain the historical wastewater data of the K nearest neighbors. The current wastewater status is determined by comprehensively using the status labels of the K nearest neighbor historical wastewater data and the dimension importance weights of the leaf nodes to which the K nearest neighbor historical wastewater data belong.
[0055] When a new sample is input, the search begins at the root node of the Ball Tree. At each non-leaf node, the Mahalanobis distance between the sample and the node's center is calculated. Simultaneously, based on a comparison of the sample's projection along the principal splitting direction with the splitting pivot point, the search recursively proceeds to the nearest child nodes. When the search reaches a leaf node, the Mahalanobis distance between the sample and all data points within that leaf node is calculated, and these points are selected as candidate nearest neighbors. The search process backtracks to check if sibling nodes on the other side might contain even closer neighbors. After the query is complete, the K historical data points with the smallest Mahalanobis distances are selected from all candidate nearest neighbors.
[0056] For each nearest neighbor, obtain the leaf node to which each nearest neighbor belongs, and analyze the similarity between the sample and this nearest neighbor in key monitoring indicators using the dimensional importance weight of the leaf node. If the sample to be analyzed matches a certain nearest neighbor in the core indicators of the latter's region, then the nearest neighbor will receive a high voting weight; otherwise, the weight will be lower. The weighted votes of all nearest neighbors are accumulated according to the state label, and the state with the highest total weight is the current wastewater state.
[0057] In another optional embodiment, the process of determining the current wastewater status using the status labels of the K nearest neighbor historical wastewater data includes the following steps:
[0058] Statistically analyze the status labels corresponding to the K nearest neighbor historical wastewater data, and calculate the frequency of each status label: "normal", "abnormal", and "severely abnormal".
[0059] The most frequently occurring status label is used as the determination result of the current wastewater status of the sample to be analyzed.
[0060] After identifying the K most similar historical data points to the current wastewater sample (e.g., K = 5), the status labels of these 5 historical data points, as recorded or annotated by experts at that time, are retrieved. These labels may be predefined categories, such as normal, abnormal, or severely abnormal. For example, a wastewater sample to be analyzed finds its 5 nearest neighbor historical data points using Mahalanobis distance calculation. After querying, the status labels of these 5 historical data points are: normal, abnormal, normal, normal, abnormal. Statistical counting of the labels shows that the normal label appears 3 times, the abnormal label appears 2 times, and the severely abnormal label appears 0 times. According to the principle of majority rule, the label with the highest frequency is normal. Therefore, the current status of the sample to be analyzed is determined to be normal. This voting mechanism makes the judgment more reliable and reduces the impact of noise or mislabeling that may exist in individual historical data points. Figure 3 .
[0061] In an optional embodiment, the process of calculating the time decay coefficient based on the timestamp of each data point and calculating the dimensional importance weight based on the kurtosis coefficient of the data point set on each monitoring indicator dimension includes the following steps:
[0062] For the i-th data point within a node, the formula for calculating the time decay coefficient is: ,in The current system time. The timestamp of data point i;
[0063] For the j-th monitoring indicator dimension, the method for calculating the dimension importance weight is as follows:
[0064] Calculate the kurtosis coefficient of all data points within a node in dimension j. Through formula Normalization is performed to obtain the importance weights of dimension j. ,in It is the sum of the absolute values of the kurtosis coefficients of all dimensions;
[0065] If the sum of the absolute values of the kurtosis coefficients of all dimensions is zero, then the importance weights of each dimension are equal.
[0066] Assuming the current time is 15:00:00, a data point collected 10 seconds ago (14:59:50) has a time difference of 10, and the calculated time decay coefficient is approximately 0.367. A data point collected 60 seconds ago (14:59:00) has a time difference of 60, and the calculated decay coefficient is approximately 0.002. Dimension importance weights are used to identify and emphasize monitoring indicators that better reveal abnormal behavior. Kurtosis is an indicator of the sharpness of data distribution; a high kurtosis value means there are more extreme values or outliers in the data. For example, in a dataset containing three monitoring indicators—pH, chemical oxygen demand (COD), and turbidity—if the COD dimension fluctuates drastically, generating a large number of off-center data points, the calculated kurtosis coefficient might be 8.0. Meanwhile, pH and turbidity are relatively stable, and their kurtosis coefficients might be 0.5 and 2.0, respectively. Through normalization calculations, the COD dimension will receive a much higher importance weight than the other two dimensions, such as... Figure 4 As shown.
[0067] In an optional embodiment, the process of calculating the weighted covariance matrix by combining the time decay coefficient and the dimensionality importance weight includes the following steps:
[0068] Using the time decay coefficient Calculate the weighted mean vector of the data point set. ,in The data point vector;
[0069] Weighted covariance matrix The Middle Line 1 The elements of the column are calculated using the following formula:
[0070]
[0071] in For data points In dimensions The value on, Weighted mean vector The One portion, and Dimensions and dimensions Importance weights.
[0072] When calculating a weighted mean vector, recent data points have a greater impact on the position of the mean due to their larger time decay coefficient. For example, the weighted mean calculated from a recent data point with a time weight of 0.9 and an older data point with a time weight of 0.1 will be biased towards the recent data point, making the center of the data more closely resemble the true state.
[0073] When calculating the elements of the weighted covariance matrix, covariance measures the linear relationship between two dimensions. The formula not only uses a time decay coefficient to weight the product of deviations for each data point, but also scales the final result using dimension importance weights. For example, when calculating the weighted covariance between pH and chemical oxygen demand (COD), if the COD dimension has a higher importance weight than pH, the calculation result will be amplified, implying that the correlation between COD and other dimensions is more important for describing the data structure.
[0074] In an optional embodiment, the process of calculating the M-estimate of the one-dimensional projection value using iterative reweighted least squares and using the M-estimate as the split pivot point includes the following steps:
[0075] The M-estimate is initialized to the median of the one-dimensional projected values;
[0076] In each iteration, the residual of each projected value is calculated based on the current M-estimate. Based on the residual, the Bisquare weighting function is used to calculate a new weight for each projected value. The weighted average of the projected values is used as the updated M-estimate for this iteration.
[0077] Repeat the above iterative steps until the absolute value of the difference between two consecutive M-estimates is less than 1. The convergent value is used as the split pivot point.
[0078] Choosing appropriate split points is crucial when constructing an isolation tree. Random selection methods are susceptible to extreme outliers, leading to inefficient segmentation. Using the M-estimate as the split point and calculating it through iterative reweighted least squares can effectively suppress the interference of outlier data points on split point selection. For example, for a set of one-dimensional projected values 1, 2, 3, 4, 100, the median is 3, but the M-estimate will assign a very low weight to the outlier value 100 through the iterative process.
[0079] The iterative process begins with the median of 3 as the initial estimate. In the first iteration, the residuals to 3 are calculated for each point, with the residual for point 100 being 97, which is greater than the residuals for other points. The Bisquare weighting function, also known as the Bisquare kernel function, assigns weights based on the magnitude of the residuals, with points having larger residuals receiving smaller weights and vice versa. Therefore, points 1, 2, 3, and 4 receive high weights, while the weight of point 100 is close to zero. A weighted average is calculated, resulting in a new estimate that is closer to the center of the data (2.8) between points 1, 2, 3, and 4. This process is repeated, recalculating the residuals and weights each time, until the estimate converges to a stable value, such as 2.7. The resulting value of 2.7 is used as a split point to separate the densely distributed normal data from the sparse outlier data.
[0080] In an optional embodiment, the process of using Mahalanobis distance, with the inverse of the weighted covariance matrix of each node as the metric matrix, during the query includes the following steps:
[0081] For the input sample x to be analyzed and the historical data points y within the tree node, the Mahalanobis distance is calculated as follows: ,in This is the weighted covariance matrix corresponding to the tree nodes. It is the inverse of the weighted covariance matrix. It is the transpose of the vector (xy).
[0082] In wastewater treatment monitoring, different monitoring indicators such as temperature and dissolved oxygen may have inherent negative correlations. Euclidean distance might incorrectly classify a sample with both elevated temperature and dissolved oxygen as normal because it only considers the values of each dimension independently. Mahalanobis distance solves this problem by introducing the inverse of the weighted covariance matrix as the core metric. The inverse matrix contains variance and covariance information between each dimension, essentially transforming the data space to make each dimension independent and scale-normalized in the new space. For example, when calculating the Mahalanobis distance between a sample and historical data, if the deviations in temperature and dissolved oxygen violate their normal negative correlation (i.e., both increase simultaneously), this deviation will be amplified after the transformation with the covariance inverse matrix, resulting in a larger Mahalanobis distance value.
[0083] In an optional embodiment, the process of comprehensively determining the current wastewater status using the status labels of the K nearest neighbor historical wastewater data and the importance weights of the leaf nodes to which the K nearest neighbor historical wastewater data belong includes the following steps:
[0084] Calculate the difference between the sample to be analyzed and the i-th nearest neighbor in each monitoring indicator dimension, and combine the dimension importance weight of the leaf node to which the i-th nearest neighbor belongs to calculate the voting weight of the i-th nearest neighbor; among them, the nearest neighbor with a smaller difference from the sample to be analyzed in the dimension with higher importance weight has a higher voting weight.
[0085] Iterate through the K nearest neighbors, sum up the voting weights of the nearest neighbors with the same state label, and get the total weight corresponding to each state label;
[0086] The state label with the highest total weight is taken as the current wastewater state of the sample to be analyzed.
[0087] Specifically, for each of the K nearest neighbor historical wastewater data obtained, it is denoted as the i-th nearest neighbor (i=1, 2, ..., K), and its state label is obtained. and the dimension importance weight vector of its leaf node. Calculate the weighted distance between the i-th nearest neighbor and the sample S to be analyzed. The calculation formula is: Where d represents the number of dimensions of the monitoring indicators. Let j be the value of the sample to be analyzed in the j-th dimension. Let i be the value of the i-th nearest neighbor in the j-th dimension. Let be the importance weight of the leaf node to which the i-th nearest neighbor belongs in the j-th dimension;
[0088] The voting weight of the i-th nearest neighbor is calculated based on the weighted distance. The inverse function form is preferred. Where ε is a very small positive number to prevent the denominator from being zero. Count the set of all unique state labels appearing in the K nearest neighbors, and calculate each type of unique state label. Total weight The state label with the highest total weight is taken as the final state of the current wastewater.
[0089] In addition, in the description of this specification, "multiple" means at least two, such as two, three or more, etc., unless otherwise expressly and specifically defined.
Claims
1. An intelligent data analysis method based on wastewater from chemical production lines, characterized in that, Includes the following steps: S1, acquire multidimensional wastewater data, including sampled values, timestamps, and status labels of multiple monitoring indicators; S2, construct an improved Ball Tree structure to index multidimensional wastewater data. The recursive partitioning process of the tree nodes includes: (1) For the set of data points within the nodes to be divided, calculate the time decay coefficient based on the timestamp of each data point, calculate the dimension importance weight based on the kurtosis coefficient of the data point set on each monitoring indicator dimension, and calculate the weighted covariance matrix by combining the time decay coefficient and the dimension importance weight. The process of calculating the time decay coefficient based on the timestamps of each data point and calculating the dimensional importance weights based on the kurtosis coefficients of the data point set across each monitoring indicator dimension includes the following steps: For the i-th data point within a node, the formula for calculating the time decay coefficient is: ,in The current system time. Let i be the timestamp of data point i; for the j-th monitoring indicator dimension, the method for calculating the dimension importance weight is as follows: calculate the kurtosis coefficient of all data points within the node on dimension j. Through formula Normalization is performed to obtain the importance weights of dimension j. ,in This is the sum of the absolute values of the kurtosis coefficients of all dimensions; if the sum of the absolute values of the kurtosis coefficients of all dimensions is zero, then the importance weights of each dimension are equal. (2) Perform eigenvalue decomposition on the weighted covariance matrix and take the eigenvector corresponding to the largest eigenvalue as the main splitting direction; (3) Project the data points within the node to the main splitting direction, use the iterative reweighted least squares method to calculate the M-estimate of the one-dimensional projection value, use the M-estimate as the splitting pivot point, and divide the data points into two subsets based on the splitting pivot point to generate child nodes; S3. Based on the constructed tree structure, a K-nearest neighbor query is performed on the input sample to be analyzed. During the query process, Mahalanobis distance, which is the inverse of the weighted covariance matrix of each node, is used to obtain the historical wastewater data of the K nearest neighbors. The current wastewater status is determined by comprehensively using the status labels of the K nearest neighbor historical wastewater data and the dimension importance weights of the leaf nodes to which the K nearest neighbor historical wastewater data belong.
2. The intelligent data analysis method based on chemical production line wastewater according to claim 1, characterized in that, By deploying multiple sensors on the chemical production line, a series of wastewater monitoring indicators are collected at regular intervals to form a d-dimensional indicator vector. At the same time, a collection timestamp is recorded for each indicator vector, and its corresponding production status label is marked by experts or a historical event database.
3. The intelligent data analysis method based on chemical production line wastewater according to claim 2, characterized in that, In S2, (1) the weighted covariance matrix obtained is of dimension d×d. In (2), the eigenvalue decomposition operation is performed on the weighted covariance matrix of dimension d×d to obtain d eigenvalues and d corresponding eigenvectors. Select the largest eigenvalue, and the corresponding eigenvector is the direction with the largest variance of the data in the local space of the node. Determine the corresponding eigenvector as the main splitting direction of the current node.
4. The intelligent data analysis method based on chemical production line wastewater according to claim 3, characterized in that, In (3), each d-dimensional data point in the node is multiplied by the d-dimensional feature vector of the main split direction to obtain a one-dimensional projection value set.
5. The intelligent data analysis method based on chemical production line wastewater according to claim 4, characterized in that, In (3), the iterative process initializes a center estimate. In each iteration, the weights of each projection point are calculated using the weight function based on the residuals between each projection point and the current center estimate. The new weighted average is then used as the center estimate for the next iteration. This process is repeated until the center estimate converges. The converged value is the split pivot point.
6. The intelligent data analysis method based on chemical production line wastewater according to claim 1, characterized in that, In S2, the process of calculating the weighted covariance matrix by combining the time decay coefficient and the dimension importance weight includes the following steps: Using the time decay coefficient Calculate the weighted mean vector of the data point set. ,in The data point vector; Weighted covariance matrix The Middle Line 1 The elements of the column are calculated using the following formula: ; in For data points In dimensions The value on, Weighted mean vector The One portion, and Dimensions and dimensions Importance weights.
7. The intelligent data analysis method based on chemical production line wastewater according to claim 6, characterized in that, In S2, the process of calculating the M-estimate of the one-dimensional projection value using the iterative reweighted least squares method and using the M-estimate as the split pivot point includes the following steps: The M-estimate is initialized to the median of the one-dimensional projected values; In each iteration, the residual of each projected value is calculated based on the current M-estimate. Based on the residual, the Bisquare weighting function is used to calculate a new weight for each projected value. The weighted average of the projected values is used as the updated M-estimate for this iteration. Repeat the above iterative steps until the absolute value of the difference between two consecutive M-estimates is less than 1. The convergent value is used as the split pivot point.
8. The intelligent data analysis method based on chemical production line wastewater according to any one of claims 1-7, characterized in that, In S3, the process of using Mahalanobis distance, which is the inverse of the weighted covariance matrix of each node, as the metric matrix during the query includes the following steps: For the input sample x to be analyzed and the historical data points y within the tree node, the Mahalanobis distance is calculated as follows: ,in This is the weighted covariance matrix corresponding to the tree nodes. It is the inverse of the weighted covariance matrix. It is the transpose of the vector (xy).
9. The intelligent data analysis method based on chemical production line wastewater according to claim 8, characterized in that, The process of determining the current wastewater status by comprehensively utilizing the status labels of the K nearest neighbor historical wastewater data and the importance weights of the leaf nodes to which the K nearest neighbor historical wastewater data belong includes the following steps: Calculate the difference between the sample to be analyzed and the i-th nearest neighbor in each monitoring indicator dimension, and combine the dimension importance weight of the leaf node to which the i-th nearest neighbor belongs to calculate the voting weight of the i-th nearest neighbor; among them, the nearest neighbor with a smaller difference from the sample to be analyzed in the dimension with higher importance weight has a higher voting weight. Iterate through the K nearest neighbors, sum up the voting weights of the nearest neighbors with the same state label, and get the total weight corresponding to each state label; The state label with the highest total weight is taken as the current wastewater state of the sample to be analyzed.
Citation Information
Patent Citations
Method and apparatus for designing, rendering and programming a user interface
US20030169293A1
Methods for analysis of spectral data and their applications: atherosclerosis / coronary heart disease
US20040142496A1