A structural similarity-based time series anomaly detection optimization objective method
By using a loss function and reconstruction model based on structural similarity, the problem of existing technologies being unable to capture global trends and local morphological features of time series is solved, and high-precision anomaly detection of long-term series data is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIHANG UNIV
- Filing Date
- 2026-03-02
- Publication Date
- 2026-06-09
Smart Images

Figure CN122174098A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer science, and more specifically, to an optimization method for time series anomaly detection based on structural similarity. Background Technology
[0002] Time series anomaly detection plays a crucial role in intelligent operation and maintenance, industrial monitoring, and other fields. Its main objective is to promptly identify points or subsequences that may represent system anomalies or faults from continuous time-series data. Anomaly detection has been applied in traditional fields for a considerable period, especially in machine learning and statistics, where most methods rely on classical statistical models and rule-based threshold detection. However, with the increase in data volume, particularly the lengthening of time spans and the increase in data dimensionality, traditional methods show increasing limitations when dealing with large-scale, high-dimensional, and complex data. Anomaly detection, especially for long-term series, presents greater challenges in terms of time dependence, nonlinearity, and data noise. With the development of artificial intelligence, deep learning methods, leveraging their advantages in automatic feature extraction, time-dependency modeling, and nonlinear pattern recognition, have achieved new breakthroughs in time series anomaly detection tasks, providing a new paradigm for this task.
[0003] 1. Temporal anomaly detection methods based on traditional approaches Traditional time-series anomaly detection methods can be broadly categorized into two approaches: knowledge-based reasoning and traditional machine learning-based anomaly detection. Knowledge-based reasoning combines domain knowledge with data-driven techniques for anomaly identification. In time-series anomaly detection tasks, domain knowledge provides the model with additional contextual information and rule constraints, helping to identify more complex anomaly patterns. The core idea of this approach is to use reasoning mechanisms and knowledge bases (such as rule bases, expert experience, and external databases) to assist analysis and identify possible anomalies or change patterns. However, knowledge-based reasoning also has some limitations. First, knowledge reasoning relies on expert experience and domain knowledge, which may not be able to update and adapt to new anomaly patterns in rapidly changing application scenarios. Second, building an efficient knowledge base and reasoning mechanism is a complex task, requiring the integration of multidisciplinary knowledge and incurring high maintenance costs. Therefore, this type of method is typically used in domains with well-defined rules and relatively fixed anomaly patterns, but it may not perform optimally when dealing with highly dynamic and unstructured long-term series data. In traditional time series anomaly detection, two common strategies are employed: supervised learning based on classification models and unsupervised learning based on clustering and distance metrics. Supervised learning methods train a classifier using labeled data (i.e., known normal and anomalous time series data) to learn the features and patterns of anomalies. For example, SVM-based anomaly detection methods categorize time series data into normal and anomalous classes by defining hyperplanes for normal and anomalous data. Unsupervised learning methods (such as K-Means clustering) cluster similar data points by calculating similarity metrics between time series and identify anomalous points that are far removed from the majority of data points. However, traditional machine learning methods typically require manual feature design and often assume that data points are independent or follow a certain distribution, which is unsuitable for time series data with long-term dependencies. Furthermore, traditional machine learning methods often exhibit lower accuracy and robustness when dealing with high-dimensional, multi-variable, and heterogeneous data, especially when handling large-scale, complex time series data.
[0004] 2. Deep Learning-Based Temporal Anomaly Detection Method Deep learning can effectively handle large-scale, nonlinear, and time-dependent time series data, which makes it highly promising for anomaly detection in various complex data environments. Deep learning-based time series anomaly detection methods mainly fall into three categories: anomaly detection based on normal representation learning, anomaly detection based on deep transfer learning, and anomaly detection based on end-to-end learning.
[0005] (1) Anomaly detection algorithm based on normal representation learning Anomaly detection methods based on normal representation learning can be further divided into two techniques: general normal representation learning and anomaly metric representation learning. The former learns normal patterns in time-series data and maps these patterns to a general representation space, thereby identifying anomalous data. Compared to traditional methods, general normal representation learning can automatically learn latent features representing "normal" states from data through deep learning models, without relying on manually designed features or prior knowledge. The latter constructs a metric space related to anomalies. This method does not simply learn the representation of normal data but focuses on learning how to measure the degree of anomalousness between data points, thus identifying anomalous data points. Although anomaly detection based on normal representation learning can effectively distinguish between normal and anomalous data, it relies too heavily on a single assumption and performs poorly when handling anomaly detection tasks with complex time dependencies and long time series.
[0006] (2) Anomaly detection algorithm based on deep transfer learning Anomaly detection methods based on deep transfer learning have achieved success in multiple fields in recent years. Its core idea is to improve the model's performance in new tasks or domains by transferring learning experience from existing models in related tasks. In time series anomaly detection, the application of deep transfer learning is mainly reflected in transferring anomaly detection experience from existing domains to new domains with scarce labeled data, especially for detecting a small number of anomaly samples in long-term series data. The core idea of transfer learning is to learn knowledge from the source domain and apply it to the target domain. By transferring knowledge from existing tasks, deep learning models can adapt to new data and tasks more quickly, especially when labeled data in the target domain is scarce, transfer learning can effectively compensate for the lack of data. For example, in medical diagnosis, since obtaining sufficient anomaly data is often difficult, transfer learning can transfer knowledge from other relevant medical data to new diagnostic tasks, improving the effectiveness of anomaly detection. The challenges of deep transfer learning in long-term series anomaly detection mainly include the following: First, how to ensure the similarity between the source and target domains to avoid negative transfer problems in knowledge transfer; second, how to design effective transfer strategies to adapt to different features and distributions that may exist in the target domain; and finally, how to achieve knowledge transfer and updating through deep learning models, which places high demands on model design.
[0007] (3) Anomaly detection algorithm based on end-to-end learning End-to-end learning is a technique that trains a unified neural network model to directly output anomaly scores from raw input data. Unlike traditional procedural methods, end-to-end learning does not require manual feature design or explicit intermediate steps. By training a deep neural network, the end-to-end model can automatically learn latent patterns from the input time-series data and output anomaly detection results. In time-series anomaly detection, end-to-end learning methods typically use deep neural network architectures such as recurrent neural networks (RNNs) or convolutional neural networks (CNNs) for modeling. For example, LSTM networks can learn the dynamic changes in time series and automatically output anomaly scores; CNN networks learn local patterns in time series through local perceptual mechanisms, thereby improving the accuracy of anomaly detection. The advantage of end-to-end learning methods is that they simplify the entire anomaly detection process, allowing the model to directly extract features from the raw data and make predictions, greatly reducing the need for manual intervention. However, end-to-end learning methods are prone to being dominated by normal samples in imbalanced data situations, leading to poor anomaly detection results; and the training process of end-to-end learning models is relatively complex, especially with long-term time-series data, resulting in long computational costs and training time.
[0008] Both traditional and deep learning-based methods have successfully constructed anomaly detection models, effectively locating anomalies. Due to the scarcity of anomaly labels, unsupervised reconstruction models based on deep learning, which learn normal data patterns, reconstruct the input, and then use the reconstruction error to calculate anomaly scores, have become the mainstream approach in research, demonstrating strong potential. In the real world, where data volumes are surging, time series data exhibit several key characteristics: complex and diverse features (long-term data involves numerous indicators or variables and various influencing factors); large time spans (long-term series have short time intervals and long dependency periods); high data correlation (long-term series show correlations both within and between series); noise interference (sensors or other devices generate noise or interference during data acquisition); and drastic data fluctuations (long-term series exhibit numerous unstable features due to their long spans). Long-term series generally show a diversified and large-scale trend of change. Compared to short-term time series, long-term series require more sophisticated data analysis techniques due to their complexity, making time series data tasks still challenging.
[0009] Therefore, the existing technology has the following problems: (1) Analysis of time series characteristics based on structural modeling Existing methods typically rely solely on point-by-point reconstruction error as the optimization objective, failing to effectively capture the global trend, periodicity, and local morphological characteristics of time series. This is especially true when the data exhibits non-stationary changes, noise interference, or abrupt trend changes, leading to a significant decrease in detection performance. This paper addresses this issue by analyzing the structural characteristics of time series through explicit structural modeling to identify key structural features.
[0010] (2) Extracting time series structural features based on structural similarity For time series anomaly detection, most methods rely on point-by-point reconstruction error as the optimization objective, easily neglecting the structural relationships and pattern similarities within the sequence. This is especially problematic when nonlinear dependencies or abrupt anomaly segments exist, leading to unstable detection performance. By introducing a structural similarity metric, the similarity between the original and reconstructed sequences in terms of global trends, local fluctuations, and periodic patterns is incorporated as a key component of the loss function. This effectively guides the model to learn the overall structural features of the sequence, thereby improving the robustness and sensitivity of anomaly detection.
[0011] (3) Application of structure-aware loss function fusion for reconstruction model By weighting and integrating the three loss functions—trend, seasonality, and morphology—a comprehensive structural similarity loss function is formed, enabling unified learning of the global and local structures of time series data. This comprehensive loss function can be flexibly embedded into existing reconstruction models without the need for additional complex modules, thereby improving the accuracy, robustness, and interpretability of anomaly detection. Summary of the Invention
[0012] The purpose of this disclosure is to provide an optimized target method for time series anomaly detection based on structural similarity, which aims to solve the problems of insufficient sensitivity to global and local structural characteristics and insufficient detection capability for point anomalies and pattern anomalies in the existing technology while maintaining point-to-point accuracy.
[0013] In general, this paper presents an optimization method for time series anomaly detection based on structural similarity. In the task of time series anomaly detection for industrial equipment, the collected industrial equipment time series is defined as... Where M represents the total length of the time series, It is a d-dimensional vector collected at timestamp i; Using the sliding window technique on the original time series Preprocessing is performed, with a window length set to t, and a fixed step size at... Slide it upwards to divide it into N consecutive subsequences, forming a set of subsequences. ; where each subsequence Each sequence contains data with t timestamps, and N is the total number of subsequences, the value of which is determined by the original sequence length M, the window length t, and the step size s, and usually satisfies the following conditions: ; Construct a reconstruction model and learn the input subsequence through an encoder. The latent features are then reconstructed by a decoder into reconstructed data with dimensions consistent with the original data. Ultimately, by comparing the original data With reconstructing data The difference is used to calculate the outlier score; among which, the subsequences need to be divided into subsequences. Systematically model the structural features of the subsequences. It can be broken down into two core components, whose mathematical expressions are shown below: Where T={1,2,...,t} represents a subsequence Time index set, The basic shape function is used to describe the periodic fluctuation characteristics of a time series, where... The periodic parameter directly reflects the strength and frequency of the periodicity of the periodic data sequence generated by industrial equipment operating at a fixed cycle. This is a trend function used to characterize the direction of change of periodic data sequences generated by the cyclical operation of industrial equipment over the overall time dimension; the model is reconstructed to represent each subsequence. Calculate an outlier score Abnormal scores The higher the value, the better the subsequence. The greater the likelihood of it being judged as abnormal.
[0014] In the basic shape function It represents the periodic attribute of the equipment during operation, that is, the fluctuation pattern that repeats within a fixed time interval in the time series.
[0015] The method for trend feature analysis and extraction during the construction of the trend function is as follows: precise trend extraction and difference quantification are achieved through Legendre polynomial projection. The specific extraction and loss calculation process is as follows: First, polynomial fitting is performed: the original sequence... With reconstruction sequence Projected onto the nth-order Legendre polynomial respectively The above yields the fitted curve, where the mathematical expression for the fitted curve is: , These are the polynomial coefficients of the sequence, and t is the time index; next, the trend order is selected: the trend order n=1; then, the trend loss is defined: the trend loss adopts... The combination of norm and negative logarithm; finally, the trend loss of the trend terms of the original and reconstructed sequences is calculated using the following formula: .
[0016] The method for constructing the periodic attributes is as follows: Periodic features are extracted using Fast Fourier Transform (FFT), and the specific process is as follows: First, frequency domain transformation: For the original sequence... With reconstruction sequence Perform FFT operations to obtain the frequency domain complex sequences F(X) and F(X′); then, perform differential quantization: using... The norm is used to calculate the difference between the frequency domain sequences; then, the optimization objective is determined, and the periodicity attribute loss of the original and reconstructed sequences is calculated using the following formula: .
[0017] The method for determining the basic shape function is as follows: First, extract morphological differences: morphological fluctuation information is obtained by comparing differences point by point, that is, for the original sequence With reconstruction sequence Each timestamp data and The differences are calculated using absolute value operations; the morphological loss of the shape terms of the original and reconstructed sequences is calculated using the following formula: .
[0018] The loss function of the reconstructed model is constructed as follows: The mathematical expression of the combined structure-aware loss function is:
[0019] in, These correspond to trend loss, periodic attribute loss, and pattern loss, respectively. These are the weight parameters.
[0020] The technical effects to be achieved by the embodiments of the present invention are as follows: By analyzing and modeling the structural features of time series data and incorporating structural similarity into the loss function design, this invention achieves high-precision detection of time series anomalies. It primarily addresses three issues: First, how to extract structural features of pattern anomalies? Second, given the complexity and variability of anomaly types, how to utilize structural features to determine sequence similarity and define the loss function? Third, how to apply structure-aware target optimization to the training of deep time series anomaly detection models. Attached Figure Description
[0021] The above and other objects and features of this disclosure will become clearer from the following description taken in conjunction with the accompanying drawings.
[0022] Figure 1 This is a schematic diagram illustrating the reconstruction results and reconstruction errors of the original sequence in existing technologies, with the mean squared error as an optimization objective. Figure 2 This is a schematic diagram illustrating the architecture of a time-series anomaly detection optimization target method based on structural similarity according to an embodiment of the present disclosure. Detailed Implementation
[0023] The following detailed embodiments are provided to aid the reader in gaining a comprehensive understanding of the methods, apparatus, and / or systems described herein. However, various changes, modifications, and equivalents of the methods, apparatus, and / or systems described herein will become apparent upon understanding this disclosure. For example, the order of operations described herein is merely illustrative and is not limited to those orders set forth herein, but may be changed as will become clear upon understanding this disclosure, except for operations that must occur in a specific order. Furthermore, for clarity and conciseness, descriptions of features known in the art may be omitted.
[0024] The features described herein may be implemented in different forms and should not be construed as limited to the examples described herein. Rather, the examples described herein are provided only to illustrate some of the many feasible ways of implementing the methods, apparatus, and / or systems described herein, which will become clear upon understanding the disclosure of this application.
[0025] As used herein, the term “and / or” includes any one of the associated listed items and any combination of any two or more.
[0026] Although terms such as “first,” “second,” and “third” may be used herein to describe various components, assemblies, regions, layers, or parts, these components, assemblies, regions, layers, or parts should not be limited by these terms. Rather, these terms are used only to distinguish one component, assembly, region, layer, or part from another. Thus, without departing from the teaching of the examples described herein, the first component, first assembly, first region, first layer, or first part referred to as the first component, first assembly, first region, first layer, or first part may also be referred to as the second component, second assembly, second region, second layer, or second part.
[0027] In the specification, when an element (such as a layer, region, or substrate) is described as being "on" another element, "connected to," or "bonded to" another element, the element may be directly "on" another element, directly "connected to," or "bonded to" the other element, or one or more other elements may be present in between. Conversely, when an element is described as being "directly on" another element, "directly connected to," or "directly bonded to" another element, no other elements may be present in between.
[0028] The terminology used herein is for the purpose of describing various examples only and is not intended to limit disclosure. Unless the context clearly indicates otherwise, the singular form is intended to include the plural form as well. The terms “comprising,” “including,” and “having” indicate the presence of the described features, quantities, operations, components, elements, and / or combinations thereof, but do not preclude the presence or addition of one or more other features, quantities, operations, components, elements, and / or combinations thereof.
[0029] Unless otherwise defined, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure pertains upon understanding this disclosure. Unless expressly defined herein, terms (such as those defined in a general dictionary) shall be interpreted as having a meaning consistent with their meaning in the context of the relevant field and in this disclosure, and shall not be interpreted in an idealized or overly formalistic manner.
[0030] Furthermore, in the description of the examples, detailed descriptions of well-known related structures or functions will be omitted when it is believed that such detailed descriptions would lead to a vague interpretation of this disclosure.
[0031] Figure 2 This is a schematic diagram illustrating an optimization method for time series anomaly detection based on structural similarity according to an embodiment of the present disclosure.
[0032] To achieve the aforementioned objectives, the present invention employs the following technical framework: Figure 2 As shown.
[0033] This method targets various time-series data, such as industrial current, amplitude, temperature, and velocity. Industrial production processes involve multiple types of industrial equipment, including industrial robots and sensors, which operate for extended periods, generating substantial amounts of time-series data. The heterogeneity of these devices leads to inconsistent time-series patterns, necessitating an optimization objective based on structural similarity. The proposed solution is applicable to industrial scenarios.
[0034] The overall approach revolves around three core ideas: first, to systematically model the structural features of time series to identify trends, periodicity, and local patterns; second, to extract time features based on structural similarity to guide the model in learning global and local patterns of the sequence; and third, to integrate the structure-aware loss function with the reconstruction model to achieve sensitive capture of abnormal patterns.
[0035] 1. Structural modeling analysis of time series characteristics Time series typically exhibit various morphological patterns, such as wave-like, step-like, or curve-like structures, and contain rich embedded structural information, including trends and periodicity. Reconstruction-based methods often capture underlying temporal dynamics by optimizing an objective function that only measures point-by-point distances, such as mean squared error (MSE), dynamic time warp (DTW), and mean absolute error (MAE), but completely ignores structural features such as trends and seasonality, which in turn affects the accuracy of anomaly identification. Figure 1 The results show that if the reconstruction method only considers point-by-point distance optimization, its ability to detect pattern anomalies is insufficient.
[0036] Therefore, this invention plans to utilize the characteristics of time series basic structures, analyze and judge the main structural information, and then reconstruct a structure-aware loss function.
[0037] (1) Problem definition: In time series anomaly detection tasks, time series are defined as... Where M represents the total length of the time series, It is a d-dimensional vector collected at timestamp i. When d=1, the time series is a univariate series (such as temperature monitoring data from a single device); when d>1, it is a multivariate series (such as multidimensional data such as flow rate, pressure, and temperature collected simultaneously by multiple sensors in an industrial system).
[0038] To adapt to the input requirements of reconstructing anomaly detection models, traditional methods generally employ the sliding window technique on the original time series. Preprocessing is performed. Specifically, the window length is set to t, with a fixed step size. Slide it upwards to divide it into N consecutive subsequences, forming a set of subsequences. Each subsequence Each sequence contains data with t timestamps, and N is the total number of subsequences, the value of which is determined by the original sequence length M, the window length t, and the step size s, and usually satisfies the following conditions: .
[0039] In the core task of anomaly detection, the goal of time series anomaly detection models is to detect each subsequence... Calculate an outlier score Abnormal scores The higher the value, the better the subsequence. The higher the probability of it being judged as an anomaly, the better. For the reconstruction model, its workflow involves the encoder learning the input data. The latent features are then reconstructed by a decoder into reconstructed data with dimensions consistent with the original data. Ultimately, by comparing the original data With reconstructing data Anomaly scores are calculated based on the differences between time series data and their corresponding subsequences. It is typically assumed that normal data, conforming to the "normal pattern" learned by the model, has smaller reconstruction errors and lower anomaly scores; while anomalous data, deviating from the normal pattern, has larger reconstruction errors and higher anomaly scores. To more accurately characterize the inherent patterns of time series data, this invention introduces structural modeling concepts, dividing the time series subsequences into... It can be broken down into two core components, whose mathematical expressions are shown below: Where T={1,2,...,t} represents a subsequence Time index set, The basic shape function is used to describe the periodic fluctuation characteristics of a time series, where... The periodic parameter is a parameter that directly reflects the strength and frequency of the periodicity of the sequence (such as the periodic data fluctuations generated by industrial equipment operating in a fixed cycle). This is a trend function used to characterize the direction of change of a time series over the overall time dimension (such as a slow upward trend in temperature due to equipment aging, or a downward trend in energy consumption due to seasonal factors). This decomposition provides a theoretical basis for subsequently capturing the structural characteristics of time series.
[0040] (2) Problem Analysis: While existing reconstructed time series anomaly detection models are widely applicable in unsupervised scenarios, they still face key technical bottlenecks in practical detection tasks. This is due to limitations in the optimization objectives and adaptability to complex anomaly patterns. From the perspective of optimization objectives, current mainstream reconstruction models (such as Anomaly Transformer and AOC) generally use point-by-point distance metrics as their core optimization objective, typically including mean squared error, mean absolute error, and dynamic time warping. The essence of these objective functions is to calculate the original data... With reconstructing data The model is trained by minimizing the point-to-point difference at each time stamp. However, this "point-by-point optimization" approach has a significant flaw. It focuses only on the numerical deviation of a single data point, completely ignoring the global structural information inherent in time series as "sequence data," i.e., the trend described in the formula. With periodicity And local morphological features (such as the distribution and variation patterns of peaks and valleys).
[0041] From the perspective of the contextual semantics and manifestations of abnormal patterns, anomalies in time series can be divided into two categories: "point anomalies" and "pattern anomalies." Point anomalies manifest as a significant deviation of data from the normal range at a single or a few timestamps (such as a sudden increase in values caused by a momentary sensor malfunction). While point-by-point distance metrics can capture such anomalies to some extent, they are difficult to effectively identify "pattern anomalies" (such as a sudden reversal of the sequence trend, the disappearance of periodicity, or abrupt changes in frequency). For example, in an industrial water treatment system, if equipment failure causes the originally periodic flow data to become irregularly fluctuating, or if the seasonal peak electricity consumption pattern in the power load data is suddenly delayed, these anomalies will not produce extreme point-by-point errors at a single data point, but they will disrupt the overall structure of the sequence. Models that rely on point-by-point optimization objectives, because they have not learned structural features, often misjudge such pattern anomalies as normal data, leading to a significant decrease in detection accuracy.
[0042] Further structural decomposition of the structural modeling formula reveals that the core deficiency of existing models lies in their inability to accurately fit the structural parameters of time series. When a time series changes in trend or periodicity, point-by-point distance metrics cannot quantify this structural bias; they can only reflect local numerical fluctuations. For example, if the original series exhibits a "slow upward" trend while the reconstructed series shows a "stable" trend, the model may classify the point-by-point errors as "well-reconstructed" due to smaller local fluctuations, even though significant structural biases already exist. Therefore, to address this issue, the structural information of the time series must be incorporated into the design of the loss function, including structural features such as trend, periodicity, and shape in the optimization objective. This will enable the model to be highly sensitive to both types of anomalies simultaneously.
[0043] (3) Structural modeling: To overcome the limitations of existing models, the core idea of this invention, StrAD, is to systematically model the structural features of time series and design a new loss function based on structural similarity, guiding the model to learn the inherent patterns of time series from a structural perspective. Combining the decomposition logic of the structural modeling formula, StrAD explicitly divides the structural elements of time series into three dimensions: trend, seasonality, and shape. Through feature extraction and difference quantification of each dimension, it achieves precise alignment of the original data and reconstructed data at the structural level. Based on the formula... StrAD decomposes and expands structural elements as follows: Trend: Corresponding to the formula A trend represents the overall direction and rate of change of a time series over a longer period, reflecting the "global trend" of the series. For example, the slow rise in temperature caused by component aging during equipment operation, or the year-on-year increase in urban water consumption due to population growth, are both characteristics of a trend. The core attributes of a trend are "smoothness" and "direction." Its changes are usually gradual rather than instantaneous, a characteristic that distinguishes it from local numerical fluctuations.
[0044] Seasonality: (as in the formula) The periodicity of the parameter Seasonality directly determines the recurring fluctuation pattern of a time series within fixed time intervals. Here, "season" doesn't just refer to natural seasons, but rather to a broader sense of periodicity, such as the daily cycle of electricity load ("morning peak - noon trough - evening peak"), the weekly cycle of traffic flow ("weekday high - weekend low"), and the operational cycles of equipment running according to fixed procedures in industrial production. The core attributes of seasonality are "repetition" and "regularity," and its frequency... It is a key indicator for quantifying seasonality.
[0045] Shape: refers to the shape in the formula. The extension of shape represents the morphological characteristics of a time series within a local time window, belonging to the category of "local structure." Specifically, this includes the location and amplitude of the series' peaks and troughs, the slope of the rising / falling edges, and the density of local fluctuations. For example, the shape within a single heartbeat cycle in electrocardiogram data, and the local pattern of "rapid rise - slow fall" in stock data, both belong to shape characteristics. The core attributes of shape are "locality" and "morphological uniqueness," which are key to distinguishing different short-term patterns.
[0046] The three structural characteristics mentioned above together constitute the complete structure of a time series: trend determines the overall direction, seasonality determines the cyclical fluctuation pattern, and shape determines the local morphological details. The three are interconnected and together depict the potential structural characteristics of the time series.
[0047] (4) Extracting time series structural features based on structural similarity Time series data typically possesses multi-layered intrinsic structural features. Based on structural modeling analysis, three key characteristics have been identified: trend, seasonality, and shape. Capturing and modeling these features is crucial for the detection of time series anomalies. To accurately quantify the characteristics of these three structural dimensions, StrAD has designed targeted analysis and extraction methods for the attributes of different dimensions, while also considering noise resistance.
[0048] Trend feature analysis and extraction: In the structural characteristics of time series, trend is the core dimension reflecting the long-term direction of change in the series, directly related to the accuracy of understanding and reconstructing the "global trend" of the data. According to the definition of the StrAD method, trend is abstracted as a function Θ(T) that depends only on the time variable T. Its essence is the continuous change pattern of the time series within a relatively long time window, such as the slow rise in industrial equipment temperature over operating time, or the periodic fluctuations of financial indices with the economic cycle. This type of trend characteristic has two key attributes: first, continuity—normal trend changes are usually smooth and gradual, without sudden abrupt changes; second, scale dependence—as the analysis time window increases, the impact of trend fluctuations becomes more significant. For example, a small temperature rise within a 1-hour window may be ignored, but a cumulative upward trend within a 1-day window will clearly appear.
[0049] The core flaw of existing reconstruction models lies in their inability to capture trend-level deviations through pointwise error optimization alone. For example, if the original sequence exhibits a linear upward trend while the reconstructed sequence shows a stationary trend, the pointwise errors at local timestamps may be small, but the global trend has fundamentally deviated, ultimately leading to insufficient sensitivity of the model to "trend-abrupt anomalies" (such as trend reversals caused by equipment failure). Therefore, the StrAD method proposes to solve this core problem by achieving accurate trend extraction and difference quantification through Legendre polynomial projection.
[0050] The Legendre polynomial is suitable for trend extraction because its core advantages lie in its orthogonality and smooth fitting ability: This polynomial satisfies orthogonality on a fixed interval [−1, 1], and can accurately fit smooth curves with a small number of terms, avoiding overfitting noise; at the same time, its mathematical properties ensure effective characterization of linear and low-order nonlinear trends. The specific extraction and loss calculation process is as follows: Polynomial fitting: adapting the original sequence With reconstruction sequence Projected onto the nth-order Legendre polynomial respectively The fitted curve is obtained by applying the above method. The mathematical expression for the fitted curve is: , , where are the polynomial coefficients of the sequence, and t is the time index.
[0051] Trend order selection: This invention recommends n=1 for StrAD because in most practical scenarios, the long-term trend of time series is mainly linear (such as equipment aging, resource consumption, etc.), and linear fitting can effectively avoid overfitting of higher-order polynomials to noise, while reducing computational complexity. In this case, the trend difference can be simplified to the difference in linear coefficients.
[0052] Trend loss definition: To balance training stability and anomaly sensitivity, trend loss adopts a " The combination of "norm + negative logarithm". norm ( By summing the absolute values of trend differences, excessive interference from outliers on losses can be effectively suppressed; a small constant ε (such as...) The negative logarithm is used to avoid the meaningless situation of "log(0)" in logarithmic operations; the negative logarithm operation maps trend differences to loss values, so that "small differences correspond to small losses and large differences correspond to large losses", ensuring that the model prioritizes the optimization of trend bias at the structural level.
[0053] Finally, the trend terms of the original and reconstructed sequences are calculated using the following formula: Through this process, StrAD can accurately quantify the trend differences between the original sequence and the reconstructed sequence, enabling the model to not only focus on point-by-point values during the learning process, but also to capture the consistency of the global trend, thus making it highly sensitive to anomalies such as "trend breakouts".
[0054] Seasonal characteristics analysis and extraction: Seasonality is the periodic fluctuation characteristic of a time series that repeats within fixed time intervals, corresponding to the formula... Medium shape function Its periodicity is quantified by the frequency parameter. . The value of directly determines the length of the seasonal cycle. In real-world scenarios, seasonality is widely present in industries such as manufacturing, finance, and the environment. For example, the operational cycle of equipment in industrial production, which follows a fixed process of "start-stop-operation-maintenance," and the daily cycle of urban electricity load, which follows a pattern of "morning peak-noon trough-evening peak," are both typical seasonal characteristics.
[0055] However, real time series inevitably contain noise (such as sensor errors and sudden interference), which can mask the true periodic signals, making it difficult for traditional point-by-point optimization methods to accurately identify seasonality. For example, the true period of a temperature monitoring series is 24 hours, but noise causes some timestamps to deviate from the periodic pattern. If judged solely by point-by-point error, the model may mistakenly regard "noise interference" as normal fluctuation or ignore anomalies such as "period shift" (e.g., the period changes from 24 hours to 20 hours). To address this issue, StrAD proposes using Fast Fourier Transform (FFT) to extract seasonal features. Its core advantage lies in transforming the time series from the "time domain" to the "frequency domain," accurately capturing potential periodic patterns while suppressing noise.
[0056] The principle behind FFT for seasonality extraction is that the periodic fluctuations of a time series are represented in the frequency domain by the peak amplitude of a specific frequency component; the higher the amplitude, the stronger the periodicity of the corresponding frequency. Based on this principle, the seasonality extraction and loss calculation process of StrAD is as follows: Frequency domain transformation: for the original sequence With reconstruction sequence Perform FFT operations to obtain the frequency domain complex sequences F(X) and F(X′). The essence of FFT is to decompose the time series into the sum of sine / cosine components of different frequencies, and the complex modulus (amplitude) of each component represents the contribution of that frequency to the original sequence.
[0057] Quantification of seasonal differences: using Norm calculations determine the differences in frequency domain sequences. The reason for choosing the norm is that it can linearly sum the differences of all frequency components, especially highlighting the differences of high-amplitude frequency components (i.e., the main seasonal cycles). For example, if the daily cycle component amplitude of the original sequence is 10 and the daily cycle component amplitude of the reconstructed sequence is 5, the difference in this frequency component will significantly increase the seasonality loss, forcing the model to optimize for periodic consistency.
[0058] Seasonal optimization objective: The core role of seasonal loss is to guide the model to align the long-term periodic variations of the original and reconstructed sequences. By minimizing seasonal differences, the model prioritizes the consistency of "high-contribution frequency components," ensuring that the main seasonal cycles (such as daily and weekly cycles) of the reconstructed sequence are consistent with the original sequence. This process effectively suppresses noise interference, as noise typically exhibits "low amplitude and wide frequency distribution" in the frequency domain, which has a relatively low impact on... The contribution of the norm is much smaller than that of the main periodic components, thus avoiding the model being misled by noise.
[0059] Therefore, the seasonal terms of the original sequence and the reconstructed sequence are calculated using the following formula: In practical applications, this method is particularly effective for noisy industrial and environmental data. For example, in flow monitoring of water treatment systems, even if there are sensor errors in the data, FFT can still capture the "pump start-stop cycle once per hour" and ensure that the cycle of the reconstructed sequence is consistent with the original sequence through seasonal loss, thereby achieving accurate detection of anomalies such as "cycle disappearance" (such as periodic interruptions caused by pump failure).
[0060] Morphological feature analysis and extraction: Morphology refers to the local structural features of a time series, mainly manifested as local morphological patterns such as peaks, troughs, and rising / falling edges within a short time window. It is a key dimension for distinguishing between "local anomalies" and "normal fluctuations." Unlike trends (global) and seasonality (long-term cycles), morphological features are characterized by locality and correlation among multiple data points: locality means that morphological features only reflect changes within a short period (such as a sudden rise or fall in temperature within 5 minutes); correlation among multiple data points means that a single morphological feature (such as a "peak") needs to be composed of data from multiple consecutive time stamps. For example, a complete "peak" pattern includes three stages: "rise-peak-fall," involving data from at least three time stamps.
[0061] Existing reconstruction models, relying on pointwise losses such as MSE, suffer from the drawback of "over-amplifying local errors." For example, if the original sequence has a small peak (e.g., temperature rises from 25℃ to 27℃ and then drops back to 25℃), the peak amplitude deviation of the reconstructed sequence is only 0.5℃. However, MSE amplifies this deviation through squaring, causing the model to overemphasize local numerical fluctuations and ignore more critical morphological anomalies such as "peak position shifts." Conversely, if a data point exhibits an extreme value due to noise, MSE will dominate the loss calculation, causing the model to deviate from learning normal morphologies. To address this issue, StrAD proposes a method based on "pointwise differences..." The morphological loss of the "norm" enables precise quantification and optimization of local morphological features.
[0062] The morphological feature analysis and loss calculation process of StrAD revolves around "suppressing local noise and focusing on morphological consistency," as detailed below: The core components of morphological features: The essence of morphological features is local fluctuation patterns, mainly including two categories: one is the "extreme point pattern" (such as the position and amplitude of peaks and troughs), and the other is the "trend change pattern" (such as the slope of the rising edge and the duration of the falling edge). These patterns are all reflected by the differences of multiple consecutive data points. For example, the identification of peaks needs to be achieved through the difference combination of "the previous data point rising and the next data point falling", and the calculation of the slope needs to be achieved through the difference between adjacent data points.
[0063] Method for extracting morphological differences: Morphological fluctuation information is obtained through "point-by-point difference comparison," that is, comparing the original sequence... With reconstruction sequence Each timestamp data and Calculate the difference. Unlike the square operation of MSE, StrAD uses the absolute value operation (i.e., The reason for this loss is that absolute values prevent small local errors from being amplified by squared values, while also preventing extreme noise points (such as a single outlier) from dominating the loss. For example, if the point-by-point difference of a data point is 2 (due to noise), MSE will amplify it to 4, while... The norm is kept to 2, so that the loss can better reflect the consistency of the overall shape.
[0064] The mathematical definition of morphological loss: The optimization objective of this loss is to ensure the consistency of the original sequence and the reconstructed sequence in terms of "local fluctuation patterns." For example, if the original sequence in... The timestamps exhibit a "rising-peaking-falling" pattern. The reconstructed sequence must show a similar pattern at the same positions; otherwise, it must be reconstructed point by point. The sum of the differences will increase significantly, forcing the model to adjust the reconstruction results.
[0065] Therefore, the shape terms of the original sequence and the reconstructed sequence are calculated using the following formula: In practical testing scenarios, morphological loss plays a particularly crucial role. For example, in medical electrocardiogram (ECG) monitoring data, the morphology of a normal heartbeat has a fixed local pattern. If the peak position of a certain segment of data shifts or the slope becomes abnormal (potentially indicating arrhythmia), morphological loss will be detected point by point. The accumulation of differences transforms this local morphological anomaly into a high loss value, which is then identified as an anomaly by the model; while traditional MSE, due to its excessive focus on numerical deviation, may miss this critical situation of "morphological anomaly but small numerical deviation".
[0066] In summary, StrAD achieves comprehensive coverage of time series structural features through feature analysis and loss design across three dimensions: trend, seasonality, and pattern. Trend loss ensures global consistency, seasonality loss guarantees long-term cycle alignment, and pattern loss focuses on local pattern matching. The synergistic effect of these three factors enables the model to be highly sensitive to both point anomalies and pattern anomalies, providing a better optimization direction for time series anomaly detection.
[0067] (5) Application of structure-aware loss function fusion for reconstruction model Combinatorial structure-aware loss function: In time series anomaly detection, single-dimensional feature losses are insufficient to fully characterize the structural patterns of a sequence. The StrAD method, however, constructs a three-dimensional structure-aware loss function that integrates trend, seasonality, and morphology. By weightedly combining the loss components from these three dimensions, it achieves unified optimization of the global and local structure of the time series. This combined loss function not only overcomes the shortcomings of traditional pointwise losses that ignore structural information but also, through scientific weight allocation and mathematical design, ensures that the model is highly sensitive to global trend deviations, long-term periodic shifts, and local morphological anomalies.
[0068] The mathematical expression for the combinatorial structure-aware loss function is: in, These correspond to trend loss, seasonality loss, and pattern loss, respectively. The weight parameter is used to balance the contribution of the three structural features in the loss function, ensuring that the model does not ignore other key structural information due to over-optimization of one feature.
[0069] From the perspective of the synergistic logic of each loss component, the three exhibit a complementary relationship of "global-long-term-local": Trend loss ( Based on Legendre polynomial projection and negative logarithm Norm design focuses on the global direction of change in time series. Its core function is to ensure the consistency of the original and reconstructed sequences in long-term trends, such as the slow upward trend of equipment temperature with operating time, or the overall fluctuation direction of urban water consumption with seasonal changes. The mathematical form avoids the interference of local noise on trend judgment, and can amplify the loss caused by trend deviation through negative logarithmic operation, so that the model prioritizes the optimization of global structure alignment.
[0070] Seasonal losses ( ): This method utilizes the Fast Fourier Transform (FFT) to convert time series data to the frequency domain, through... The loss component quantifies the difference between the original and reconstructed sequences in the frequency domain, focusing on capturing long-term periodic patterns. For example, daily cycles formed by equipment following fixed processes in industrial production, and seasonal cycles in environmental monitoring data, can all be aligned periodically through this loss component. Since FFT can effectively suppress noise (noise exhibits low amplitude and wide distribution characteristics in the frequency domain), this loss component ensures that the model is not affected by local disturbances and accurately learns the core periodicity of the sequence.
[0071] Morphological loss ( ): Using point-by-point Norm summation focuses on the local morphological features of time series, such as the location and magnitude of peaks and troughs, and the slope of rising / falling edges. This differs from the squaring operation of traditional MSE. Norms can prevent small local errors from being over-amplified, while preventing extreme noise points from dominating loss calculations, ensuring that the model focuses on key morphological anomalies such as "peak shift" and "slope anomaly," rather than numerical fluctuations of a single data point.
[0072] Weight parameters The setting of the combined loss function is crucial for its effectiveness; its value must take into account both dataset characteristics and domain knowledge. Dynamic update strategy: The gradient can be dynamically adjusted according to the gradient during the model training process. If the gradient of a certain loss component is consistently small, it indicates that the model has not learned enough of the structural feature and the corresponding weight needs to be increased appropriately. Conversely, if the gradient is too large, the weight needs to be reduced to avoid over-optimization.
[0073] Manual adjustment strategy: Based on prior knowledge of the domain, for example, in industrial equipment monitoring data, trends (equipment aging) and morphology (instantaneous fluctuations in failure) are more critical and can be controlled and adjusted. The value can be adjusted; however, seasonality is more pronounced in environmental monitoring data (such as temperature), and the value can be increased. The value of .
[0074] By using this combined loss function, StrAD achieves a shift from "point-by-point numerical optimization" to "structural feature optimization," enabling the model to simultaneously identify complex point anomalies and pattern anomalies, laying the foundation for improving subsequent anomaly detection accuracy.
[0075] Integrated application of time series reconstruction models: The significant advantage of the StrAD method lies in its high flexibility and versatility. It can seamlessly integrate with various time series reconstruction models without modifying the network architecture of existing reconstruction models, simply by replacing the loss function. This "plug-and-play" integration approach not only reduces the cost of technology implementation but also fully leverages the architectural advantages of different reconstruction models, consistently improving performance in both univariate and multivariate time series scenarios.
[0076] As shown in Figure 2, from the perspective of the integration process, the combination of StrAD and the reconstruction model strictly follows the closed-loop logic of "encoding - reconstruction - structural loss calculation - parameter update": Model initialization: First, initialize the encoder (E) and decoder (D) parameters of the reconstructed model. The encoder is responsible for processing the input time series. The sequence is mapped to a low-dimensional latent feature H, and the decoder then reconstructs H to have the same dimension as the original sequence. Neither the attention mechanism architecture of Anomaly Transformer nor the contrastive learning architecture of AOC requires adjusting structural parameters such as the number of network layers or hidden units; only the corresponding weights need to be initialized.
[0077] Training iteration process: In each round of training, the model first inputs time series samples. via encoder E( The latent representation H is obtained, and then the reconstructed sequence X′ is generated through the decoder D(H); subsequently, based on... and Calculate the three structural loss components separately. Trend loss is calculated using the difference in Legendre polynomial coefficients and the negative logarithm. Norm calculation, seasonal loss is obtained through FFT frequency domain difference. Norm calculation, morphological loss is obtained by point-by-point calculation. Norm summation is performed; finally, the combined structural perceptual loss is obtained by integrating according to the weights. And by updating the parameters of the encoder and decoder through the backpropagation algorithm, the minimum .
[0078] Model output: When the training iteration reaches the preset number of rounds or the early stopping condition is met (such as no improvement in the performance of the validation set for multiple consecutive rounds), the reconstructed anomaly detection model M that has been trained is output. This model has the ability to judge anomalies by the structural differences between the reconstructed sequence and the original sequence.
[0079] From the perspective of integration and versatility, StrAD can be adapted to the current mainstream refactoring models: The Anomaly Transformer model captures global correlations between sequences through an attention mechanism, while the morphological loss of StrAD compensates for the model's sensitivity to local morphological anomalies. On the AIOps dataset, integrating StrAD with the Anomaly Transformer improves the RPA F1 score by 1.42%.
[0080] AOC model: Combining autoencoders and contrastive learning, StrAD's seasonal loss helps the model align with periodic features. On the ESA space telemetry dataset, AOC integrated with StrAD improves RPA F1 by 62.11%.
[0081] The SensitiveHUE model uses a probabilistic network to reconstruct and estimate heteroscedastic uncertainty, with the core objective of enhancing sensitivity to normal patterns. However, the original optimization goal focuses on fitting local numerical probabilities, resulting in a weaker grasp of global trends. The trend loss function of StrAD can compensate for this deficiency, guiding the model to learn the long-term direction of change. On the WADI dataset, after integrating StrAD into SensitiveHUE, the RPA F1 score increased from 31.58% to 35.71%.
[0082] This integration method, which "does not change the model architecture but only optimizes the objective function," retains the architectural advantages of the original model while compensating for the shortcomings of its optimization objective through structure-aware loss, achieving a performance improvement effect of "1+1>2".
[0083] Anomaly detected in the refactoring method: The reconstruction model based on StrAD integration follows a core process of "normal pattern learning - reconstruction difference quantification - anomaly score determination" for anomaly detection. By capturing the fundamental principle that "normal sequences have small reconstruction errors, while abnormal sequences have large reconstruction errors," it achieves accurate identification of two types of anomalies (point anomalies and pattern anomalies). This detection process not only fully utilizes the structural sensitivity of the combined structure-aware loss function but also ensures the accuracy and robustness of the detection results through scientific anomaly score calculation and threshold setting.
[0084] Normal mode learning phase During model training, StrAD guides the reconstructed model to learn the normal structural patterns of time series data by combining a structure-aware loss function. Specifically, the model prioritizes learning the following three normal patterns: Normal trend patterns: such as the linear temperature increase trend during normal operation of industrial equipment, the steady fluctuation direction of financial indices, etc. Through the optimization of the trend loss term, the model will encode these trend features into the latent space H.
[0085] Normal periodic patterns, such as the daily cycle of urban electricity load and the seasonal cycle of ambient temperature, are learned by optimizing the seasonal loss term. The model will remember these periodic frequency characteristics to ensure that the period of the reconstructed sequence is consistent with the original normal sequence.
[0086] Normal morphological patterns: such as the current "rise-stable-fall" pattern during normal start-up and shutdown of equipment. Through optimization of the shape loss term, the model will learn the detailed features of these local morphologies.
[0087] Since the training data only contains normal sequences (unsupervised scenarios), the model cannot learn the structural patterns of abnormal sequences. Therefore, when faced with abnormal sequences, it will produce significant reconstruction bias because it cannot match the learned normal structures.
[0088] Reconstructing Difference Quantification and Outlier Score Calculation During the detection phase, the time series of the input test set is used. The model generates a reconstruction sequence through the encoder and decoder. Subsequently, based on the combined structure-aware loss function, the calculation is performed. and The structural differences are analyzed and transformed into anomaly scores S. The calculation logic of the anomaly scores is directly linked to the combined loss function: like The sequence is a normal sequence, and its structural features (trend, seasonality, morphology) highly match the normal patterns trained by the model. The reconstructed sequence... and Small structural differences, combination loss Small, corresponding to a low abnormal score S.
[0089] like An anomalous sequence is one whose structural features deviate from normal patterns (such as trend reversal, period disappearance, and abnormal patterns). The reconstructed sequence cannot match these anomalous structures, leading to combined loss. A significant increase corresponds to a high abnormal score S.
[0090] Specifically, the outlier score S is usually directly applied using the combined structure perception loss. The value.
[0091] Anomaly detection and threshold setting The core of anomaly detection is to set a reasonable threshold τ: when the anomaly score S of the test sequence is greater than or equal to τ, it is considered anomaly; when S is less than τ, it is considered normal.
[0092] In terms of detection performance, the StrAD-based reconstruction method demonstrates excellent detection capabilities for both types of anomalies: Point anomaly detection: such as extreme values caused by momentary sensor malfunctions, these anomalies can disrupt local morphological features, making... The abnormal score S increases significantly and is thus accurately identified by the model.
[0093] Pattern anomaly detection: such as trend reversal caused by equipment failure ( Increase), periodic disappearance ( Increase), local morphological shift ( While such anomalies (such as increases) may not produce extreme pointwise errors, they can be captured by the model through an increase in structural loss. In summary, the StrAD-based reconstruction method for anomaly detection essentially transforms structural information into quantifiable anomaly indicators through the logic of "learning normal structure - quantifying structural deviations - determining anomaly scores." This breaks through the limitations of traditional pointwise loss methods that only focus on numerical deviations, thus achieving efficient identification of complex anomaly patterns.
[0094] This invention provides the technical implementation of the proposed algorithm, using PyTorch and the Merlion time series machine learning library to build the model architecture, and completing training and validation on an NVIDIA Tesla V100 GPU. The structure-aware loss function mechanism proposed in this invention effectively solves the core problem of traditional reconstruction anomaly detection methods ignoring the structural features of time series data. By incorporating the three structural elements of time series—trend, seasonality, and shape—into the optimization objective, the model is guided from "point-by-point numerical fitting" to "global and local structural alignment," ultimately achieving high-precision detection of point anomalies and pattern anomalies.
[0095] Compared with traditional optimization objectives (such as MSE and DTW) and existing reconstruction anomaly detection algorithms, this invention significantly improves accuracy, robustness, and versatility in time series anomaly detection scenarios. MSE and DTW are widely used pointwise loss functions in time series reconstruction tasks, focusing only on numerical bias while ignoring structural information. AnomalyTransformer, AOC, and SensitiveHUE are state-of-the-art models in time series anomaly detection in recent years, improving detection performance through architectural innovations (such as anomaly attention mechanisms and contrastive learning), but they do not optimize the objective function for structural features. Experiments show that integrating StrAD as the optimization objective into these models effectively compensates for their insufficient structure awareness.
[0096] The performance data of the model after the experiment are shown in the table.
[0097] Table 1. Performance comparison of StrAD and MSE on three types of SOTA refactoring models Table 2 Performance comparison of StrAD, MSE, and DTW on the SensitiveHUE model This method was applied to three advanced reconstruction models, and experiments were conducted on five real-world datasets. The experimental results validated the effectiveness of the proposed method. The results show that compared to pointwise distance optimization, this method improves the overall performance of SensitiveHUE by 1.83 times. Particularly in large-scale long-term ESA datasets, the RPA F1 score is improved by 67%. The combined application of StrAD and the pointwise loss function highlights the compatibility of StrAD, effectively overcoming the performance limitations of the pointwise loss function and adapting to various reconstruction methods without modifying the model architecture. This provides an efficient solution for time-series anomaly detection in various fields such as industrial operations and maintenance, aerospace monitoring, and water treatment.
[0098] While some embodiments of this disclosure have been shown and described, those skilled in the art will understand that modifications may be made to these embodiments without departing from the principles and spirit of this disclosure, which are defined by the claims and their equivalents.
Claims
1. A time series anomaly detection optimization method based on structural similarity, characterized in that, In the task of time series anomaly detection in industrial equipment, the time series data generated by industrial robots or sensor devices in industrial production is collected. First, the time series is defined as... Where M represents the total length of the time series, It is a d-dimensional vector collected at timestamp i; Using the sliding window technique on the original time series Preprocessing is performed, with a window length set to t, and a fixed step size at... Slide it upwards to divide it into N consecutive subsequences, forming a set of subsequences. ; where each subsequence Each sequence contains data with t timestamps, and N is the total number of subsequences, the value of which is determined by the original sequence length M, the window length t, and the step size s, and usually satisfies the following conditions: ; Construct a reconstruction model and learn the input subsequence through an encoder. The latent features are then reconstructed by a decoder into reconstructed data with dimensions consistent with the original data. Ultimately, by comparing the original data With reconstructing data The difference is used to calculate the outlier score; Among them, it is necessary to divide the subsequence The structural characteristics are systematically modeled and differences are calculated, and the subsequences are... It can be broken down into two core components, whose mathematical expressions are shown below: Where T={1,2,...,t} represents a subsequence Time index set, The basic shape function is used to describe the periodic fluctuation characteristics of a time series, where... The periodic parameter directly reflects the strength and frequency of the periodicity of the periodic data sequence generated by industrial equipment operating at a fixed cycle. This is a trend function used to characterize the direction of change of periodic data sequences generated by the cyclical operation of industrial equipment over the overall time dimension; It represents the periodic attributes of equipment during operation, that is, the fluctuation pattern that repeats within a fixed time interval in a time series; By reconstructing the model for each subsequence Calculate an outlier score Abnormal scores The higher the value, the better the subsequence. The higher the probability of it being judged as abnormal, the more likely it is to be output as an abnormal result.
2. The time series anomaly detection optimization method based on structural similarity as described in claim 1, characterized in that, The difference is calculated by jointly determining the combined structure perception loss function through the judgment of trend function, periodicity attribute, and basic shape. The mathematical expression of the combined structure perception loss function is as follows: in, These correspond to trend loss, periodic attribute loss, and pattern loss, respectively. These are the weight parameters.
3. The time series anomaly detection optimization method based on structural similarity as described in claim 2, characterized in that, In the process of determining the trend function, the method for analyzing and extracting trend characteristics is as follows: Accurate trend extraction and difference quantification are achieved through Legendre polynomial projection. The specific extraction and loss calculation process is as follows: First, polynomial fitting is performed: the original sequence... With reconstruction sequence Projected onto the nth-order Legendre polynomial respectively The above yields the fitted curve, where the mathematical expression for the fitted curve is: , These are the polynomial coefficients of the sequence, and t is the time index; next, the trend order is selected: the trend order n=1; then, the trend loss is defined: the trend loss adopts... The combination of norm and negative logarithm; finally, the trend loss of the trend terms of the original and reconstructed sequences is calculated using the following formula: 。 4. The time series anomaly detection optimization method based on structural similarity as described in claim 2, characterized in that, The method for determining the periodicity attribute is as follows: Periodic features are extracted using Fast Fourier Transform (FFT), and the specific process is as follows: First, frequency domain transformation: For the original sequence... With reconstruction sequence Perform FFT operations to obtain the frequency domain complex sequences F(X) and F(X′); then, perform differential quantization: using... The norm is used to calculate the difference between the frequency domain sequences; then, the optimization objective is determined, and the periodicity attribute loss of the original and reconstructed sequences is calculated using the following formula: 。 5. The time series anomaly detection optimization method based on structural similarity as described in claim 2, characterized in that, The method for determining the basic shape is as follows: First, extract morphological differences: morphological fluctuation information is obtained by comparing differences point by point, that is, for the original sequence With reconstruction sequence Each timestamp data and The differences are calculated using absolute value operations; the morphological loss of the shape terms of the original and reconstructed sequences is calculated using the following formula: 。