CN-121980447-A - Abnormality detection method and device for time series data, electronic equipment and program product
Abstract
The application is suitable for the technical field of data processing, and provides a method and a device for detecting abnormality of time sequence data, electronic equipment and a program product. The method comprises the steps of determining target historical data and target real-time data of target time sequence data, training to obtain a trend prediction model according to the target historical data, determining a trend prediction value and a first confidence interval corresponding to the target time sequence data through the trend prediction model, training to obtain a residual prediction model according to the trend prediction value and the target real-time data, determining a residual prediction value and a second confidence interval corresponding to the target time sequence data through the residual prediction model, determining a target confidence interval according to the trend prediction value, the residual prediction value, the first confidence interval and the second confidence interval, and performing anomaly detection processing on the target time sequence data according to the target confidence interval. According to the application, the time sequence data anomaly detection is carried out through the historical data and the real-time data of the time sequence data, so that the anomaly detection accuracy of the time sequence data is improved.
Inventors
- CHAI JIANGLONG
- YAN YE
- FENG GENGPING
- FU ZIJIAN
Assignees
- 聚好看科技股份有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20251229
Claims (10)
- 1. An anomaly detection method for time series data, comprising: Acquiring target time sequence data, and determining target historical data and target real-time data of the target time sequence data; training to obtain a trend prediction model for predicting the change trend of the time sequence data according to the target historical data, and determining a trend prediction value and a first confidence interval corresponding to the target time sequence data through the trend prediction model; training to obtain a residual prediction model for predicting a time sequence data residual according to the trend prediction value and the target real-time data, and determining a residual prediction value and a second confidence interval corresponding to the target time sequence data through the residual prediction model; Determining a target confidence interval according to the trend predicted value, the residual predicted value, the first confidence interval and the second confidence interval; And performing anomaly detection processing on the target time sequence data according to the target confidence interval.
- 2. The method of claim 1, wherein determining the target historical data and the target real-time data for the target temporal data comprises: Determining a first time period and a second time period, wherein the time span of the first time period is larger than that of the second time period, and the difference value between the ending time of the first time period and the current time and the difference value between the ending time of the second time period and the current time are smaller than a preset time threshold; acquiring initial historical data of the target time sequence data according to the first time period, and performing downsampling processing on the initial historical data according to a sampling time interval corresponding to the target time sequence data to obtain the target historical data; And acquiring initial real-time data of the target time sequence data according to the second time period, and performing filtering processing on the initial real-time data according to the absolute intermediate level difference of the target time sequence data to obtain the target real-time data.
- 3. The method of claim 1, wherein the determining, by the trend prediction model, a trend prediction value corresponding to the target time series data comprises: and determining a sub-prediction trend value corresponding to each time stamp according to the target real-time data by the trend prediction model, and determining a trend prediction value corresponding to the target time sequence data according to the sub-prediction trend value corresponding to each time stamp.
- 4. A method according to claim 3, wherein said training to obtain a residual prediction model for predicting a time series data residual based on said trend prediction value and said target real-time data comprises: Determining a residual error corresponding to each time stamp according to the trend predicted value and the target real-time data, and determining a residual error sequence according to the residual error corresponding to each time stamp; And training to obtain the residual prediction model according to the residual sequence.
- 5. The method of claim 4, wherein training the residual prediction model from the residual sequence comprises: Determining a residual range according to the residual sequence; For each residual in the residual sequence, determining whether the residual is in the residual range, and if not, correcting the residual to obtain a corrected residual sequence; and training to obtain the residual prediction model according to the corrected residual sequence.
- 6. The method of any one of claims 1 to 5, wherein the determining a target confidence interval from the trend prediction value, the residual prediction value, the first confidence interval, and the second confidence interval comprises: Determining a target predicted value according to the trend predicted value and the residual predicted value; determining a target standard deviation according to the first standard deviation corresponding to the first confidence interval and the second standard deviation corresponding to the second confidence interval; and determining the target confidence interval according to the target predicted value and the target standard deviation.
- 7. The method of claim 6, wherein the determining the target standard deviation based on the first standard deviation for the first confidence interval and the second standard deviation for the second confidence interval comprises: Acquiring a first weight parameter corresponding to the trend prediction model and a second weight parameter corresponding to the residual prediction model; And determining the target standard deviation according to the first standard deviation, the second standard deviation, the first weight parameter and the second weight parameter.
- 8. An abnormality detection apparatus for time series data, comprising: The data acquisition unit is used for acquiring target time sequence data and determining target historical data and target real-time data of the target time sequence data; the first determining unit is used for training to obtain a trend prediction model for predicting the change trend of the time sequence data according to the target historical data, and determining a trend prediction value and a first confidence interval corresponding to the target time sequence data through the trend prediction model; the second determining unit is used for training to obtain a residual prediction model for predicting a time sequence data residual according to the trend prediction value and the target real-time data, and determining a residual prediction value and a second confidence interval corresponding to the target time sequence data through the residual prediction model; a third determining unit, configured to determine a target confidence interval according to the trend prediction value, the residual prediction value, the first confidence interval, and the second confidence interval; and the anomaly detection unit is used for carrying out anomaly detection processing on the target time sequence data according to the target confidence interval.
- 9. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the method for anomaly detection of time series data according to any one of claims 1 to 7.
- 10. A computer program product, which when executed by a processor implements the steps of the anomaly detection method of time series data according to any one of claims 1 to 7.
Description
Abnormality detection method and device for time series data, electronic equipment and program product Technical Field The present application relates to the field of data processing technologies, and in particular, to a method and apparatus for detecting an anomaly of time series data, an electronic device, and a program product. Background At present, the method for detecting the abnormality of the time series data generally inputs the time series data into a time series data prediction model which is trained in advance, so that the time series data trend is predicted according to the time series data through the time series data prediction model, and the abnormality detection can be performed according to the predicted time series data trend. However, when short-term sudden fluctuation exists in the training data for training the time series data prediction model, a larger error exists in the time series data trend predicted by the time series data prediction model, and the accuracy of abnormality detection of the time series data is further reduced. Disclosure of Invention In view of the above, the embodiments of the present application provide a method, an apparatus, an electronic device, and a program product for detecting an anomaly of time series data, so as to solve the technical problem in the prior art that the accuracy of detecting an anomaly of time series data is low. In a first aspect, an embodiment of the present application provides a method for detecting an anomaly of time series data, including: Acquiring target time sequence data, and determining target historical data and target real-time data of the target time sequence data; training to obtain a trend prediction model for predicting the change trend of the time sequence data according to the target historical data, and determining a trend prediction value and a first confidence interval corresponding to the target time sequence data through the trend prediction model; training to obtain a residual prediction model for predicting a time sequence data residual according to the trend prediction value and the target real-time data, and determining a residual prediction value and a second confidence interval corresponding to the target time sequence data through the residual prediction model; Determining a target confidence interval according to the trend predicted value, the residual predicted value, the first confidence interval and the second confidence interval; And performing anomaly detection processing on the target time sequence data according to the target confidence interval. Optionally, the determining the target historical data and the target real-time data of the target time sequence data includes: Determining a first time period and a second time period, wherein the time span of the first time period is larger than that of the second time period, and the difference value between the ending time of the first time period and the current time and the difference value between the ending time of the second time period and the current time are smaller than a preset time threshold; acquiring initial historical data of the target time sequence data according to the first time period, and performing downsampling processing on the initial historical data according to a sampling time interval corresponding to the target time sequence data to obtain the target historical data; And acquiring initial real-time data of the target time sequence data according to the second time period, and performing filtering processing on the initial real-time data according to the absolute intermediate level difference of the target time sequence data to obtain the target real-time data. Optionally, the determining, by the trend prediction model, a trend prediction value corresponding to the target time sequence data includes: and determining a sub-prediction trend value corresponding to each time stamp according to the target real-time data by the trend prediction model, and determining a trend prediction value corresponding to the target time sequence data according to the sub-prediction trend value corresponding to each time stamp. Optionally, the training to obtain a residual prediction model for predicting a time series data residual according to the trend predicted value and the target real-time data includes: Determining a residual error corresponding to each time stamp according to the trend predicted value and the target real-time data, and determining a residual error sequence according to the residual error corresponding to each time stamp; And training to obtain the residual prediction model according to the residual sequence. Optionally, the training to obtain the residual prediction model according to the residual sequence includes: Determining a residual range according to the residual sequence; For each residual in the residual sequence, determining whether the residual is in the residual range, and if not, correcting the residual to obtai