Granule prototype-based context recovery temporal anomaly detection method and system

By establishing normal-state particles and performing context matching and virtual substitution, the problem of insufficient adaptability in anomaly detection in existing technologies is solved, and accurate anomaly detection is achieved in multiple normal modes.

CN123179243APending Publication Date: 2026-11-27HUAQIAO UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611645378.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-23
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing time-series anomaly detection methods struggle to accurately reflect the degree of anomaly under various normal state modes and fail to effectively combine temporal context and local fluctuation characteristics, resulting in insufficient adaptability of anomaly detection.

Method used

By establishing multiple normal state spheres, the characteristics of different normal states are represented by the sphere center and the average discrete level. Distance normalization is performed during the context matching process to construct a context reference state. Virtual substitution and anomaly detection calculations are performed, and anomaly determination is made by combining local deviation scores and context recovery gains.

Benefits of technology

It improves the adaptability of anomaly detection in multiple normal mode scenarios, can accurately reflect the degree of anomaly deviation, and provides clear criteria for anomaly judgment, avoiding the shortcomings of direct distance evaluation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123179243A_ABST
    Figure CN123179243A_ABST
Patent Text Reader

Abstract

The application provides a time series anomaly detection method and system based on granule prototype context recovery, and relates to the technical field of time series data processing and anomaly detection. The application constructs the state characteristics of historical normal time series data, reserves part of the characteristics as threshold calibration samples, uses the remaining characteristics to establish a normal state granule; only according to the state characteristics of adjacent segments before and after the to-be-detected segment, a context reference state is constructed, the Euclidean distance square of the context reference state and the granule center is normalized based on the average dispersion level of the granule, the granule center with the minimum matching amount is selected to virtually replace the to-be-detected state characteristics; the local deviation score and the context recovery gain corresponding to the context mismatch change before and after the replacement are calculated; the threshold of the two indexes is determined by using the threshold calibration samples, and when any index exceeds the corresponding threshold, it is determined as abnormal, thereby realizing the time series anomaly detection combining the local deviation and the normal prototype recovery effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of time series data processing and anomaly detection technology, and more specifically, to a time series anomaly detection method and system based on particle prototype context recovery. Background Technology

[0002] In applications such as industrial equipment operation monitoring, sensor data analysis, and information system status monitoring, the monitored objects generate a large amount of time-series data with temporal correlation during operation. Analyzing abnormal states in the time series can provide a basis for operational status monitoring and fault analysis. Since the monitored objects may have multiple normal operating modes, the data distribution, local change trends, and normal fluctuation ranges differ under different modes. Therefore, it is necessary to combine the distribution characteristics and temporal correlations of normal operating states for anomaly detection.

[0003] Existing temporal anomaly detection methods typically utilize historical data to build a normal state model and evaluate anomalies based on factors such as the distance, density difference, prediction error, or reconstruction error between the test data and the normal state model. Some methods use cluster centers or spheres to represent different local normal state patterns and determine anomalies based on the distance between the test state and the normal state prototype; others construct reference representations using temporal context and detect anomalies based on the consistency between the test state and the context.

[0004] However, for methods that select a reference model based on the distance between the current test state and the normal state prototype, anomalous offsets in the current test state may affect the selection of the normal reference model, making the selected reference model incompatible with the temporal context of the state. Furthermore, different normal state models exhibit varying degrees of local dispersion, and using absolute distance or a uniform evaluation scale may fail to accurately reflect the degree of anomalousness exhibited by the same deviation magnitude in different normal state models.

[0005] Furthermore, evaluating anomalies solely based on local differences between the current state and adjacent time states fails to simultaneously reflect the fluctuation range of the corresponding normal state pattern and the degree to which the normal reference state improves contextual consistency. In situations where multiple normal state patterns coexist, this evaluation method may affect the distinction between local normal fluctuations and anomalous deviations. Therefore, it is necessary to consider both temporal contextual relationships and the local fluctuation characteristics of different normal state patterns during the determination of the normal reference state and the evaluation of anomaly severity, in order to improve the adaptability of local anomaly detection in multi-normal-pattern scenarios.

[0006] In view of this, the applicant hereby submits this application after studying the existing technology. Summary of the Invention

[0007] This invention provides a method and system for detecting temporal anomalies based on granular prototype context recovery, in order to improve at least one of the above-mentioned technical problems.

[0008] In a first aspect, the present invention provides a method for detecting temporal anomalies based on granular prototype context recovery, comprising the following steps: S1: Obtain historical normal time series data during the operation of the target equipment, construct normal time series state features according to the preset time window after preprocessing; reserve some normal time series state features as threshold calibration samples, and use the remaining normal time series state features to establish multiple normal state spheres, and determine the sphere center and average dispersion level of each normal state sphere.

[0009] Furthermore, the preprocessing includes: before constructing the normal time series state features, performing scale unification processing on the observation data of different dimensions in the historical normal time series data; Specifically, determining the granule center and average dispersion level of each normal-state granule includes: Statistics The number of normal temporal state features within a normal-state sphere is used to obtain the number of sphere samples. And calculate the center of the pellet according to the following formula. : ; The particle dispersion statistic is calculated using the following formula. : ; The average level of dispersion is calculated using the following formula. : ; In the formula, An index representing the characteristics of the normal temporal state within a normal-state granule. Indicates the first The first normal state granule A normal time-series state feature Represents the Euclidean norm; The number of the granule samples granule center Particle discrete statistics and average level of dispersion As the first The structural parameters of each normal-state sphere are saved.

[0010] In one implementation, both the historical normal time series data and the time series data to be detected are multivariate time series data; The construction of normal time-series state features includes: Based on the observation data within each preset time window, the state information corresponding to each observation dimension is extracted. The state information includes at least one of local level, local dispersion, local change trend, and local change intensity. The state information corresponding to each observation dimension is combined to obtain the normal time series state features, and the different dimensions of the normal time series state features are subjected to scale unification processing.

[0011] In another implementation, constructing normal timing state characteristics includes: The preprocessed observation data of each dimension within each preset time window are combined in chronological order to form normal time-series state features with fixed characteristic dimensions.

[0012] S2: Process the time series data to be detected according to the preprocessing method, time window division method and feature construction method of the historical normal time series data to obtain the temporal state features of the current time segment to be detected and its adjacent time segments before and after it, and construct the context reference state only based on the temporal state features of the adjacent time segments before and after it.

[0013] The time series data to be detected is processed using the same scaling method as in step S1.

[0014] Specifically, the construction context reference state includes: The arithmetic mean of the temporal state features corresponding to the previous and next adjacent time segments is used as the context reference state corresponding to the current time segment under test, calculated according to the following formula: ; In the formula, This represents the index of the current time segment to be tested. and These represent the temporal state features corresponding to the preceding and following adjacent time segments, respectively. This indicates the context reference state corresponding to the current time segment being tested; S3: Calculate the squared Euclidean distance between the context reference state and the center of each particle, divide it by the sum of the corresponding average discrete level and the preset positive number to obtain the matching quantity; determine the normal state particle with the smallest matching quantity as the context matching normal particle, and use its particle center as the normal particle reference prototype to perform virtual substitution on the temporal state features of the current time segment to be tested for anomaly detection calculation.

[0015] Furthermore, the virtual substitution does not change the original time series data to be detected, the temporal state characteristics corresponding to the current time segment to be detected, or the structural parameters of each normal state particle.

[0016] S4: Calculate the squared Euclidean distance between the temporal state features of the current time segment under test and the context reference state to obtain the local deviation score; calculate the squared Euclidean distance between the normal particle reference prototype and the context reference state to obtain the context mismatch after virtual substitution; calculate the difference between the local deviation score and the context mismatch; when the difference is greater than zero, divide the difference by the sum of the local deviation score, the average discrete level of the context-matched normal particle, and the preset positive number to obtain the context recovery gain; when the difference is less than or equal to zero, determine the context recovery gain as zero.

[0017] S5: Use the threshold calibration samples to determine the local deviation threshold and the context recovery threshold respectively; when at least one of the local deviation score and the context recovery gain exceeds the corresponding threshold, the current time segment to be tested is judged as abnormal, otherwise it is judged as normal.

[0018] Furthermore, the historical normal time series data originates from industrial equipment operation monitoring systems, sensor acquisition systems, or information system status monitoring systems, and includes data from one or more observation dimensions collected continuously in chronological order.

[0019] Furthermore, the threshold calibration samples maintain their original temporal order in the historical normal time series data and do not participate in the calculation of the granular structure parameters of each normal state; Specifically, the local deviation threshold and the context recovery threshold are determined using the threshold calibration samples, including: Each threshold calibration sample is used as the temporal state feature of the current time segment to be tested. The temporal state features of the adjacent time segments are determined according to their original time positions in the historical normal time series data. The context reference state is constructed, the context matching normal particle is determined and virtual substitution is performed according to the corresponding processing methods of steps S2 to S4. The corresponding historical normal local deviation score and historical normal context recovery gain are calculated. The local deviation threshold is determined based on the statistical distribution of the historical normal local deviation scores, and the context recovery threshold is determined based on the statistical distribution of the historical normal context recovery gain.

[0020] The quantiles corresponding to the preset quantile levels in the statistical distributions of the historical normal local deviation scores and the statistical distributions of the historical normal context recovery gains are respectively taken as the local deviation threshold and the context recovery threshold.

[0021] Secondly, the present invention provides a temporal anomaly detection system based on particle prototype context recovery, comprising: The normal state sphere establishment module is used to acquire historical normal time series data during the operation of the target equipment. After preprocessing, normal time series state features are constructed according to a preset time window. Some normal time series state features are reserved as threshold calibration samples. Multiple normal state spheres are established using the remaining normal time series state features, and the sphere center and average dispersion level of each normal state sphere are determined. The context reference state construction module is used to process the time series data to be detected according to the preprocessing method, time window division method and feature construction method of the historical normal time series data, to obtain the temporal state features of the current time segment to be detected and its adjacent time segments before and after it, and to construct the context reference state only based on the temporal state features of the adjacent time segments before and after it. The particle prototype virtual substitution module is used to calculate the squared Euclidean distance between the context reference state and the center of each particle, and divide it by the sum of the corresponding average discrete level and a preset positive number to obtain the matching quantity; the normal state particle with the smallest matching quantity is determined as the context matching normal particle, and its particle center is used as the normal particle reference prototype to perform virtual substitution on the temporal state features of the current time segment to be tested for anomaly detection calculation. The anomaly evaluation calculation module is used to calculate the squared Euclidean distance between the temporal state features of the current time segment under test and the context reference state to obtain a local deviation score; calculate the squared Euclidean distance between the normal particle reference prototype and the context reference state to obtain the context mismatch after virtual substitution; calculate the difference between the local deviation score and the context mismatch; when the difference is greater than zero, divide the difference by the sum of the local deviation score, the average discrete level of the context-matched normal particle, and the preset positive number to obtain the context recovery gain; when the difference is less than or equal to zero, determine the context recovery gain as zero. The anomaly detection module is used to determine the local deviation threshold and the context recovery threshold using the threshold calibration samples respectively; when at least one of the local deviation score and the context recovery gain exceeds the corresponding threshold, the current time segment under test is determined to be abnormal, otherwise it is determined to be normal.

[0022] Compared with the prior art, the present invention has the following beneficial effects: Multiple normal state particles are established using historical normal time series data. The representative features and internal fluctuations of different normal states are characterized by the particle center and the average discrete level, respectively. In the context matching process, the distance is normalized by the average discrete level, so that the selection of the normal particle reference prototype takes into account both the context proximity and the discrete differences of the normal state, providing a corresponding reference for anomaly detection under different normal operating conditions. The context reference state is constructed based on the temporal state characteristics of adjacent segments before and after the current test time segment, avoiding the direct inclusion of the temporal state characteristics of the current test segment into the construction of the reference state; further, a normal particle reference prototype is selected based on the context reference state, so that the prototype selection is based on the adjacent temporal state, which is beneficial for evaluating the inconsistency between the current test segment and its temporal context. A virtual substitution is performed using a normal particle reference prototype for anomaly detection calculation. The degree of context mismatch before and after the substitution is compared. The mismatch reduction that can be obtained through substitution with the normal prototype is converted into context recovery gain, providing supplementary basis with clear computational meaning for anomaly judgment. By non-negative truncation and normalization processing combining local deviation fraction, average dispersion level and preset positive number, the recovery gain reflects the non-negative relative improvement degree and avoids the calculation problem of zero denominator. By using reserved normal samples to calibrate the local deviation threshold and context recovery threshold respectively, the two types of anomaly evaluation indicators have judgment benchmarks corresponding to historical normal states. By using local deviation score and context recovery gain in combination, the degree of deviation of the current test segment from the context is evaluated, as well as the degree of relative improvement brought about by normal prototype replacement, thereby supplementing the detection basis when judging solely based on local deviation score. Attached Figure Description

[0023] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the specific embodiments of the present invention will be briefly introduced below. It should be understood that the following drawings only show some specific embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.

[0024] Figure 1 This is a flowchart illustrating a temporal anomaly detection method based on particle prototype context recovery in Embodiment 1.

[0025] Figure 2 This is a schematic diagram of the process of constructing normal time-series state features, reserving threshold calibration samples, and establishing normal state particles in Example 1.

[0026] Figure 3 This is a schematic diagram illustrating the process of constructing the context reference state and determining the normal particles in context matching in Example 1.

[0027] Figure 4 This is a schematic diagram of the process of virtual substitution of the normal particle reference prototype and context recovery gain calculation in Example 1.

[0028] Figure 5 This is a schematic diagram of the threshold calibration and anomaly detection process in Example 1.

[0029] Figure 6 This is a schematic diagram of a temporal anomaly detection system based on particle prototype context recovery in Embodiment 2. Detailed Implementation

[0030] The technical solutions of the present invention will now be clearly and completely described with reference to the accompanying drawings in the embodiments of the present invention.

[0031] Example 1 Please see Figure 1 The first embodiment of the present invention provides a temporal anomaly detection method based on granular prototype context recovery, comprising the following steps: S1: Obtain historical normal time series data during the operation of the target equipment, construct normal time series state features according to the preset time window after preprocessing; reserve some normal time series state features as threshold calibration samples, and use the remaining normal time series state features to establish multiple normal state spheres, and determine the sphere center and average dispersion level of each normal state sphere.

[0032] Specifically, see Figure 2 The historical normal time series data includes data from one or more observation dimensions continuously collected in chronological order when the target equipment is in normal operating condition. The data sources include industrial equipment operation monitoring systems, sensor acquisition systems, or information system status monitoring systems.

[0033] Before constructing features for normal time series states, historical normal time series data are preprocessed to give the processed data a suitable data format and scale for subsequent feature construction. This preprocessing includes scaling the observation data across different dimensions to reduce the impact of differences in numerical ranges between different observation dimensions on subsequent feature construction and sphere establishment.

[0034] The scale unification process is used to adjust the numerical scale of different observation dimensions without changing the meaning of the data corresponding to each observation dimension. Historical normal time series data and the time series data to be detected are processed using the same scale unification method, making the subsequently formed time series state features comparable.

[0035] In one implementation, the scale unification process employs a maximum and minimum value normalization method. The maximum and minimum values ​​for each observation dimension are determined based on historical normal time series data, and these values ​​are used as the scale parameters for the corresponding observation dimensions. For observations of the same observation dimension in both historical normal time series data and the time series data to be tested, the aforementioned corresponding scale parameters are used for normalization processing, without re-determining the scale parameters based on the time series data to be tested.

[0036] When the maximum and minimum values ​​corresponding to a certain observation dimension are equal, a preset positive number is used to replace the range of that observation dimension as the normalization denominator; the same processing rules are applied to the corresponding observation dimensions of historical normal time series data and time series data to be detected.

[0037] After preprocessing, historical normal time series data are continuously extracted according to a preset time window. Based on the observation data within each time window, corresponding normal time series state features are constructed to form a set of normal time series state features.

[0038] The time window division can be achieved through a preset window length and sliding step size. The window length is used to determine the data range contained in each time segment, and the sliding step size is used to determine the interval between the starting positions of adjacent time windows. Historical normal data processing, threshold calibration, and data to be detected all use the same time window division method.

[0039] In one implementation, both the historical normal time series data and the time series data to be detected are multivariate time series data. Based on the observation data within each preset time window, state information corresponding to each observation dimension is extracted. The state information includes at least one of local level, local dispersion, local trend, and local change intensity.

[0040] Among them, local level is used to characterize the overall level of the observations within the window, local dispersion is used to characterize the degree of dispersion of the observations within the window, local trend of change is used to characterize the direction of change of the observations over time, and local intensity of change is used to characterize the magnitude of change of the observations within the window. For example, when local level is selected as state information, this state information can be obtained by calculating the mean of the observations in the corresponding observation dimension within the window.

[0041] The state information corresponding to each observation dimension is combined in a preset order to obtain normal time-series state features, and the different dimensions of the normal time-series state features are subjected to scale unification processing.

[0042] When performing scale unification processing on different dimensions of the time series state features to be tested, the scale parameters corresponding to each feature dimension determined by the normal time series state features are used, and the scale parameters are not re-determined based on the time series state features to be tested.

[0043] In another implementation, the preprocessed observation data within each preset time window are combined in chronological order to form a normal temporal state feature with fixed characteristic dimensions. During the combination process, each time window uses a consistent order of observation dimensions and data combination, ensuring that the feature components corresponding to different time segments have consistent meanings.

[0044] Furthermore, a portion of normal time-series state features are reserved from the normal time-series feature set as threshold calibration samples. These threshold calibration samples maintain their original temporal order within the historical normal time-series data and do not participate in the calculation of the granular structure parameters for each normal state; they are used to subsequently determine the local deviation threshold and the context recovery threshold.

[0045] When reserving threshold calibration samples, retain their original time positions so that the adjacent time segments before and after the sample can be determined during the calibration process.

[0046] Multiple normal-state spheres are established using the remaining normal-temporal-state features. In one specific embodiment, the remaining normal-temporal-state features are grouped into the same initial sphere, its sphere center and average dispersion level are calculated, and it is divided using a recursive binary search method.

[0047] For the current grain, if its average dispersion level exceeds a preset partitioning threshold and its sample size is not less than a preset minimum sample size, the two normal temporal state features with the largest Euclidean distance within the current grain are selected as representative points. These two representative points are assigned to two sub-grains respectively, and the remaining normal temporal state features within the current grain are assigned to the sub-grain containing the representative point with the closest Euclidean distance. If the distances are the same, they are assigned to one of the sub-grains according to a preset fixed assignment rule. After partitioning, the grain center and average dispersion level of each sub-grain are recalculated, and the above judgment and partitioning process is repeated for each sub-grain.

[0048] For particles that do not meet the above division criteria, the division process is stopped, and these particles are treated as normal particles. The above process is repeated until no particles meet the division criteria. The final number of normal particles is adaptively determined by the above division process.

[0049] Wherein, the preset partitioning threshold is a non-negative number, and the preset minimum sample size is the lower limit of the number of samples allowed for partitioning, and its value is an integer not less than 2. In this embodiment, the average dispersion level of the initial particles is greater than the preset partitioning threshold, and its sample size is not less than the preset minimum sample size.

[0050] For the For each normal-state particle, the number of normal temporal state features contained within it is counted to obtain the particle sample size. And calculate the center of the pellet according to the following formula. : ; In the formula, Index representing a sphere in its normal state; An index representing the characteristics of the normal temporal state inside a normal-state sphere; Indicates the first The first normal state granule A normal temporal state characteristic; Indicates the first The center of a normal state particle is used to characterize the representative position of the particle in the temporal state feature space.

[0051] Based on the distance between each normal time-series state characteristic and the corresponding particle center, the particle discrete statistic is calculated according to the following formula. : ; In the formula, Represents the Euclidean norm; Indicates the first The sum of the squared Euclidean distances from each normal temporal state feature within a normal state grain to the center of the grain.

[0052] The mean dispersion level is calculated based on the particle dispersion statistic and the particle sample size using the following formula. : ; The average level of dispersion For the first The average of the squared Euclidean distances from each normal temporal state feature within a normal state sphere to the center of the sphere is used to characterize the local normal fluctuation scale of the sphere itself.

[0053] Number of pellet samples granule center Particle discrete statistics and average level of dispersion As the first The structural parameters of each normal-state particle are saved for subsequent determination of the normal particle reference prototype and calculation of context recovery gain.

[0054] S2: Process the time series data to be detected according to the preprocessing method, time window division method and feature construction method of the historical normal time series data to obtain the temporal state features of the current time segment to be detected and its adjacent time segments before and after it, and construct the context reference state only based on the temporal state features of the adjacent time segments before and after it.

[0055] Specifically, see Figure 3 After establishing the normal state spheres, the time series data to be detected during the operation of the target device is acquired. The same preprocessing method, time window division method, feature construction method and scale unification processing method as in step S1 are used to obtain the time series state features to be tested, so that the center of the spheres to be tested and the spheres of the normal state spheres are located in the same time series state feature space.

[0056] For the current time segment to be tested Let its corresponding temporal state features be denoted as The temporal state features corresponding to the preceding and following adjacent time segments are respectively denoted as: and The aforementioned adjacency relationships are determined based on the original time location and the preset time window division rules.

[0057] Without utilizing the temporal state features corresponding to the current time segment being tested Under the conditions of participation in the calculation, the arithmetic mean of the temporal state features corresponding to adjacent time segments is used as the context reference state, and calculated according to the following formula: ; In the formula, Indicates the index of the current time segment to be tested; It represents the context reference state corresponding to the current time segment under test, and is used to characterize the local time context information formed by its preceding and following time segments.

[0058] By constructing the context reference state in the above manner, the temporal state features of the current time segment under test are not directly used, thus providing a contextual basis for selecting the normal sphere reference prototype based on the adjacent temporal states.

[0059] Since the calculation of the context reference state requires the temporal state features of the preceding and following time segments, the data of the corresponding preceding and following segments needs to be obtained before completing the above calculation for the current time segment under test. For online input time series, the context reference state calculation for the current segment should be completed after the data of the next adjacent time segment becomes available.

[0060] In this embodiment, for the current time segment to be tested that has a previous adjacent time segment and a next adjacent time segment, the above-mentioned context reference state construction and anomaly detection calculation are performed; the threshold calibration adopts the same neighborhood integrity condition.

[0061] S3: Calculate the squared Euclidean distance between the context reference state and the center of each particle, divide it by the sum of the corresponding average discrete level and the preset positive number to obtain the matching quantity; determine the normal state particle with the smallest matching quantity as the context matching normal particle, and use its particle center as the normal particle reference prototype to perform virtual substitution on the temporal state features of the current time segment to be tested for anomaly detection calculation.

[0062] Specifically, for the first A normal state particle, based on the context reference state granule center and average level of dispersion The matching quantity is calculated according to the following formula: ; In the formula, This indicates the context reference state corresponding to the current time segment being tested and the first... The matching amount between normal state particles; To avoid a pre-defined positive number with a denominator of zero, satisfying .

[0063] The matching quantity normalizes the distance using the average discrete level corresponding to each normal state particle, so that the differences in normal fluctuations within different normal state particles are reflected in the matching calculation process.

[0064] When the normal temporal state characteristics within a particle in a certain normal state are the same, its average discrete level is zero; because the denominator contains a preset positive number. The corresponding matching quantity can still be calculated using the formula described above.

[0065] Calculate the matching amount between the context reference state and each normal state particle. The normal state particle with the smallest matching amount is identified as the context-matched normal particle, and its index is determined according to the following formula: ; In the formula, This represents the index of the normal particle corresponding to the current time segment to be tested, and the comparison range of the minimum value is all normal state particles established in step S1.

[0066] The first The center of a normal granule As a normal granular reference prototype, the temporal state characteristics of the current time segment under test. Perform virtual substitution for anomaly detection calculations.

[0067] The virtual substitution refers to using a normal particle as a reference prototype when subsequently calculating the context mismatch after substitution. Substitute the position of the state to be evaluated. This process does not change the original time series data to be detected or the temporal state characteristics corresponding to the current time segment to be detected. And the structural parameters of each normal state granule.

[0068] S4: Calculate the squared Euclidean distance between the temporal state features of the current time segment under test and the context reference state to obtain the local deviation score; calculate the squared Euclidean distance between the normal particle reference prototype and the context reference state to obtain the context mismatch after virtual substitution; calculate the difference between the local deviation score and the context mismatch; when the difference is greater than zero, divide the difference by the sum of the local deviation score, the average discrete level of the context-matched normal particle, and the preset positive number to obtain the context recovery gain; when the difference is less than or equal to zero, determine the context recovery gain as zero.

[0069] Specifically, see Figure 4 The local deviation score corresponding to the current time segment to be tested is calculated according to the following formula: ; In the formula, This represents the local deviation score corresponding to the current time segment under test, used to characterize the degree of inconsistency between the current temporal state features and the context reference state. This local deviation score also serves as the context mismatch before virtual substitution.

[0070] Maintaining context reference state Under the condition that remains unchanged, the context mismatch after virtual substitution of the normal particle reference prototype is calculated according to the following formula: ; In the formula, superscript This represents a virtual substitution state for the normal granular reference prototype; This represents the mismatch between the current time-series state features and the same context reference state after replacing the current features with a normal particle reference prototype.

[0071] Furthermore, the context recovery gain is calculated according to the following formula: ; In the formula, This represents the context recovery gain corresponding to the current time segment being tested; This indicates the average discrete level of context-matched normal particles; The preset positive number in step S3; This indicates that the maximum value among the listed values ​​is selected.

[0072] when When the normal particle reference prototype can reduce the mismatch between the current state and the context reference state, the context recovery gain is positive; when At that time, the context recovery gain is zero.

[0073] Since both the local deviation score and the average level of dispersion are non-negative, and The denominator of the context recovery gain is always greater than zero. The calculation can still be completed when both the local deviation fraction and the average level of dispersion are zero, in which case the context recovery gain is zero.

[0074] The local deviation score is used to evaluate the degree of deviation of the current state relative to the temporal context, and the context recovery gain is used to evaluate the relative improvement brought about by the virtual substitution of the normal particle reference prototype. A positive context recovery gain is not directly equivalent to an anomaly, and a zero context recovery gain is not directly equivalent to normality. The specific determination result is made in step S5.

[0075] S5: Use the threshold calibration samples to determine the local deviation threshold and the context recovery threshold respectively; when at least one of the local deviation score and the context recovery gain exceeds the corresponding threshold, the current time segment to be tested is judged as abnormal, otherwise it is judged as normal.

[0076] Specifically, see Figure 5 Before making an anomaly determination on the current time segment to be tested, the local deviation threshold and context recovery threshold are determined using the threshold calibration sample reserved in step S1.

[0077] Each threshold calibration sample is used as the temporal state feature of the current time segment to be tested. Based on its original time position in the historical normal time series data, the temporal state features corresponding to the adjacent time segments are determined.

[0078] Using the aforementioned temporal state features, and following the method of constructing the context reference state in step S2 and the corresponding processing methods in steps S3 and S4, the context reference state is constructed, the context matching normal particles are determined and virtual substitution is performed, and the historical normal local deviation score and historical normal context recovery gain corresponding to each threshold calibration sample are calculated.

[0079] The aforementioned adjacent time segments are determined based on the original temporal adjacency relationships in the historical normal time series, and their adjacency relationships are not changed due to the extraction of threshold calibration samples. During the threshold calibration process, the normal-state spheres established in step S1 are used, and the threshold calibration samples are not involved in the calculation of the structural parameters of these spheres.

[0080] The local deviation threshold is determined based on the statistical distribution of historical normal local deviation scores. The context recovery threshold is determined based on the statistical distribution of historical normal context recovery gain. .

[0081] In one specific implementation, the quantiles corresponding to the preset quantile levels in the two statistical distributions are respectively taken as the corresponding thresholds, which can be expressed as: ; ; In the formula, This represents the set of historical normal local deviation scores corresponding to the threshold calibration samples; This represents the set of historical normal context recovery gains corresponding to the threshold calibration samples; and These represent the preset quantile levels for the two types of indicators, respectively. This indicates that the quantile level is calculated for the corresponding sample set. quantiles.

[0082] Quantile calculations are performed separately for the two types of evaluation indicators. The indicator values ​​are sorted to calculate quantiles without changing the original temporal adjacency relationships used when constructing the context reference state.

[0083] After determining the threshold, the local deviation score of the current time segment to be tested is... and context recovery gain Each segment is compared with its corresponding threshold. The current time segment to be tested is considered abnormal when the following condition is met: ; in, This indicates that the local deviation of the current time segment under test relative to the context reference state exceeds the corresponding threshold; This indicates that the context recovery gain resulting from the virtual substitution of the normal granular reference prototype exceeds the corresponding threshold.

[0084] When both the local deviation score and the context recovery gain do not exceed their respective thresholds, i.e., when the following formula is satisfied, the current time segment under test is determined to be normal: ; When the context recovery gain is zero, the local deviation score still needs to be compared with the local deviation threshold; if the local deviation score exceeds the corresponding threshold, the current time segment under test will still be judged as abnormal.

[0085] By adopting the above technical solution, the following technical effects can be achieved in this embodiment: Multiple normal-state particles are used to represent different local normal-state patterns. A contextual reference state is constructed based on adjacent time segments, and a normal particle reference prototype is selected by combining the average discrete level of each normal-state particle. By comparing the degree of context mismatch before and after virtual substitution, local deviation information and the relative improvement information brought about by normal prototype substitution are used together for anomaly determination. Reserved normal samples are used to calibrate corresponding thresholds, providing a normal-state reference and contextual evaluation basis for the detection of temporal anomalies during the operation of the target device.

[0086] To verify the detection effectiveness of the method described in this embodiment for local anomalies under different normal fluctuation scales, controlled simulation verification was conducted using computer-generated bivariate synthetic time series data, as detailed below. The data used in this verification is simulation data, not actual measured data from the equipment.

[0087] Two normal modes were set up, both following a two-dimensional Gaussian distribution, with each observation dimension being independent. The mean vector of mode 0 was (0, 0), and the standard deviation of each dimension was 0.02; the mean vector of mode 1 was (3, 3), and the standard deviation of each dimension was 0.25. The modeling sequence contained 1600 observations, arranged in mode 0 and mode 1, with 800 consecutive observations for each mode; the normal calibration sequence contained 12000 observations, arranged in mode 0 and mode 1, with 6000 consecutive observations for each mode. The test sequence contained 8000 observations, arranged in mode 0, mode 1, mode 0, mode 1, with 2000 consecutive observations in each segment.

[0088] The modeling sequence and the normal calibration sequence together constitute the historical normal simulation data in this verification. The normal temporal state features corresponding to the normal calibration sequence serve as the threshold calibration samples reserved in step S1, while the normal temporal state features corresponding to the modeling sequence are used to establish the normal state sphere. Each sequence retains its original temporal adjacency relationship and does not construct a context reference state across sequence boundaries.

[0089] The sequence numbers for the tested sequences are counted starting from 1. In observations 101 to 1881 and 4101 to 5881, one observation is selected every 20 observations starting from the first observation in each interval. The two observation dimensions are then superimposed with +0.16 and +0.16 respectively. An offset of 0.12 was used to inject 180 isolated anomalies. All other observations were marked as normal, including those at the normal mode switch locations.

[0090] In this embodiment, the preprocessed observations within the window are directly concatenated to form the state features. The window contains one sampled observation with a step size of 1, and the state features are composed of two observation dimensions. The minimum and maximum values ​​are calculated dimension-by-dimensionally using only the modeling sequence to determine the range normalization parameter; this parameter is used for both the normal calibration sequence and the test sequence, and the out-of-bounds values ​​after normalization are not truncated.

[0091] Normal-state spheres are established using the furthest feature described in step S1 through a recursive binary search. When the average discreteness of a sphere is greater than 0.02 and the number of samples is not less than 20, the division continues; parallel cases are handled according to a fixed input order rule. .

[0092] Following steps S2 to S4, the local deviation score and context recovery gain of each threshold calibration sample are calculated using the original temporal adjacency relationship of the normal calibration sequence. The first and last observations of the normal calibration sequence are not included in the calibration due to incomplete neighborhoods; all other observations, including those at the normal mode switch, participate in the calibration, resulting in 11,998 scores per round. The 99.95% linear interpolation quantiles of the two types of scores are then used to determine the local deviation threshold. and context recovery threshold .

[0093] The simulation was repeated 20 times using random seeds 20261022 to 20261041. In each round, independent modeling, calibration, and test noise were regenerated using the same generation rules and parameters, without adjusting parameters or selecting seeds based on the test results. Two normal-state particles were obtained in each round. During the detection process, the normalization parameters, particle parameters, and calibration thresholds remained unchanged. The first and last observations of the test sequence were not considered abnormal due to incomplete neighborhoods; 7998 states were evaluated in each round. The determination was delayed until the next observation, with a delay of one sampling step.

[0094] Taking the 101st observation in the first round of simulation as an example, the average discreteness level and calibration threshold of its context-matched normal granules are as follows: ; , .

[0095] The calculations obtained according to steps S2 to S4 are as follows: , ; .

[0096] at this time ,and The context recovery gain term indicates an anomaly, consistent with the annotation for injection anomalies. The above values ​​have been rounded; the actual determination uses the unequal value.

[0097] Two control versions are set up for comparison: the first is based solely on... Perform anomaly detection; the second method only calculates the context recovery gain. The threshold is set to zero, and anomalies are still defined as occurring when at least one of the local deviation fraction and context recovery gain exceeds the corresponding threshold; the rest of the calculation process remains unchanged. Each control version uses the same normal calibration sequence, and the required thresholds are determined at the same quantile level.

[0098] Precision, recall, F1 score, and false alarm rate were calculated round by round, and then the arithmetic mean was taken over 20 rounds. The results are shown in Table 1. False alarm rate is calculated as follows: The calculation is performed, where FP represents the number of normal observations misclassified as anomalous, and TN represents the number of normal observations correctly classified as normal. No anomalous interval prediction extension or other result corrections were used.

[0099] Table 1. Comparison of anomaly detection performance between the complete method and the control method under controlled simulation conditions.

[0100] The F1 score of the complete method in 20 simulations ranged from 95.24% to 98.09%. This controlled simulation was used to examine the effect of context recovery gain on the detection of local shifts in the low-fluctuation mode when high and low-fluctuation normal modes coexist, and the impact of the mismatch after substitution on false alarms. The above results are not equivalent to the detection performance of real equipment, nor should they be used to infer the general effect on other anomaly types or scenarios.

[0101] Example 2 Please see Figure 6 The second embodiment of the present invention provides a temporal anomaly detection system based on granular prototype context recovery, characterized in that it includes: The normal state sphere establishment module is used to acquire historical normal time series data during the operation of the target equipment. After preprocessing, normal time series state features are constructed according to a preset time window. Some normal time series state features are reserved as threshold calibration samples. Multiple normal state spheres are established using the remaining normal time series state features, and the sphere center and average dispersion level of each normal state sphere are determined. The context reference state construction module is used to process the time series data to be detected according to the preprocessing method, time window division method and feature construction method of the historical normal time series data, to obtain the temporal state features of the current time segment to be detected and its adjacent time segments before and after it, and to construct the context reference state only based on the temporal state features of the adjacent time segments before and after it. The particle prototype virtual substitution module is used to calculate the squared Euclidean distance between the context reference state and the center of each particle, and divide it by the sum of the corresponding average discrete level and a preset positive number to obtain the matching quantity; the normal state particle with the smallest matching quantity is determined as the context matching normal particle, and its particle center is used as the normal particle reference prototype to perform virtual substitution on the temporal state features of the current time segment to be tested for anomaly detection calculation. The anomaly evaluation calculation module is used to calculate the squared Euclidean distance between the temporal state features of the current time segment under test and the context reference state to obtain a local deviation score; calculate the squared Euclidean distance between the normal particle reference prototype and the context reference state to obtain the context mismatch after virtual substitution; calculate the difference between the local deviation score and the context mismatch; when the difference is greater than zero, divide the difference by the sum of the local deviation score, the average discrete level of the context-matched normal particle, and the preset positive number to obtain the context recovery gain; when the difference is less than or equal to zero, determine the context recovery gain as zero. The anomaly detection module is used to determine the local deviation threshold and the context recovery threshold using the threshold calibration samples respectively; when at least one of the local deviation score and the context recovery gain exceeds the corresponding threshold, the current time segment under test is determined to be abnormal, otherwise it is determined to be normal.

[0102] Example 3 The third embodiment of the present invention provides a timing anomaly detection device based on sphere prototype context recovery, including a processor, a memory, and a computer program stored in the memory; the computer program can be executed by the processor to implement a timing anomaly detection method based on sphere prototype context recovery as described in the first embodiment.

[0103] Example 4 The fourth embodiment of the present invention provides a computer-readable storage medium, characterized in that the computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute a timing anomaly detection method based on particle prototype context recovery as described in Embodiment 1.

[0104] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A temporal anomaly detection method based on granular prototype context recovery, characterized in that, Includes the following steps: S1: Obtain historical normal time series data during the operation of the target equipment, and construct normal time series state features according to the preset time window after preprocessing; reserve some normal time series state features as threshold calibration samples, and use the remaining normal time series state features to establish multiple normal state spheres, and determine the sphere center and average dispersion level of each normal state sphere. S2: Process the time series data to be detected according to the preprocessing method, time window division method and feature construction method of the historical normal time series data to obtain the temporal state features of the current time segment to be detected and its adjacent time segments before and after it, and construct the context reference state only based on the temporal state features of the adjacent time segments before and after it. S3: Calculate the squared Euclidean distance between the context reference state and the center of each particle, divide it by the sum of the corresponding average discrete level and the preset positive number to obtain the matching quantity; determine the normal state particle with the smallest matching quantity as the context matching normal particle, use its particle center as the normal particle reference prototype, and perform virtual substitution for the temporal state characteristics of the current time segment to be tested for anomaly detection calculation. S4: Calculate the squared Euclidean distance between the temporal state features of the current time segment under test and the context reference state to obtain the local deviation score; calculate the squared Euclidean distance between the normal particle reference prototype and the context reference state to obtain the context mismatch after virtual substitution; calculate the difference between the local deviation score and the context mismatch; when the difference is greater than zero, divide the difference by the sum of the local deviation score, the average discrete level of the context-matched normal particle, and the preset positive number to obtain the context recovery gain; when the difference is less than or equal to zero, determine the context recovery gain as zero; S5: Use the threshold calibration samples to determine the local deviation threshold and the context recovery threshold respectively; when at least one of the local deviation score and the context recovery gain exceeds the corresponding threshold, the current time segment to be tested is judged as abnormal, otherwise it is judged as normal.

2. The temporal anomaly detection method based on particle prototype context recovery according to claim 1, characterized in that, Both the historical normal time series data and the time series data to be detected are multivariate time series data. The construction of normal time-series state features in step S1 includes: Based on the observation data within each preset time window, the state information corresponding to each observation dimension is extracted. The state information includes at least one of local level, local dispersion, local change trend, and local change intensity. The state information corresponding to each observation dimension is combined to obtain the normal time series state features, and the different dimensions of the normal time series state features are subjected to scale unification processing.

3. The temporal anomaly detection method based on particle prototype context recovery according to claim 1, characterized in that, The construction of normal time-series state features in step S1 includes: The preprocessed observation data of each dimension within each preset time window are combined in chronological order to form normal time-series state features with fixed characteristic dimensions.

4. The temporal anomaly detection method based on particle prototype context recovery according to claim 1, characterized in that, In step S1, determining the sphere center and average dispersion level of each normal-state sphere includes: Statistics The number of normal temporal state features within a normal-state sphere is used to obtain the number of sphere samples. And calculate the center of the pellet according to the following formula. : ; The particle dispersion statistic is calculated using the following formula. : ; The average level of dispersion is calculated using the following formula. : ; in, An index representing the characteristics of the normal temporal state within a normal-state granule. Indicates the first The first normal state granule A normal time-series state feature Represents the Euclidean norm; The number of the granule samples granule center Particle discrete statistics and average level of dispersion As the first The structural parameters of each normal-state sphere are saved.

5. The temporal anomaly detection method based on particle prototype context recovery according to claim 1, characterized in that, In step S2, constructing the context reference state includes: The arithmetic mean of the temporal state features corresponding to the previous and next adjacent time segments is used as the context reference state corresponding to the current time segment under test, calculated according to the following formula: ; in, This represents the index of the current time segment to be tested. and These represent the temporal state features corresponding to the preceding and following adjacent time segments, respectively. This indicates the context reference state corresponding to the current time segment being tested; The virtual substitution does not change the original time series data to be detected, the temporal state characteristics corresponding to the current time segment to be detected, or the structural parameters of each normal state particle.

6. The temporal anomaly detection method based on particle prototype context recovery according to claim 1, characterized in that, The threshold calibration samples maintain their original temporal order in the historical normal time series data and do not participate in the calculation of the granular structure parameters of each normal state. In step S5, the local deviation threshold and the context recovery threshold are determined using the threshold calibration samples, including: Each threshold calibration sample is used as the temporal state feature of the current time segment to be tested. The corresponding context reference state is constructed, the context matching normal particle is determined and virtual substitution is performed, and the corresponding historical normal local deviation score and historical normal context recovery gain are calculated. The local deviation threshold is determined based on the statistical distribution of the historical normal local deviation scores, and the context recovery threshold is determined based on the statistical distribution of the historical normal context recovery gain.

7. The temporal anomaly detection method based on particle prototype context recovery according to claim 6, characterized in that, The quantiles corresponding to the preset quantile levels in the statistical distributions of the historical normal local deviation scores and the statistical distributions of the historical normal context recovery gains are respectively taken as the local deviation threshold and the context recovery threshold.

8. The temporal anomaly detection method based on particle prototype context recovery according to claim 1, characterized in that, The preprocessing in step S1 includes: before constructing the normal time series state features, performing scale unification processing on the observation data of different dimensions in the historical normal time series data; In step S2, the time series data to be detected is processed using the same scaling method as in step S1.

9. The temporal anomaly detection method based on particle prototype context recovery according to claim 1, characterized in that, The historical normal time series data comes from industrial equipment operation monitoring systems, sensor acquisition systems, or information system status monitoring systems, and includes data from one or more observation dimensions collected continuously in chronological order.

10. A temporal anomaly detection system based on particle prototype context recovery, characterized in that, include: The normal state sphere establishment module is used to acquire historical normal time series data during the operation of the target equipment. After preprocessing, normal time series state features are constructed according to a preset time window. Some normal time series state features are reserved as threshold calibration samples. Multiple normal state spheres are established using the remaining normal time series state features, and the sphere center and average dispersion level of each normal state sphere are determined. The context reference state construction module is used to process the time series data to be detected according to the preprocessing method, time window division method and feature construction method of the historical normal time series data, to obtain the temporal state features of the current time segment to be detected and its adjacent time segments before and after it, and to construct the context reference state only based on the temporal state features of the adjacent time segments before and after it. The particle prototype virtual substitution module is used to calculate the squared Euclidean distance between the context reference state and the center of each particle, and divide it by the sum of the corresponding average discrete level and a preset positive number to obtain the matching quantity; the normal state particle with the smallest matching quantity is determined as the context matching normal particle, and its particle center is used as the normal particle reference prototype to perform virtual substitution on the temporal state features of the current time segment to be tested for anomaly detection calculation. The anomaly evaluation calculation module is used to calculate the squared Euclidean distance between the temporal state features of the current time segment under test and the context reference state to obtain a local deviation score; calculate the squared Euclidean distance between the normal particle reference prototype and the context reference state to obtain the context mismatch after virtual substitution; calculate the difference between the local deviation score and the context mismatch; when the difference is greater than zero, divide the difference by the sum of the local deviation score, the average discrete level of the context-matched normal particle, and the preset positive number to obtain the context recovery gain; when the difference is less than or equal to zero, determine the context recovery gain as zero. The anomaly detection module is used to determine the local deviation threshold and the context recovery threshold using the threshold calibration sample. When at least one of the local deviation score and the context recovery gain exceeds the corresponding threshold, the current time segment under test is determined to be abnormal; otherwise, it is determined to be normal.