An industrial mixed-variable process anomaly detection method and system
By combining the method of automatic separation of heterogeneous variables with event semantic guidance and fusion, the problems of heterogeneity of discrete variables and lack of utilization of engineering event semantics in industrial mixed variable processes are solved, achieving efficient anomaly detection and reducing false alarm rate.
Patent Information
- Application Number
- CN202611706338.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-30
- Publication Date
- 2026-11-27
AI Technical Summary
Existing methods for detecting anomalies in mixed-variable industrial processes fail to adequately consider the internal heterogeneity of discrete variables and the semantics of engineering events, resulting in insufficient anomaly detection performance.
By using a method of automatic separation of heterogeneous variables and event semantic guidance fusion, the heterogeneity of discrete variables is automatically identified using normal operation data, differential representation learning is performed, and the OCV/PDV continuous process backbone is guided by TDV event semantics to perform feature interaction, and multi-prototype energy anomaly scores are constructed for discrimination.
It improves the accuracy and robustness of anomaly detection, reduces the false alarm rate, is suitable for heterogeneous variable modeling in complex industrial sites, and works effectively in scenarios without anomaly labels or with scarce samples.
Smart Images

Figure CN123179258A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial process monitoring and intelligent fault diagnosis technology, and in particular to an anomaly detection method and system for industrial mixed variable processes where both continuous and discrete variables coexist, based on automatic separation of heterogeneous variables, differentiated representation learning, event semantic-guided fusion, and multi-prototype energy scoring. Background Technology
[0002] With the development of the Industrial Internet, intelligent manufacturing, and cyber-physical systems, industrial sites continuously collect multivariate time-series data, including pressure, flow rate, liquid level, current, temperature, and data on valves, pumps, control modes, and alarm status. This monitoring data includes both continuous variables, representing process states and physical evolution with continuous numerical values, and discrete variables, representing equipment actions, control logic, and operational events with finite discrete states. Timely and accurate anomaly detection in such mixed-variable industrial processes is crucial for ensuring production safety, reducing false alarms, and improving intelligent operation and maintenance efficiency.
[0003] Existing multivariate time series anomaly detection methods typically assume that different variables have homogeneous data structures and use uniform prediction, reconstruction, or feature extraction networks for modeling. To adapt to industrial mixed-variable scenarios, some methods further distinguish between continuous and discrete variables and establish separate probabilistic models or latent space representations. However, existing methods for handling discrete variables still largely remain at the level of uniform category encoding or uniform continuous recovery, without fully considering the significant differences within discrete variables in terms of generation mechanisms, state evolution laws, and dynamic semantics.
[0004] Discrete variables in actual industrial processes comprise at least two distinct categories. The first category is pseudo-discrete variables (PDVs), typically formed from continuous signals through quantization, grading, or thresholding. While the observed values are discrete states, adjacent states still correspond to adjacent process levels and retain potential continuous evolution attributes. The second category is true discrete variables (TDVs), directly generated by equipment states, control logic, or operating modes. Their core information is embodied in event semantics such as state transitions, state maintenance, and duration. Encoding PDVs uniformly as ordinary unordered categories would sever the ordered relationships between states and the potential continuous dynamics. Forcibly restoring TDVs to a continuous space might smooth state transitions and weaken key semantics such as event duration.
[0005] On the other hand, existing heterogeneous feature fusion methods typically treat variables from different sources as equal information sources for interaction, rarely explicitly considering the differences in semantic attributes, dynamic behavior, and information contribution of different variables. In particular, the engineering event semantics carried by discrete control variables, such as state transitions, state durations, and their corresponding continuous operating conditions, are often not fully utilized in heterogeneous feature interaction, making it difficult to establish the correlation between equipment actions, control events, and continuous process responses. When an anomaly occurs, OCV, PDV, and TDV may deviate from normal operating patterns through different dynamic and semantic forms. If these three types of variables are not modeled specifically and effective heterogeneous feature interaction relationships are not established, insufficient feature representation of mixed variables will result, thus affecting anomaly detection performance.
[0006] Therefore, there is a need for an industrial mixed variable process anomaly detection method that can automatically identify the internal heterogeneity of discrete variables based solely on normal operating data, perform differential representation learning for observed continuous variables, pseudo-discrete variables, and intrinsic discrete variables, and utilize the engineering event semantics of intrinsic discrete variables to guide the interaction of heterogeneous features. Summary of the Invention
[0007] To address the aforementioned technical problems, this invention provides a method and system for detecting anomalies in industrial mixed-variable processes based on automatic separation of heterogeneous variables and event semantic-guided fusion. The method first constructs a next-moment state prediction network and a variable-level prediction difficulty score based on the differences in temporal predictability of different discrete variables under normal operating conditions, and automatically classifies PDV and TDV using an inflection point strategy. Subsequently, it performs differentiated representation learning based on the different dynamic and semantic characteristics of OCV, PDV, and TDV. Specifically, it extracts the continuous process representation of OCV, uses OCV window summaries and TDV event summaries as conditional information to recover the potential continuous representation of PDV, and encodes TDV into event representations containing state transitions, state maintenance, duration, and continuous process context. Furthermore, using the TDV event representation as query information, it guides the OCV / PDV continuous process backbone to perform heterogeneous feature interaction and fusion, obtaining a window-level mixed-variable representation. Finally, it constructs multiple normal operating mode prototypes based on the normal training window representations, and uses multi-prototype energy anomaly scores and statistical thresholds to complete anomaly discrimination.
[0008] The technical solution of this invention is an anomaly detection method for industrial mixed variable processes based on automatic separation of heterogeneous variables and event semantic-guided fusion, comprising the following steps:
[0009] Step 1: Obtain multivariate time series data of industrial processes, construct normal training windows and test windows to be tested, and divide process variables into observed continuous variables (OCV) and discrete variables (DV) according to the form of variable observation.
[0010] Step 2: Train the next time step state prediction network using the DV historical sequence in the normal training window, calculate the variable-level prediction difficulty score for each DV, and divide the DV into pseudo-discrete variable PDV and intrinsic discrete variable TDV.
[0011] Step 3: Differential representation learning is performed on OCV, PDV and TDV respectively. The continuous process representation is obtained by using the OCV encoder, the latent continuous sequence of PDV is recovered and the latent continuous representation of PDV is obtained, and the event representation of TDV is constructed.
[0012] Step 4: Merge the OCV continuous process representation and the PDV latent continuous representation into a continuous process backbone. Generate a query using the TDV event representation, and generate a key and value using the continuous process backbone to perform attention interaction. Combine the event response with the continuous process backbone to obtain a window-level hybrid variable representation.
[0013] Step 5: Train a differential representation network using normal training data, perform clustering on the window-level mixed variable representation of the normal training window to obtain multiple normal pattern prototypes, and determine the detection threshold based on the energy anomaly score of the normal training window relative to the multiple normal pattern prototypes.
[0014] Step 6: Generate a window-level hybrid variable representation for the test window and calculate its energy anomaly score relative to multiple normal mode prototypes. Compare the energy anomaly score with the detection threshold and output the normal or abnormal detection result.
[0015] Furthermore, the next-moment state prediction network in step 2 includes variable-level category embeddings corresponding to each DV, a shared temporal encoder, a shared context mapping network, and independent classification prediction heads corresponding to each DV. For the j-th DV in the i-th normal training window, its historical state sequence is processed by the corresponding variable-level category embedding and shared temporal encoder to obtain a variable historical dynamic representation. The variable historical dynamic representations of all DVs are aggregated and processed by the shared context mapping network to form a joint DV historical context. Each independent classification prediction head predicts the probability distribution of the next-moment state of the corresponding DV based on the joint DV historical context. The variable-level cross-entropy prediction loss of all DVs is jointly optimized using an equal-weighting method.
[0016] Furthermore, the prediction difficulty scores are sorted in descending order, and the dividing boundary is determined using an inflection point strategy. High prediction difficulty DVs are automatically classified as pseudo-discrete variables (PDVs), and low prediction difficulty DVs are automatically classified as intrinsic discrete variables (TDVs). Specifically, the average cross-entropy prediction loss of the j-th DV on normal training data is used as its prediction difficulty score. Sort all DV prediction difficulty scores in descending order, and use an inflection point strategy to determine the dividing position k. High prediction difficulty DVs located before the dividing point are classified as PDVs, and low prediction difficulty DVs located after the dividing point are classified as TDVs.
[0017] Furthermore, in step 3, the OCV window digest and TDV event digest are used as conditional information to recover the PDV latent continuous sequence and obtain the PDV latent continuous representation; the TDV event representation is composed of the current state embedding, variable identity embedding, directed state transition embedding, state duration embedding, window end marker embedding, and the OCV time representation of the time position corresponding to the event marker; a maximum number of event markers to retain is set for each TDV. When the number of candidate event markers exceeds Event markers containing state transitions are preferentially retained, and fixed prior weights are set for state transition markers and state retention markers respectively, wherein the fixed prior weight of the state transition marker is greater than the fixed prior weight of the state retention marker.
[0018]
[0019] ;
[0020] in, This represents the index of the TDV event tag in the i-th window; and These represent the current state embedding, variable identity embedding, directed state transition embedding, state duration embedding, and window end marker embedding, respectively. This indicates the time position corresponding to the event marker within the i-th window. This indicates the time-continuous process characteristics of the OCV corresponding to this position; This represents the learnable linear projection matrix used to map OCV temporal features to the event representation space; This represents an event representation mapping network; This represents the first [event] obtained after fusing discrete event information with the corresponding continuous process context. Each TDV event is marked with its original representation; This represents the TDV event representation obtained after applying prior weights to the event type; and These represent the fixed prior weights corresponding to the state transition event flag and the state persistence event flag, respectively. This aims to improve the information contribution of state transition events in subsequent heterogeneous feature interactions.
[0021] Furthermore, in step 3, the PDV latent continuous sequence is recovered through the PDV latent continuous recovery module, which includes variable-level state embedding, shared mapping, feature linear modulation FiLM, and latent continuous mapping network; the OCV continuous process representation is time-pooled to obtain an OCV window digest, and the TDV event representation is masked average pooled to obtain a TDV event digest. The OCV window digest and TDV event digest are used as conditional information to modulate the PDV representation and recover the PDV latent continuous sequence.
[0022]
[0023] in, This indicates a PDV potential continuous recovery module. This represents the PDV state sequence in the i-th window. This represents a summary of TDV window events. This represents a summary of the OCV window-level continuous process.
[0024] Furthermore, in step 4, the OCV continuous process representation and the PDV latent continuous representation are concatenated along the feature dimension and mapped to obtain the continuous process backbone. The TDV event representation is projected through the first linear projection to obtain the Query. The continuous process backbone is projected through the second and third linear projections to obtain the Key and Value, respectively. Multi-head attention interaction is then performed to obtain the event-related continuous process response. The obtained valid TDV event responses are subjected to masked average pooling, and the pooled window-level event responses are extended to the window time dimension. Residual fusion and layer normalization are then performed with the continuous process backbone. To obtain the final mixed-variable time series representation ;
[0025]
[0026]
[0027] in, , and These represent the learnable linear projection matrices used to generate the query, key, and value, respectively. This represents multi-head attention computation; This represents the event-related continuous process response obtained by each TDV event in the i-th window for the continuous process backbone; This represents the window-level event response obtained by aggregating all valid TDV event responses in the i-th window. , Represents a column vector of length L consisting entirely of 1s, used to extend window-level event responses to all time positions within the window.
[0028] Furthermore, in step 5, the differential representation network training loss includes OCV mask reconstruction loss. PDV state reconstruction loss and PDV potential continuous-time smoothing loss The OCV mask reconstruction loss is calculated only at the locations of the masked continuous observations; the PDV state reconstruction loss is used to constrain the PDV latent continuous subspace to recover the original discrete state; and the PDV latent continuous-time smoothing loss is used to limit unfounded drastic changes in the latent continuous representation at adjacent time points. The specific calculation formulas for each loss are as follows:
[0029]
[0030] Where N is the number of normal training windows, and L represents the length of the sliding window. Indicates the number of OCVs. Indicates an OCV index; This represents the mask indicator for the c-th OCV at the t-th time position in the i-th training window. It is set to 1 when the position is occluded and 0 otherwise. and These represent the reconstructed value and the original observation value at the corresponding location, respectively; Represents the Huber loss function;
[0031]
[0032] in, Represents the cross-entropy loss function. Indicates the number of PDVs. Indicates a PDV index; This represents the output of the state category predicted by the state reconstruction head corresponding to the m-th PDV based on its latent continuous representation; This represents the original discrete state of the m-th PDV at the t-th time position of the i-th training window;
[0033] ,
[0034] in, The potential continuous representation dimension of a single PDV; This represents the latent continuous representation of all PDVs at time position t in the i-th training window; This represents the square norm 2.
[0035] Furthermore, in step 5, the window-level mixture variable representation of all normal training windows is extracted. K-means clustering is used to cluster the window-level mixture variable representations of all normal training windows, with the K cluster centers serving as normal pattern prototypes. For the i-th window, its window-level mixture variable representation and each normal pattern prototype are calculated respectively. Euclidean distance between The distances are aggregated using an energy function to obtain multi-prototype energy anomaly scores. ;
[0036]
[0037]
[0038] Where γ is the temperature parameter.
[0039] Furthermore, the detection threshold τ is determined based on the q-quantile of the multi-prototype energy anomaly scores across all normal training windows; during the testing phase, the PDV / TDV partitioning, differential representation network, and normal mode prototype obtained during the training phase are used, and the detection threshold τ is determined based on the multi-prototype energy anomaly scores within the testing window. If the value is greater than the detection threshold τ, it is considered abnormal; otherwise, it is considered normal.
[0040]
[0041]
[0042] in, This represents the anomaly detection prediction label for the i-th test window. This indicates that the test window has been determined to be normal. This indicates that the test window has been determined to be abnormal. Let q represent the quantile function, and N represent the number of normal training windows.
[0043] The present invention also provides an industrial mixed-variable process anomaly detection system, including one or more processors and a storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors execute the above-described industrial mixed-variable process anomaly detection method.
[0044] Compared with the prior art, the present invention has at least the following beneficial effects:
[0045] (1) This invention no longer treats all discrete variables as homogeneous categories. Instead, it utilizes the differences in time-series predictability of different discrete variables under normal operating conditions to automatically complete PDV / TDV separation through variable-level prediction difficulty scoring and inflection point strategy. This eliminates the need for manual specification of categories for each variable, providing an automatically executable pre-step for modeling heterogeneous variables in complex industrial sites.
[0046] (2) The present invention performs continuous process encoding, potential continuous recovery and event semantic encoding for different generation mechanisms of OCV, PDV and TDV respectively, so that the potential continuous evolution information of PDV and the state switching, state maintenance and duration information of TDV are preserved, reducing the information loss caused by unified discrete encoding or unified continuous encoding.
[0047] (3) The present invention uses TDV event representation as a query to actively extract relevant process responses in the OCV / PDV continuous process backbone, so that equipment action, control logic and state holding events are associated with their corresponding continuous operating conditions, thereby using the semantics of TDV engineering events to guide the feature interaction between heterogeneous variables and enhance the representation ability of mixed variable abnormal patterns.
[0048] (4) The present invention constructs an energy anomaly score based on multiple normal mode prototypes, which can characterize multiple working conditions and multiple normal operating modes existing in the industrial field, and determines the threshold by the statistical quantile of the normal training score, which is suitable for industrial process monitoring scenarios with no abnormal labels or scarce abnormal samples.
[0049] (5) The automatic separation of variables, representation learning, prototype modeling and threshold determination of the present invention can all be completed on normal training data, which makes it easy to deploy in water treatment, compressed air systems, chemical processes, energy systems and other industrial processes that include continuous measurement quantities and discrete control quantities. Attached Figure Description
[0050] Figure 1 This is the overall flowchart provided in the embodiments of the present invention;
[0051] Figure 2 This is a comparison chart of the standard deviations of FAR, F1, and AUPRC indices obtained from repeated experiments on the MetroPT3 dataset in this embodiment of the invention.
[0052] Figure 3 This is a comparison chart of anomaly detection curves on the SWaT dataset based on embodiments of the present invention. (a) to (d) are the anomaly detection curves of MiTSformer, MFAD, DAN and the method of the present invention, respectively. The shaded area represents the fault interval, the dashed line represents the detection control limit, and the dotted line represents the first detection position. Detailed Implementation
[0053] To make the objectives, technical solutions, and beneficial effects of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the embodiments described are only for explaining the invention and not for limiting the scope of protection of the invention. Those skilled in the art can make equivalent substitutions or adjustments to the number of network layers, hidden dimensions, window length, clustering algorithm, number of attention heads, or threshold quantiles without departing from the concept of this invention; all of these can be considered implementations of this invention.
[0054] like Figure 1 As shown, this embodiment divides the anomaly detection of industrial mixed-variable processes into three stages: The first stage automatically separates heterogeneous discrete variables, classifying them into PDV and TDV based on the next-state prediction difficulty of DV; the second stage performs differentiated representation learning for OCV, PDV, and TDV, and uses TDV event semantics to guide the heterogeneous feature interaction and fusion of OCV / PDV continuous process representations; the third stage constructs multiple normal operation mode prototypes based on normal training window representations, calculates the multi-prototype energy anomaly scores, and completes threshold discrimination. A specific, achievable process is given below.
[0055] (1) Construction of time windows and initial division of variables for industrial mixed variables;
[0056] Given industrial multivariate time series data, where T represents the number of sampling points, D represents the total dimension of process variables, and L represents the sliding window length, the process variables can be initially divided into observed continuous variables (OCV) and discrete variables (DV) based on the data observation format. OCV includes continuous measurements such as pressure, flow rate, liquid level, current, and temperature, while DV includes valve opening / closing, pump start / stop, control mode, alarm flags, and state variables formed by discretizing continuous quantities. Training data uses samples from the normal operation phase to construct a normal training window, and test data uses the same window construction rules to obtain the test window to be tested.
[0057] This invention further identifies the heterogeneity within the DV and automatically separates the DV into PDV and TDV. PDV is usually generated by quantization, grading, or thresholding of continuous quantities, with adjacent discrete states corresponding to adjacent process levels, and possessing potential continuous evolution characteristics; TDV is directly generated by device actions and control logic, with state switching, state holding, duration, and switching direction constituting its main event semantics.
[0058] (2) Automatic separation of heterogeneous discrete variables based on prediction difficulty;
[0059] This embodiment utilizes only the DV historical sequence from the normal training data to construct the next time-step state prediction model. Let the number of normal training windows be N, and the total number of discrete variables be... ,in This indicates the index of the normal training window. This represents the index of the discrete variable, and the superscript d indicates the data or feature associated with the discrete variable. For the j-th discrete variable in the i-th sample window, its historical state sequence within the window is denoted as... Variable-level category embedding is used to preserve the state semantics of the variable itself, and the embedded history sequence is input into a shared gated recurrent network to obtain a dynamic representation of the variable history:
[0060] ,
[0061] in, This represents the category embedding function corresponding to the j-th discrete variable. This represents a gated recurrent unit shared by all DVs, used to extract dynamic evolution features of historical state sequences along the time dimension of the window. This represents the historical dynamic representation of the j-th discrete variable within the i-th normal training window. Since each DV uses a shared temporal coding structure and a consistent training strategy, the impact of differences in coding models on the difficulty of variable-level prediction can be reduced.
[0062] Subsequently, the historical dynamic representations of all DVs are averaged and aggregated, and a joint context representation that integrates all historical dynamic information of DVs is formed through a shared mapping network:
[0063]
[0064] in, This represents a shared context mapping network used for non-linear mapping of the average aggregated features of all DVs; This represents the joint DV historical context representation obtained after fusing all DV historical dynamic information in the i-th normal training window.
[0065] For each DV, an independent classification prediction head is set up to match its number of state categories, and the probability distribution of the next state of the corresponding DV is predicted based on the joint DV historical context:
[0066]
[0067] in, This represents the independent classification prediction head corresponding to the j-th discrete variable, whose output dimension is consistent with the number of state categories of that variable; Used to convert the output of the classification prediction head into the probabilities of each candidate state; Let represent the probability distribution of the state of the j-th discrete variable at the next time step, obtained from the joint DV historical context prediction based on the i-th window.
[0068] Since the observations of discrete variables are finite mutually exclusive categories, this embodiment uses cross-entropy as the variable-level next-state prediction loss. The average cross-entropy prediction loss of the j-th discrete variable over all normal training windows is expressed as:
[0069] ,
[0070] in, This represents the cross-entropy loss function, used to measure the difference between the predicted probability distribution of the next state and the actual state. This represents the true state of the j-th discrete variable at the next moment, corresponding to the i-th input window. Let represent the average next-state prediction loss of the j-th discrete variable on normal training data.
[0071] All discrete variables participate in the training of the prediction network, and the average cross-entropy prediction loss of each variable is averaged with equal weights to obtain the overall training loss of the prediction network in the first stage:
[0072]
[0073] After training the prediction network, the average cross-entropy of the j-th discrete variable on the normal training data is defined as the prediction difficulty score.
[0074] ,
[0075] A higher prediction difficulty score indicates that the variable's state at the next moment is more difficult to predict, and its dynamic uncertainty is relatively high; a lower prediction difficulty score indicates that the variable has a relatively stable and predictable state evolution law. Since PDV loses some fine-grained evolution information during the discretization of continuous signals, while TDV typically exhibits relatively stable state dwell and switching laws under normal control logic, the two present different prediction difficulties under normal operating conditions. This embodiment arranges the prediction difficulty scores of all DVs in descending order and uses an inflection point strategy to determine the boundary position k of the ordered score curve. Variables with high predictability located before the dividing line are classified as PDV, and variables with low predictability located after the dividing line are classified as TDV.
[0076] (3) Differential representation learning of OCV, PDV and TDV;
[0077] For OCV, the OCV sequence in the i-th window is denoted as... Extracting its time-continuous process representation using a continuous variable encoder :
[0078]
[0079] Where F represents the uniform representation dimension. Average pooling is performed on the OCV temporal representation along the window time dimension. To obtain a summary of the window-level continuous process :
[0080]
[0081] OCV encoder It can be constructed from a multilayer perceptron, a temporal convolutional network, or other networks capable of extracting continuous temporal dynamics; in this embodiment, a structure is adopted to first perform variable dimension mapping and then perform temporal convolution to obtain a continuous process representation.
[0082] For TDV, using only instantaneous category embedding is insufficient to distinguish the different dynamic behaviors corresponding to state transitions and state maintenance. This embodiment constructs event markers based on TDV state changes at adjacent time points and jointly encodes the current state, variable identity, directed state transition, state duration, window end marker, and the OCV continuous process context corresponding to the time position of the event marker. In the i-th window... The original representation of a TDV event marker is:
[0083]
[0084] in, This represents the index of the TDV event tag in the i-th window; and These represent the current state embedding, variable identity embedding, directed state transition embedding, state duration embedding, and window end marker embedding, respectively. This indicates the time position corresponding to the event marker within the i-th window. This indicates the time-continuous process characteristics of the OCV corresponding to this position; This represents the learnable linear projection matrix used to map OCV temporal features to the event representation space; This represents an event representation mapping network; This represents the first [event] obtained after fusing discrete event information with the corresponding continuous process context. Each TDV event is marked with its original representation. Thus, the same TDV state switching or state holding behavior can be combined with different continuous operating conditions at the time of its occurrence to form event representations with different engineering semantics.
[0085] Set the maximum number of tags to retain for each TDV. When the number of candidate tags exceeds When holding a state, priority is given to retaining the flags that indicate state transitions, and prior weights are applied to the transition flags and the hold flags respectively:
[0086] ;
[0087] in, This represents the TDV event representation obtained after applying prior weights to the event type; and These represent the fixed prior weights corresponding to the state transition event flag and the state persistence event flag, respectively. This aims to improve the information contribution of state transition events in subsequent heterogeneous feature interactions. All valid TDV event tags form a window-level event representation matrix:
[0088] ,
[0089] in, This represents the total number of valid TDV event markers that are ultimately retained in the i-th window.
[0090] Masked average pooling is performed on the valid event representations in the window-level events to obtain the TDV window event summary:
[0091]
[0092] in, This indicates that only valid TDV event representations are averaged, ignoring mask average pooling operations with padding or invalid positions.
[0093] For PDV, the PDV state sequence in the i-th window is denoted as... Using the OCV window digest and TDV window event digest as conditional information, the PDV potential continuous sequence is recovered through the conditional PDV potential continuous recovery module:
[0094]
[0095] in, The conditional PDV latent continuity recovery module consists of variable-level state embedding, shared mapping, FiLM conditional modulation, and a latent continuity mapping network. This is then utilized using a PDV encoder. Extracting the latent continuous dynamic representation:
[0096]
[0097] (4) Heterogeneous feature interaction fusion guided by TDV event semantics;
[0098] First, represent the OCV time-continuous process. With PDV potential continuous dynamic representation Concatenate along the feature dimension and pass through a mapping network Forming the backbone of a continuous process:
[0099]
[0100] The continuous process backbone simultaneously contains the continuous process dynamics information of OCV and the potential continuous evolution information behind the discrete observations of PDV. To enable TDV events to participate in the selection of continuous process information, this embodiment employs a TDV-guided cross-attention mechanism: the TDV event representation is linearly projected as the query, and the continuous process backbone is linearly projected as the key and value. Event-related continuous process responses are obtained through multi-head attention.
[0101] ,
[0102] in, , and These represent the learnable linear projection matrices used to generate the query, key, and value, respectively. This represents multi-head attention computation; This represents the event-related continuous process response obtained by each TDV event in the i-th window for the continuous process backbone.
[0103] Each TDV event tag actively queries the continuous process backbone based on its state transition, state persistence, or duration semantics to locate the corresponding OCV / PDV process response. Masked average pooling is then applied to valid event responses.
[0104] ,
[0105] in, This represents the window-level event response obtained by aggregating all valid TDV event responses in the i-th window.
[0106] Subsequently, the window-level event response was extended to the window time dimension and integrated with the continuous process backbone. Perform residual fusion and layer normalization The final time series representation of the mixed variables is obtained:
[0107] ,
[0108] in, Represents a column vector of length L consisting entirely of 1s, used to extend window-level event responses to all time positions within the window.
[0109] Average pooling is performed along the window time dimension on the temporal representation of the mixture variables to obtain a window-level mixture variable representation for normal pattern modeling and anomaly scoring:
[0110]
[0111] (5) Normal data-driven representation network training;
[0112] To enable the model to learn the normal continuous process structure, this embodiment randomly masks certain positions in the OCV input. The masked OCV, along with the corresponding PDV and TDV inputs, is then fed into the aforementioned differential representation learning and event semantic-guided fusion process to obtain the corresponding fused temporal representation. The masked continuous observations are then recovered using the OCV reconstruction head. The reconstruction error employs Huber loss and is calculated only at the masked OCV positions. This constrains the fused representation to recover the normal continuous process structure using unmasked process information and other heterogeneous variable information, forming the OCV mask reconstruction loss.
[0113]
[0114] in, Indicates the number of OCVs. Indicates an OCV index; This represents the mask indicator for the c-th OCV at the t-th time position in the i-th training window. It is set to 1 when the position is occluded and 0 otherwise. and These represent the reconstructed value and the original observation value at the corresponding location, respectively; This represents the Huber loss function.
[0115] To ensure that the latent continuous representation of PDV preserves both the semantics of the original discrete states and reasonable temporal continuity, a PDV state reconstruction loss is set. The latent continuous subspace corresponding to each PDV is input into the variable-level state reconstruction head to predict the original state category:
[0116]
[0117] in, Indicates the number of PDVs. Indicates a PDV index; This represents the output of the state category predicted by the state reconstruction head corresponding to the m-th PDV based on its latent continuous representation; This represents the original discrete state of the m-th PDV at the t-th time position of the i-th training window.
[0118] Simultaneously, constraints are applied to the changes in the potential continuous representation of PDV at adjacent time points to obtain the potential continuous-time smoothing loss:
[0119] ,
[0120] in, The potential continuous representation dimension of a single PDV; This represents the latent continuous representation of all PDVs at time position t in the i-th training window; This represents the square norm 2.
[0121] The total training loss of the network is composed of a weighted average of the PDV state reconstruction loss, the PDV latent continuous-time smoothing loss, and the OCV mask reconstruction loss.
[0122] ,
[0123] in, , and The weights are the loss weights. TDV does not set a separate reconstruction objective; its event representation participates in the learning of hybrid variable representations through PDV conditional latent continuous recovery and event semantic-guided attention interactions. Only the normal operating window is used during the training phase, thus avoiding reliance on anomalous labels.
[0124] (6) Multi-prototype energy anomaly scoring and threshold discrimination;
[0125] This represents the window-level mixture variable extracted from all normal training windows after network training is complete. This constitutes the normal representation set:
[0126]
[0127] Considering that industrial processes may have multiple normal operating conditions or normal working modes, K-means is used to cluster the set of normal representations, and the K cluster centers are used as normal mode prototypes. The relationship between the i-th window representation and the k-th normal mode prototype is calculated. Euclidean distance between them:
[0128]
[0129] To comprehensively utilize the distance information between the window representation and multiple normal prototypes, an energy function is used to define the energy anomaly score for multiple prototypes:
[0130] ,
[0131] Where γ is the temperature parameter. The closer the window is to at least one normal pattern prototype, the smaller its energy anomaly score; when the window deviates from multiple normal pattern prototypes simultaneously, the anomaly score increases. The detection threshold is determined based on the statistical distribution of the anomaly scores of all normal training windows:
[0132]
[0133] in This represents the q-quantile function. During the testing phase, the PDV / TDV partitioning, network representation, and normal mode prototype obtained during training are used to calculate the anomaly score for each test window. And perform threshold discrimination:
[0134]
[0135] in, This represents the anomaly detection prediction label for the i-th test window. This indicates that the test window has been determined to be normal. This indicates that the test window has been deemed abnormal. In actual deployment, the threshold quantile q can be adjusted according to the on-site requirements for false alarm rate and missed alarm rate.
[0136] (7) Training and testing process of the embodiment;
[0137] (7.1) Construct a sliding window from the normal training data and divide the variables into OCV and DV according to the form of variable observation;
[0138] (7.2) Train the DV next state prediction network, calculate the prediction difficulty score of each DV, sort them and determine the PDV / TDV division through the inflection point;
[0139] (7.3) Construct OCV continuous process representation, PDV latent continuous representation and TDV event representation respectively according to the above partition, and perform attention fusion guided by TDV event semantics;
[0140] (7.4) The representation network is trained by OCV mask reconstruction, PDV state reconstruction and PDV latent continuous smoothness constraint;
[0141] (7.5) Extract the normal training window representation and cluster it to obtain multiple normal pattern prototypes, calculate the normal training anomaly score and determine the statistical threshold;
[0142] (7.6) Extract the mixed variable representation from the test window, calculate the multi-prototype energy anomaly score, and output the anomaly detection result according to the threshold.
[0143] (8) Validation example using industrial datasets;
[0144] To verify the feasibility of the above method, this embodiment conducts validation on SWAT water treatment industrial control system data and MetroPT3 subway air compression system data. Both datasets contain both continuous measurement variables and discrete state variables. Discretization thresholds are set for some continuous quantities on the normal training data to construct PDVs, which are used to verify the model's ability to handle potential continuous-discrete variables. Continuous variables are standardized using training set statistics, and discrete variables are encoded according to their state values.
[0145] Table 1. Data Scale and Variable Composition of Examples
[0146]
[0147] In this embodiment, the detection threshold quantile for both datasets is set to 0.98, the number of normal mode prototypes is set to 2, the energy-temperature parameter is set to 1.0, and the OCV mask ratio is set to 0.15. The maximum number of event markers per TDV in SWaT is set to 6, and in MetroPT3 it is set to 12; state transition markers and state maintenance markers use different prior weights. The above values are used to illustrate a feasible configuration and do not constitute a limitation on the parameter range of this invention.
[0148] The detection performance was evaluated using the false alarm rate (FAR), F1, and the area under the PR curve (AUPRC). The table below shows representative results of the method of this invention and several comparative methods.
[0149] Table 2 Anomaly detection results of the SWaT dataset
[0150]
[0151] As shown in Table 2, on the SGaT dataset, the method of this invention achieves a FAR of 0.0156 and an F1 score of 0.7545, respectively, achieving the lowest false alarm rate and the highest F1 score among the listed comparison methods. Compared with the traditional mixed variable monitoring method HVMMM, the FAR of this invention decreases from 0.0205 to 0.0156, and the F1 score increases from 0.7283 to 0.7545. Compared with methods such as MiTSformer, MFAD, and DAN, this invention also exhibits a lower FAR and a higher F1 score. These results demonstrate that automatic separation and differential representation of PDV and TDV, and utilizing TDV event semantics to guide heterogeneous feature interaction, helps reduce false alarms during normal operation and improves overall anomaly detection performance.
[0152] Table 3 Anomaly detection results of the MetroPT3 dataset
[0153]
[0154] As shown in Table 3, on the MetroPT3 dataset, the FAR, F1, and AUPRC of the method described in this invention are 0.0023, 0.9141, and 0.9413, respectively, all of which are the best among the listed comparison methods. Specifically, compared to MiTCD-CAGKE, the F1 of the method described in this invention is improved from 0.6906 to 0.9141, and the AUPRC is improved from 0.7117 to 0.9413. Compared to MiTSformer, MFAD, and traditional mixed variable monitoring methods, the method described in this invention also has a lower false alarm rate and higher overall detection performance. These results demonstrate that the proposed OCV / PDV / TDV differentiated representation and TDV event semantic-guided fusion can effectively characterize the dynamic and semantic information of different types of variables.
[0155] To further examine the stability of the method under repeated experimental conditions, the standard deviations of the FAR, F1, and AUPRC indices of each method were statistically analyzed using the MetroPT3 dataset as an example. The results are as follows: Figure 2 As shown. By Figure 2 It can be seen that the standard deviations of FAR and F1 of the method of the present invention are 0.0013 and 0.0154, respectively, both lower than those of the listed comparative methods, indicating that it has small fluctuations in repeated experiments in terms of false alarm rate and overall detection performance. The standard deviation of AUPRC of the method of the present invention is 0.0214, which is basically equivalent to 0.0212 of MFAD, also maintaining small fluctuations. This shows that the method of the present invention has good detection stability under the experimental configuration described above.
[0156] Furthermore, to further analyze the ability of the method of this invention to distinguish between normal and abnormal states from the perspective of temporal detection behavior, the abnormal score changes of MiTSformer, MFAD, DAN and the method of this invention are compared using the SWaT dataset as an example. The results are as follows: Figure 3 As shown, the shaded area represents the fault zone, the dashed line represents the detection control limit (i.e., the detection threshold), and the dotted line represents the initial detection position. It can be seen that MiTSformer, MFAD, and DAN exhibit varying degrees of abnormal score fluctuations and control limit exceedances within the normal operating range. In contrast, the method of this invention demonstrates relatively stable abnormal scores and fewer limit exceedances during the normal operating phase. Furthermore, it exhibits a clear score increase and threshold crossing after entering the fault zone. This allows it to maintain abnormal response capabilities while reducing false alarms caused by normal operating fluctuations, thus improving the ability to distinguish between normal and abnormal states.
[0157] Based on the detection results, stability of repeated experiments, and anomaly detection curve analysis of the two industrial datasets mentioned above, the method of this invention can effectively reduce the false alarm rate, improve the overall anomaly detection performance, and maintain relatively stable detection results. This verifies the effectiveness and feasibility of the automatic separation of heterogeneous discrete variables, OCV / PDV / TDV differential representation learning, and TDV event semantic-guided fusion technology.
[0158] (9) Anomaly detection system implementation example;
[0159] This invention also provides an anomaly detection system for industrial mixed-variable processes based on automatic heterogeneous variable separation and event semantic-guided fusion. The system may include a data acquisition and window construction module, an automatic heterogeneous variable separation module, a differential representation learning module, an event semantic-guided fusion module, a normal prototype modeling module, and an anomaly scoring and threshold discrimination module. Each functional module can be implemented by software, hardware, or a combination of both.
[0160] In one hardware implementation, the system includes one or more processors, a memory, and a communication interface. The memory stores computer programs and model parameters; when the processor executes the computer program, it completes the following tasks: normal training window construction, automatic PDV / TDV partitioning, OCV / PDV / TDV differential representation, TDV event semantic-guided attention fusion, normal pattern prototype construction, multi-prototype energy anomaly scoring, and threshold discrimination. The communication interface is used to receive process data from industrial field sensors, controllers, SCADA systems, or historical databases, and output anomaly detection results or alarm signals.
[0161] It should be understood that the above description of the embodiments is quite detailed and should not be construed as limiting the scope of protection of this invention. Those skilled in the art, under the guidance of this invention, can replace the shared GRU with other temporal encoders, K-means with other clustering algorithms, multi-head attention with a functionally equivalent query-key-value interaction module, or make equivalent adjustments to the event labeling, loss weights, and threshold strategies; as long as it still employs the technical concept of automatic separation of heterogeneous variables, OCV / PDV / TDV differentiated representation learning, and TDV event semantic guidance fusion, it should fall within the scope of protection of this invention, the specific scope of protection being determined by the claims.
Claims
1. A method for detecting anomalies in an industrial mixed-variable process, characterized in that, Includes the following steps: Step 1: Obtain multivariate time series data of industrial processes, construct normal training windows and test windows to be tested, and divide process variables into observed continuous variables (OCV) and discrete variables (DV) according to the form of variable observation. Step 2: Train the next time step state prediction network using the DV historical sequence in the normal training window, calculate the variable-level prediction difficulty score for each DV, and divide the DV into pseudo-discrete variable PDV and intrinsic discrete variable TDV. Step 3: Differential representation learning is performed on OCV, PDV and TDV respectively. The continuous process representation is obtained by using the OCV encoder, the latent continuous sequence of PDV is recovered and the latent continuous representation of PDV is obtained, and the event representation of TDV is constructed. Step 4: Merge the OCV continuous process representation and the PDV latent continuous representation into a continuous process backbone. Generate a query using the TDV event representation, generate a key and a value using the continuous process backbone to perform attention interactions, and combine the event response with the continuous process backbone to obtain a window-level hybrid variable representation. Step 5: Train a differential representation network using normal training data, perform clustering on the window-level mixed variable representation of the normal training window to obtain multiple normal pattern prototypes, and determine the detection threshold based on the energy anomaly score of the normal training window relative to the multiple normal pattern prototypes. Step 6: Generate a window-level hybrid variable representation for the test window and calculate its energy anomaly score relative to multiple normal mode prototypes. Compare the energy anomaly score with the detection threshold and output the normal or abnormal detection result.
2. The method for detecting anomalies in industrial mixed-variable processes as described in claim 1, characterized in that: The next-time state prediction network in step 2 includes variable-level category embeddings corresponding to each DV, a shared temporal encoder, a shared context mapping network, and independent classification prediction heads corresponding to each DV. For the j-th DV in the i-th normal training window, its historical state sequence is processed by the corresponding variable-level category embedding and shared temporal encoder to obtain the variable historical dynamic representation. The variable historical dynamic representations of all DVs are aggregated and formed into a joint DV historical context through a shared context mapping network. Each independent classification prediction head predicts the next time-step state probability distribution of the corresponding DV based on the joint DV historical context. The variable-level cross-entropy prediction loss of all DVs is jointly optimized in an equal-weighted manner.
3. The method for detecting anomalies in industrial mixed-variable processes as described in claim 2, characterized in that: The prediction difficulty scores are sorted in descending order, and the dividing boundary is determined using an inflection point strategy. High prediction difficulty DVs are automatically classified as pseudo-discrete variables (PDVs), and low prediction difficulty DVs are automatically classified as intrinsic discrete variables (TDVs). Specifically, the average cross-entropy prediction loss of the j-th DV on normal training data is used as its prediction difficulty score. Sort all DV prediction difficulty scores in descending order, and use an inflection point strategy to determine the dividing position k. High prediction difficulty DVs located before the dividing point are classified as PDVs, and low prediction difficulty DVs located after the dividing point are classified as TDVs.
4. The method for detecting anomalies in industrial mixed-variable processes as described in claim 1, characterized in that: In step 3, the OCV window digest and TDV event digest are used as conditional information to recover the PDV latent continuous sequence and obtain the PDV latent continuous representation. The TDV event representation is composed of the current state embedding, variable identity embedding, directed state transition embedding, state duration embedding, window end marker embedding, and the OCV time representation of the time position corresponding to the event marker. A maximum number of event markers to retain is set for each TDV. When the number of candidate event markers exceeds Event markers containing state transitions are preferentially retained, and fixed prior weights are set for state transition markers and state retention markers respectively, wherein the fixed prior weight of the state transition marker is greater than the fixed prior weight of the state retention marker. ; ; in, This represents the index of the TDV event tag in the i-th window; and These represent the current state embedding, variable identity embedding, directed state transition embedding, state duration embedding, and window end marker embedding, respectively. This indicates the time position corresponding to the event marker within the i-th window. This indicates the time-continuous process characteristics of the OCV corresponding to this position; This represents the learnable linear projection matrix used to map OCV temporal features to the event representation space; This represents an event representation mapping network; This represents the first [event] obtained after fusing discrete event information with the corresponding continuous process context. Each TDV event is marked with its original representation; This represents the TDV event representation obtained after applying prior weights to the event type; and These represent the fixed prior weights corresponding to the state transition event flag and the state persistence event flag, respectively. This aims to improve the information contribution of state transition events in subsequent heterogeneous feature interactions.
5. The method for detecting anomalies in industrial mixed-variable processes as described in claim 1 or 4, characterized in that: In step 3, the PDV latent continuous sequence is recovered through the PDV latent continuous recovery module. The PDV latent continuous recovery module includes variable-level state embedding, shared mapping, characteristic linear modulation FiLM, and latent continuous mapping network. The OCV continuous process representation is time-pooled to obtain the OCV window digest, and the TDV event representation is masked average pooled to obtain the TDV event digest. The OCV window digest and TDV event digest are used as conditional information to modulate the PDV representation and recover the PDV latent continuous sequence. ; in, This indicates a PDV potential continuous recovery module. This represents the PDV state sequence in the i-th window. This represents a summary of TDV window events. This represents a summary of the OCV window-level continuous process.
6. The method for detecting anomalies in industrial mixed-variable processes as described in claim 1, characterized in that: In step 4, the OCV continuous process representation and the PDV latent continuous representation are concatenated along the feature dimension and mapped to obtain the continuous process backbone. The TDV event representation is projected through the first linear projection to obtain the Query. The continuous process backbone is projected through the second and third linear projections to obtain the Key and Value, respectively. Multi-head attention interaction is then performed to obtain the event-related continuous process response. The obtained valid TDV event responses are subjected to masked average pooling, and the pooled window-level event responses are extended to the window time dimension. Residual fusion and layer normalization are then performed with the continuous process backbone. To obtain the final mixed-variable time series representation ; ; ; in, , and These represent the learnable linear projection matrices used to generate the query, key, and value, respectively. This represents multi-head attention computation; This represents the event-related continuous process response obtained by each TDV event in the i-th window for the continuous process backbone; This represents the window-level event response obtained by aggregating all valid TDV event responses in the i-th window. , This represents a column vector of length L consisting entirely of 1s, used to extend window-level event responses to all time positions within the window.
7. The method for detecting anomalies in industrial mixed-variable processes as described in claim 1, characterized in that: In step 5, the differential representation network's training loss includes OCV mask reconstruction loss. PDV state reconstruction loss and PDV potential continuous-time smoothing loss The OCV mask reconstruction loss is calculated only at the locations of the masked continuous observations; the PDV state reconstruction loss is used to constrain the PDV latent continuous subspace to recover the original discrete state; and the PDV latent continuous-time smoothing loss is used to limit unfounded drastic changes in the latent continuous representation at adjacent time points. The specific calculation formulas for each loss are as follows: ; Where N is the number of normal training windows, and L represents the length of the sliding window. Indicates the number of OCVs. Indicates an OCV index; This represents the mask indicator for the c-th OCV at the t-th time position in the i-th training window. It is set to 1 when the position is occluded and 0 otherwise. and These represent the reconstructed value and the original observation value at the corresponding location, respectively; Represents the Huber loss function; ; in, Represents the cross-entropy loss function. Indicates the number of PDVs. Indicates a PDV index; This represents the output of the state category predicted by the state reconstruction head corresponding to the m-th PDV based on its latent continuous representation; This represents the original discrete state of the m-th PDV at the t-th time position of the i-th training window; , in, The potential continuous representation dimension of a single PDV; This represents the latent continuous representation of all PDVs at time position t in the i-th training window; This represents the square norm 2.
8. The method for detecting anomalies in industrial mixed-variable processes as described in claim 1, characterized in that: In step 5, the window-level mixture variable representation of all normal training windows is extracted. K-means clustering is used to cluster the window-level mixture variable representations of all normal training windows, with the K cluster centers serving as normal pattern prototypes. For the i-th window, its window-level mixture variable representation and each normal pattern prototype are calculated respectively. Euclidean distance between The distances are aggregated using an energy function to obtain multi-prototype energy anomaly scores. ; ; ; Where γ is the temperature parameter.
9. The method for detecting anomalies in industrial mixed-variable processes as described in claim 8, characterized in that: The detection threshold τ is determined based on the q-quantile of the multi-prototype energy anomaly scores across all normal training windows. During the testing phase, the PDV / TDV partitioning, differential representation network, and normal mode prototype obtained during training are used. When the multi-prototype energy anomaly scores in the testing window... If the value is greater than the detection threshold τ, it is considered abnormal; otherwise, it is considered normal. ; ; in, This represents the anomaly detection prediction label for the i-th test window. This indicates that the test window has been determined to be normal. This indicates that the test window has been determined to be abnormal. Let q represent the quantile function, and N represent the number of normal training windows.
10. An anomaly detection system for an industrial mixed-variable process, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the industrial mixed-variable process anomaly detection method according to any one of claims 1 to 9.
