Time series data prediction method and device, equipment, storage medium and program product
By performing trend and period decomposition on the time-series data of the business system, extracting trend and periodic features, determining the time-series type, and selecting an appropriate prediction strategy, the problem of insufficient prediction accuracy of time-series data in existing technologies is solved, and higher prediction accuracy is achieved.
Patent Information
- Application Number
- CN202411197107.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies are insufficient in predicting time series data in business systems, especially when dealing with multimodal time series data. Deep learning methods have high computational resource requirements and large cumulative errors in iterative prediction, while the prediction performance of multivariate linear models is poor.
By performing trend and cycle decomposition on historical time series data, trend and cycle features are extracted to determine whether the time series type is linear, periodic, step-like, or irregular, and appropriate prediction strategies are selected based on the time series type for prediction.
It improves the accuracy of time series data prediction, can more accurately capture the overall trend and periodic fluctuations of the data, adapts to different types of time series data, and improves the pertinence and accuracy of prediction.
Smart Images

Figure CN121638513A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device, storage medium, and program product for time-series data prediction. Background Technology
[0002] Currently, business systems often involve various metrics, such as resource capacity metrics and business performance metrics. During the operation of the business system, metric data is collected according to the sampling frequency to obtain time series data.
[0003] In related technologies, indicator data for a future period can be predicted based on collected time-series data to obtain predicted data. This predicted data allows for the determination of the operational status of the business system over a future period, facilitating timely handling of anomalies. Clearly, the accuracy of the predicted data directly impacts the judgment of anomalies; therefore, how to achieve accurate prediction has become a pressing problem to be solved. Summary of the Invention
[0004] This application provides a time series data prediction method, apparatus, device, storage medium, and program product to improve prediction accuracy.
[0005] In a first aspect, this application provides a method for predicting time series data, including:
[0006] Obtain the first historical time series data; the first historical time series data is time series data generated within a first historical time period;
[0007] The first historical time series data is decomposed into trend and periodic features to obtain trend features and periodic features. The trend features are used to characterize the overall trend of the first historical time series data within the first historical time period, and the periodic features are used to characterize the periodic fluctuations of the first historical time series data.
[0008] Based on the trend characteristics and the periodic characteristics, the time series type corresponding to the first historical time series data is determined; the time series type is one of linear, periodic, step-like, or irregular.
[0009] Based on the time series prediction strategy corresponding to the time series type, the predicted time series data within the time period to be predicted is determined.
[0010] Secondly, this application provides a time-series data prediction apparatus, comprising:
[0011] The acquisition module is used to acquire first historical time series data; the first historical time series data is time series data generated within a first historical time period.
[0012] The decomposition module is used to perform trend and period decomposition on the first historical time series data to obtain trend features and periodic features; the trend features are used to characterize the overall trend of the first historical time series data within the first historical time period, and the periodic features are used to characterize the periodic fluctuations of the first historical time series data.
[0013] The determination module is used to determine the time series type corresponding to the first historical time series data based on the trend characteristics and the periodic characteristics; the time series type is one of linear, periodic, step-like, or irregular.
[0014] The prediction module is used to determine the predicted time series data within the time period to be predicted based on the time series prediction strategy corresponding to the time series type.
[0015] Thirdly, this application provides an electronic device, including: a processor and a memory communicatively connected to the processor;
[0016] The memory stores computer-executed instructions;
[0017] The processor executes computer execution instructions stored in the memory to implement the time-series data prediction method as described in any of the first aspects.
[0018] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the time-series data prediction method described in any of the first aspects.
[0019] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the time-series data prediction method described in any of the first aspects.
[0020] The time-series data prediction method, apparatus, device, storage medium, and program product provided in this application acquire first historical time-series data, perform trend and periodic decomposition on the first historical time-series data to obtain trend features and periodic features, and then determine the time-series type corresponding to the first historical time-series data based on the trend features and periodic features. Based on the time-series prediction strategy corresponding to the time-series type, the predicted time-series data within the time period to be predicted is determined. By performing trend and periodic decomposition on the first historical time-series data, trend features and periodic features can be extracted separately. This decomposition method can more accurately capture the overall trend and periodic fluctuations of the data. Furthermore, it can determine the time-series type of the first historical time-series data (such as linear, periodic, stepped, or irregular) based on the trend features and periodic features, and thus different time-series prediction strategies can be adopted for different time-series data types, thereby improving prediction accuracy. Attached Figure Description
[0021] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0022] Figure 1 This is a schematic diagram of an application scenario provided in this application;
[0023] Figure 2 This is a flowchart illustrating a time series data prediction method provided in this application;
[0024] Figure 3 This is a flowchart illustrating another time-series data prediction method provided in this application;
[0025] Figure 4 This is a schematic diagram of a memory resource capacity optimization process provided in this application;
[0026] Figure 5 This is a schematic diagram of a processor utilization optimization process provided in this application;
[0027] Figure 6 This is a schematic diagram of a dynamic threshold anomaly detection process provided in this application;
[0028] Figure 7 This is a schematic diagram of the structure of a time series data prediction device provided in this application;
[0029] Figure 8 This is a schematic diagram of the structure of an electronic device provided in this application.
[0030] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0031] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0032] Currently, business systems often involve various metrics, such as resource capacity metrics and business performance metrics. During the operation of business systems, metric data is collected according to the sampling frequency to obtain time-series data. In the field of operations and maintenance, multiple metrics are involved, such as resource capacity metrics, such as Central Processing Unit (CPU) utilization, memory utilization, and storage utilization, as well as business performance metrics, such as network traffic and access volume. Technical personnel need to pay attention to and study the impact of these metrics on business operations.
[0033] Regarding resource capacity metrics, it's necessary to study the impact of current and future capacity on business operations. In the current state, determining whether there is over-allocation or under-allocation of resource capacity helps operations personnel conserve infrastructure resources. In the future state, predicting when capacity will exceed thresholds helps operations personnel plan resources. Simultaneously, historical resource usage patterns can be used to predict future resource usage by the business system. Regarding business performance metrics, it's necessary to determine whether current performance metrics are within a safe range to assess whether they are impacting the business system.
[0034] In related technologies, indicator data for a future period can be predicted based on collected time-series data to obtain predicted data. This predicted data allows for the determination of the operational status of the business system over a future period, facilitating timely handling of anomalies. Clearly, the accuracy of the predicted data directly impacts the judgment of anomalies; therefore, how to achieve accurate prediction has become a pressing problem to be solved.
[0035] One approach is to first preprocess the historical time-series data, then perform concept drift detection and analysis. If the historical time-series data is aperiodic, it is processed into periodic data. Finally, iterative predictions are made using periodic time-series prediction models such as Deep Autoregressive Models (DeepAR). However, deep learning-based methods have high computational resource requirements, and iterative predictions accumulate errors, resulting in poor prediction performance for long-term time-series forecasts.
[0036] Another approach is to build a multivariate linear model based on the periodicity of time series data, taking time features as input and outputting upper and lower thresholds corresponding to those times. However, in real-world applications, time series data is multimodal, not just periodic, so this method does not perform well in prediction.
[0037] Based on this, this application provides a time series data prediction method, apparatus, device, storage medium, and program product, aiming to solve the above-mentioned technical problems.
[0038] Figure 1 This is a schematic diagram illustrating one application scenario provided in this application. For example... Figure 1 As shown, this application scenario includes: server device 1 and client device 2. The devices are connected via a network.
[0039] Server-side device 1 is a device that provides backend services for the business system. Optionally, server-side device 1 is a server, such as a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server, but it is not limited to these. Client-side device 2 has a business application installed on it, which is an application within the business system. Optionally, client-side device 2 is a terminal, such as a smartphone, tablet, laptop, desktop computer, smart home device (smart speaker, smart appliance), wearable device (smartwatch), smart voice interaction device, and in-vehicle terminal (vehicle system), but it is not limited to these.
[0040] In one application scenario, server device 1 acquires first historical time-series data, performs trend and period decomposition on the first historical time-series data to obtain trend features and periodic features, and determines the time-series type corresponding to the first historical time-series data based on the trend and periodic features. Client device 2 determines the predicted time-series data within the time period to be predicted based on the time-series prediction strategy corresponding to the time-series type. Server device 1 packages and sends the prediction model to the client device. This prediction model includes the data required for prediction, such as trend features, periodic features, and time-series type.
[0041] It should be noted that, provided that the client device's operating resources can meet the deployment and operation conditions of the large model, the embodiments of this application can be performed on the client device.
[0042] The time series data prediction method provided in this application is implemented by a time series data prediction device, which is integrated into an electronic device. This electronic device can be either a server device 1 or a client device 2.
[0043] The technical solution of this application and how it solves the above-mentioned technical problems will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0044] Figure 2 This is a flowchart illustrating a time-series data prediction method provided in this application. Figure 2 As shown, the time series data prediction method provided in this embodiment includes the following steps:
[0045] Step S101: Obtain first historical time series data; the first historical time series data is time series data generated within a first historical time period.
[0046] Optionally, the first historical time period can be continuous with the time period to be predicted, or it can be non-contiguous. It should be noted that the interval between the first historical time period and the time period to be predicted must be less than a preset duration. This preset duration can be set according to actual needs, and this embodiment does not limit it. The duration of the first historical time series data can be set according to actual needs, and this embodiment does not limit it. For example, if the time period to be predicted is one month after the current time, then the first historical time period can be one month, two months, or three months before the current time, etc.
[0047] The time-series data refers to the data generated by the business system during its operation. In some embodiments, time-series data is periodically collected and stored during the operation of the business system. Accordingly, when time-series prediction is needed for the period to be predicted, the stored first historical time-series data is retrieved.
[0048] Step S102: Perform trend and period decomposition on the first historical time series data to obtain trend features and periodic features; the trend features are used to characterize the overall trend of the first historical time series data within the first historical time period, and the periodic features are used to characterize the periodic fluctuations of the first historical time series data.
[0049] Trend-cycle decomposition includes trend decomposition and cycle decomposition. Trend decomposition yields trend characteristics, and cycle decomposition yields cycle characteristics.
[0050] Step S103: Based on trend characteristics and periodic characteristics, determine the time series type corresponding to the first historical time series data; the time series type is one of linear, periodic, step-type or irregular.
[0051] Among them, trend features can reflect the overall trend of the first historical time series data, and periodic features can reflect the periodic fluctuations of the first historical time series data. Therefore, the time series type corresponding to the first historical time series data can be determined based on trend features and periodic features.
[0052] Step S104: Based on the time series prediction strategy corresponding to the time series type, determine the predicted time series data within the time period to be predicted.
[0053] The data generated by the business system during operation is multimodal, such as periodic, linear, stepwise, or irregular. A specific algorithm cannot accurately predict all scenarios. By determining the time series type corresponding to the first historical time series data based on trend and periodic characteristics, and then selecting an appropriate time series prediction strategy based on the time series type, time series prediction is carried out based on the time series prediction strategy, thus achieving targeted time series prediction and improving prediction accuracy.
[0054] In this embodiment, first historical time-series data is acquired, and trend-cycle decomposition is performed on the first historical time-series data to obtain trend features and cycle features. Then, based on the trend features and cycle features, the time-series type corresponding to the first historical time-series data is determined. Thus, based on the time-series prediction strategy corresponding to the time-series type, the predicted time-series data within the time period to be predicted is determined. By performing trend-cycle decomposition on the first historical time-series data, trend features and cycle features can be extracted separately. This decomposition method can more accurately capture the overall trend and periodic fluctuations of the data. Furthermore, based on the trend features and cycle features, the time-series type of the first historical time-series data (such as linear, periodic, stepped, or irregular) can be determined. Consequently, different time-series prediction strategies can be adopted for different time-series types of data, thereby improving prediction accuracy.
[0055] Figure 3 This is a flowchart illustrating another time-series data prediction method provided in this application, as shown below. Figure 3 As shown, the time series data prediction method provided in this embodiment is based on the time series data prediction method provided in the previous embodiment of this application, and further refines step S102. The time series data prediction method provided in this embodiment includes the following steps:
[0056] Step S201: Obtain the first historical time series data.
[0057] Optionally, the implementation of step S201 is the same as that of step S101 in the previous embodiment, and will not be described again here.
[0058] In some embodiments, after step S201, trend and period decomposition is performed on the first historical time series data to obtain trend features and periodic features. In other embodiments, after step S201, step S202 is executed first to obtain updated first historical time series data, and then trend and period decomposition is performed on the updated first historical time series data to obtain trend features and periodic features. This embodiment will be described using the latter case as an example.
[0059] Step S202: Perform data preprocessing on the first historical time series data to obtain updated first historical time series data.
[0060] In practical applications, the first historical time series data may contain missing segments, which refer to time periods where data is missing. If the missing segment is long, only the time series data before or after the missing segment can be used as the updated first historical time series data. If the missing segment is short, the missing segment can be filled, and the first historical time series data after the missing segment is filled can be determined as the updated first historical time series data. Optionally, since the time series data after the missing segment is closer to the time period to be predicted than the time series data before the missing segment, it can provide more accurate data support, and the time series data after the missing segment can be preferentially selected as the updated first historical time series data.
[0061] In some embodiments, step S202 is implemented in the following three ways:
[0062] The first scenario: If the duration of the missing segment is greater than the first preset duration, and the duration of the time series data following the missing segment is greater than the second preset duration, then the time series data following the missing segment will be determined as the updated first historical time series data.
[0063] If the duration of the missing segment is longer than the first preset duration, it indicates that the duration of the missing segment is relatively long. Further, it is determined whether the duration of the time series data following the missing segment is longer than the second preset duration. If the duration of the time series data following the missing segment is longer than the second preset duration, it indicates that the duration of the time series data following the missing segment is relatively long and can provide sufficient data support for time series prediction. Therefore, the time series data following the missing segment can be identified as the updated first historical time series data.
[0064] The first and second preset durations can both be set according to actual needs, and this embodiment does not limit them. For example, the first preset duration can be 5 hours, 10 hours, 12 hours, etc., and the second preset duration can be 24 hours, 48 hours, etc.
[0065] The second scenario: If the duration of the missing segment is greater than the first preset duration, and the duration of the time series data following the missing segment is less than or equal to the second preset duration, then the time series data preceding the missing segment will be determined as the updated first historical time series data.
[0066] If the duration of the time series data following the missing segment is less than or equal to the second preset duration, it indicates that the duration of the time series data following the missing segment is too short to provide sufficient data support for time series prediction. Therefore, the time series data before the missing segment can be identified as the updated first historical time series data.
[0067] Optionally, if the duration of the missing segment is greater than a first preset duration, and the duration of the time series data following the missing segment is less than or equal to a second preset duration, it can be further determined whether the time series data preceding the missing segment is greater than the second preset duration. Correspondingly, if the time series data preceding the missing segment is greater than the second preset duration, it indicates that the duration of the time series data preceding the missing segment is relatively long and can provide sufficient data support for time series prediction; in this case, the time series data preceding the missing segment is determined as the updated first historical time series data. Conversely, if the duration of the time series data preceding the missing segment is less than or equal to the second preset duration, it indicates that the duration of the time series data preceding the missing segment is relatively short and cannot provide sufficient data support for time series prediction; in this case, a linear interpolation algorithm is used to fill the missing segment, and the first historical time series data after filling the missing segment is determined as the updated first historical time series data.
[0068] The third scenario: If the duration of the missing segment is less than or equal to the first preset duration, then a linear interpolation algorithm is used to fill the missing segment, and the first historical time series data after filling the missing segment is determined as the updated first historical time series data.
[0069] If the duration of the missing segment is less than or equal to the first preset duration, it means that the duration of the missing segment is short. In this case, there is no need to discard the time series data before or after the missing segment. The missing segment can be filled to obtain the updated first historical time series data.
[0070] In some embodiments, the implementation of filling missing segments using a linear interpolation algorithm includes the following steps S2021-S2023:
[0071] Step S2021: Determine the data sampling frequency of the first historical time series data.
[0072] Optionally, step S2021 can be implemented by: performing first-order difference calculation on each time point in the first historical time series data to obtain multiple difference values; determining the frequency of occurrence of each difference value; determining the difference value with the highest frequency of occurrence, and determining the reciprocal of the difference value as the data sampling frequency.
[0073] The difference values obtained by the first-order difference calculation represent the sampling interval between two adjacent data. Correspondingly, the higher the frequency of the difference value, the higher the frequency of the sampling interval represented by the difference value. The difference value with the highest frequency is most likely to be the true sampling interval. This sampling interval can be regarded as the data sampling period. Therefore, the reciprocal of the data sampling period can be determined as the data sampling frequency of the first historical time series data.
[0074] Step S2022: Divide the first historical time series data into multiple equally spaced sampling windows according to the reciprocal of the data sampling frequency, and determine the average value of the historical data in each sampling window.
[0075] The duration of each sampling window is the reciprocal of the data sampling frequency, and equal intervals mean that the duration of the sampling windows is the same.
[0076] Step S2023: Use a linear interpolation algorithm and the average value of historical data within each sampling window to fill in the missing segments.
[0077] In this embodiment, steps S2021-S2023 are an implementation method for filling missing segments using a linear interpolation algorithm. By determining the data sampling frequency of the first historical time series data and creating multiple equally spaced sampling windows based on the reciprocal of the data sampling frequency, the average value corresponding to each sampling window is determined, providing data support for the linear interpolation algorithm. Filling missing segments using a linear interpolation algorithm can effectively complete the data, making the updated first historical time series data more complete.
[0078] In some embodiments, step S102, which is to perform trend and period decomposition on the first historical time series data to obtain trend and period characteristics, includes the following steps S203-S204. The first historical time series data can be either the first historical time series data obtained in step S201 or the updated first historical time series data obtained in step S202.
[0079] Step S203: Perform trend decomposition on the first historical time series data to obtain trend characteristics.
[0080] In some embodiments, the trend feature includes a sequence of historical trend items. Step S203 is implemented by including the following steps S2031-S2033:
[0081] Step S2031: Using the first historical time series data as training samples, train the support vector machine model to obtain the trained support vector machine model.
[0082] Optionally, a Support Vector Machine (SVM) model can be trained by calling the interface of Sklearn (an open-source machine learning library). During training, the SVM model learns the overall trend of the first historical time series data, which is then used to predict the trend. The input data of the trained SVM model is the time point, and the output data is the predicted data for that time point.
[0083] Optionally, the first historical time-series data can be smoothed before training the support vector machine model to reduce noise. For example, the smoothing algorithm can be an exponential moving average algorithm or other algorithms.
[0084] Step S2032: Input each time point in the first historical time series data into the trained support vector machine model, and use the trained support vector machine model to output the prediction data corresponding to each time point.
[0085] Step S2033: For each time point in the first historical time series data, the predicted data corresponding to the time point is determined as the historical trend item corresponding to the time point, so as to obtain the historical trend item sequence.
[0086] The historical trend item sequence includes the historical trend items corresponding to each time point in the first historical time series data; the historical trend item corresponding to a time point is the trend component of the historical data corresponding to that time point.
[0087] This embodiment uses a trained support vector machine (SVM) model to determine the predicted data corresponding to each time point. This can be viewed as decomposing the historical data corresponding to each time point to obtain the trend components of the historical data, i.e., the historical trend terms. Thus, the historical trend terms corresponding to each time point form a sequence of historical trend terms. In other words, the trained SVM model is used for linear fitting to obtain a fitted curve, and the values corresponding to each time point on this fitted curve are the historical trend terms.
[0088] In some embodiments, before step S2031, the following step S2034 is further included:
[0089] Step S2034: Perform anomaly detection on the first historical time series data to determine whether the extreme points in the first historical time series data are abnormal.
[0090] In this context, an extremum point is a point on a certain interval within the domain of a function where it reaches its maximum or minimum value. These extrema can be local or global. The time points in the first historical time series data can be considered as input values, and the historical data as output values. Correspondingly, the domain refers to the interval formed by the time points in the first historical time series data, which is a discrete set. The function refers to the discrete function formed by the historical data in the first historical time series data.
[0091] Optionally, the anomaly detection algorithm can be a box plot, N-sigma algorithm, Extreme Studentized Deviate (ESD) algorithm, Isolation Forest algorithm, or other anomaly detection algorithms. The extreme points include at least one of maxima and minima.
[0092] In the first case, if any extreme point in the first historical time series data is determined to be abnormal, then step S2035 is executed first to replace the abnormal extreme point, and then step S2031 is executed; in the second case, if it is determined that there is no abnormal extreme point in the first historical time series data, then step S2031 is executed directly.
[0093] Step S2035: If any extreme point in the first historical time series data is determined to be abnormal, the median of multiple historical data within a preset time period centered on the abnormal extreme point is used to replace the abnormal extreme point.
[0094] The duration of the preset time period can be set according to actual needs. This embodiment does not limit it, for example, 1 hour, 2 hours or 3 hours.
[0095] On the one hand, outliers may cause support vector machine (SVM) models to overfit, as the SVM model may try to adapt to these outliers during training, thus affecting its performance on normal data. This embodiment can reduce the risk of overfitting by detecting and processing outlier extreme points. On the other hand, outliers may deviate from the normal distribution of the first historical time series data, affecting the prediction accuracy of the SVM model. By replacing outlier extreme points with the median of multiple historical data within a preset time period, the negative impact of outliers on the training of the SVM model can be effectively reduced, thereby improving the prediction accuracy of the SVM model.
[0096] Step S204: Perform periodic decomposition on the first historical time series data to obtain periodic characteristics.
[0097] In some embodiments, the periodic features include period, periodic confidence, single-period term sequence, and historical periodic term sequence; step S204 is implemented by including the following steps S2041-S2043:
[0098] Step S2041: Subtract the corresponding historical trend item from the historical data of each time point in the first historical time series data to obtain the detrended first historical time series data.
[0099] In this step, for each time point in the first historical time series data, the historical trend item corresponding to that time point is subtracted from the historical data corresponding to that time point to obtain the detrended historical data corresponding to that time point. Thus, the detrended historical data corresponding to each time point respectively constitute the detrended first historical time series data.
[0100] By removing trend components from the data before performing periodic decomposition, the remaining data can better reflect periodic characteristics, thus avoiding interference from trend components and improving the accuracy of periodic decomposition.
[0101] Step S2042: Using a preset period detection algorithm, determine the period and period confidence level corresponding to the first historical time series data of the detrended data.
[0102] Optionally, step S2042 can be implemented by including the following steps S20421-S20423:
[0103] Step S20421: Obtain multiple alternative periods of the first historical time series data for detrending.
[0104] Optionally, the multiple alternative periods can be pre-set manually by technical personnel, and the alternative periods can be possible periods determined based on historical experience. Alternatively, the multiple alternative periods can also be determined based on the data sampling period.
[0105] Step S20422: Determine the confidence level corresponding to each alternative period.
[0106] Optionally, step S20422 can be implemented by performing the following operations for each alternative period:
[0107] Create a copy of the first historical time series data for the detrended data;
[0108] Using the first sliding window as the sliding step size, the copy is slid forward, and the historical data with time points in the previous first sliding window is moved to the end of the sequence to obtain the first historical time series data after sliding. The correlation coefficient between the first historical time series data after sliding and the first historical time series data of detrended data is determined. This process is repeated, and a correlation coefficient is determined for each slide until the cumulative sliding step size exceeds the duration of the first historical time period, at which point the sliding stops.
[0109] The mean of the identified correlation coefficients is used as the confidence level for the candidate period.
[0110] The duration of the first sliding window can be set according to actual needs, and this embodiment does not limit it, for example, 12 hours, 24 hours, 36 hours, 48 hours, etc. Using the first sliding window as the sliding step size, sliding the copy forward means sliding each time point in the copy forward by the first sliding window, and the historical data corresponding to each time point remains unchanged before and after the sliding. For example, if the duration of the first sliding window is 12 hours, and the first time point in the copy is 1:20, then the time point after sliding will be 13:20.
[0111] The duration of the first historical time period is the time span of the first historical time series data.
[0112] For each candidate period, by sliding the data multiple times and calculating the correlation coefficient between the slid data and the original data, the mean of multiple correlation coefficients can be obtained as the confidence level. This method can reduce random errors in a single calculation and improve the accuracy and reliability of the confidence level assessment, thereby helping to identify the most likely period.
[0113] Step S20423: Determine the candidate period corresponding to the maximum confidence level as the period corresponding to the first historical time series data of the detrended data, and assign the maximum confidence level to the period confidence level corresponding to the first historical time series data of the detrended data.
[0114] Among them, the candidate period with the higher confidence level is more likely to be the real period. Therefore, the candidate period with the highest confidence level among multiple candidate periods can be determined as the period corresponding to the first historical time series data of the detrended data. Furthermore, the confidence level of the candidate period can be assigned to the confidence level of the period corresponding to the first historical time series data of the detrended data.
[0115] Steps S20421-S20423 obtain multiple candidate periods and calculate the confidence level of each candidate period to comprehensively evaluate the probability of different candidate periods. Finally, the candidate period corresponding to the highest confidence level is selected as the period corresponding to the first historical time series data for detrending, which can ensure the accuracy of period identification.
[0116] For example, the input data of the preset period detection algorithm is the first historical time series data, and the output data is the candidate period with the highest confidence and the period confidence. The logic of the preset period detection algorithm is as follows:
[0117] 1. Calculate the data sampling period of the first historical time series data;
[0118] 2. Enumerate all possible alternative periods for the first historical time series data;
[0119] 3. Calculate the time span of the first historical time series data;
[0120] 4. Define a list variable to store the alternative periods and correlation coefficient pairs;
[0121] 5. Iterate through the list of periods and calculate the confidence level for each candidate period;
[0122] 5-1. Make a copy of the first historical time series data;
[0123] 5-2. Define a cumulative movement variable to represent the cumulative sliding time;
[0124] 5-3. Define a list variable to store the correlation coefficients after each slide;
[0125] 5-4. Calculate the correlation coefficient using a sliding window.
[0126] 5-4-1. The cumulative moving variable is increased by the current candidate period T;
[0127] 5-4-2. If the cumulative sliding duration exceeds the time span of the first historical time series data, the loop ends;
[0128] 5-4-3. Slide the first historical time series data forward by time T, and move the data in the earliest time interval T to the end of the time series data;
[0129] 5-4-4. Calculate the correlation coefficient between the time series data after sliding and the first historical time series data;
[0130] 5-4-5. Add the correlation coefficient to the correlation coefficient list;
[0131] 5-4-6. End the sliding window calculation or continue the loop until the cumulative sliding duration exceeds the time span of the first historical time series data;
[0132] 5-5. Calculate the mean of the correlation coefficient list;
[0133] 5-6. Add the current candidate period and the corresponding mean correlation coefficient to the list of candidate period and correlation coefficient pairs;
[0134] 5-7. End the iteration of the cycle list or continue the loop to iterate over all possible alternative cycles;
[0135] 6. Calculate the candidate period with the largest correlation coefficient in the list of candidate periods and correlation coefficient pairs, and assign the corresponding correlation coefficient to the period confidence score;
[0136] 7. Return the alternative period with the highest confidence level and its corresponding confidence level.
[0137] On the one hand, in some scenarios, time series data contain numerous extreme points that cannot be directly removed as noise. Related technologies use the least squares method to fit the trend term, but the least squares method is sensitive to extreme points, resulting in poor trend term fitting. This application uses a support vector machine (SVM) model to fit the trend term, which is relatively insensitive to extreme points, thus achieving better trend term fitting. On the other hand, this application calculates the periodic term using a sliding gap filling method and correlation coefficient calculation (i.e., a pre-defined period detection algorithm). The period is determined based on the correlation coefficient, which can also serve as a period confidence level, providing data support for subsequent time series type analysis and exhibiting good interpretability.
[0138] Step S2043: Divide the first historical time series data of the detrended data into multiple period segments according to the period.
[0139] The duration of each periodic segment is equal to the duration of that period.
[0140] Step S2044: Based on the period and the multiple period segments, generate a single-period item sequence.
[0141] Among them, the single-period term sequence includes the historical period terms corresponding to each time point within a period.
[0142] Optionally, step S2044 can be implemented by including the following steps S20441-S20443:
[0143] Step S20441: Generate a blank periodic segment with a duration of the period, containing multiple time points, and where the data corresponding to each time point is empty; the number of these multiple time points is the number of time points within a period.
[0144] The start and end times of the blank periodic segment can be set according to actual needs, and this embodiment does not limit them.
[0145] Step S20442: For each time point in the blank periodic segment, the average value of the historical data corresponding to the reference time points in the multiple periodic segments is determined as the historical periodic item corresponding to the time point; the reference time point is the time point in the periodic segment that corresponds to the time point.
[0146] Taking the first time point in the blank periodic segment as an example, the historical periodic item corresponding to the first time point is the average value of the historical data corresponding to the first time point in each periodic segment. The process of determining the historical periodic items corresponding to other time points in the blank periodic segment is similar and will not be repeated here.
[0147] Step S20443: For each time point in the blank periodic segment, replace the null value corresponding to that time point with the historical periodic item corresponding to that time point to obtain a single periodic item sequence.
[0148] Steps S20441-S20443 generate a blank periodic segment with a duration of period and fill it with historical periodic items at each time point. This can effectively extract the periodic components in the first historical time series data. Furthermore, by calculating the average value of the historical data corresponding to the reference time points in multiple periodic segments, the random fluctuations and noise in the data can be smoothed, making the generated single-period item sequence smoother and more stable.
[0149] Step S2045: For each periodic segment, replace the historical data corresponding to each time point in the periodic segment with the historical periodic item corresponding to the time point in the single periodic item sequence to obtain the replaced periodic segment; and splice multiple replaced periodic segments in chronological order to obtain the historical periodic item sequence.
[0150] The historical periodic item sequence includes the historical periodic items corresponding to each time point in the first historical time series data; the historical periodic item corresponding to a time point refers to the periodic component of the historical data corresponding to that time point.
[0151] Steps S2041-S2045 divide the first historical time series data of the detrended trend into multiple periodic segments, which can refine the extraction of periodic features. Each periodic segment can reflect the data of a complete cycle, which helps to analyze and understand the periodic pattern more deeply. Based on the cycle and multiple periodic segments, a single periodic item sequence is generated, and the historical periodic items in each periodic segment are replaced with the historical data in the single periodic item sequence. This can smooth the random fluctuations and noise in the data, so that the generated historical periodic item sequence is more stable and reliable.
[0152] Step S205: Based on trend characteristics and periodic characteristics, determine the time series type corresponding to the first historical time series data.
[0153] In some embodiments, step S205 is implemented by including the following steps S2051-S2052:
[0154] Step S2051: Based on trend characteristics and periodic characteristics, determine the linear confidence, periodic confidence, and step confidence of the first historical time series data; the linear confidence is used to indicate the probability that the first historical time series data belongs to the linear type; the periodic confidence is used to indicate the probability that the first historical time series data belongs to the periodic type; and the step confidence is used to indicate the probability that the first historical time series data belongs to the step type.
[0155] The first historical time series data in this step can be either the first historical time series data obtained in step S201 or the updated first historical time series data obtained in step S202.
[0156] Optionally, step S2051 can be implemented by including the following steps S20511-S20513:
[0157] Step S20511: Determine the number of nearby points in the first historical time series data, and determine the ratio of this number to the total number of historical data in the first historical time series data as the linear confidence level; wherein, nearby points refer to historical data located in the neighborhood of the corresponding historical trend item.
[0158] In this embodiment, taking any point in the first historical time series data as an example, if the historical data corresponding to that point is located within the neighborhood of the historical trend item corresponding to that point, then that point is determined as a nearby point. The radius of the neighborhood can be set according to actual needs, and this embodiment does not limit it.
[0159] The ratio of the number of nearby points to the total number of historical data points in the first historical time series can be seen as the proportion of nearby points. The more nearby points and the larger the proportion, the more likely most data points in the first historical time series are located within the neighborhood of the corresponding historical trend term, indicating a high degree of fit between the data and the historical trend term, and thus a higher linear confidence level. Conversely, the fewer nearby points and the smaller the proportion, the more the overall trend of the first historical time series deviates from the fitted curve obtained by the trained support vector machine model, and thus a lower linear confidence level. Based on this, this proportion can be directly determined as the linear confidence level.
[0160] Step S20512: Extract the periodic confidence from the periodic features.
[0161] The periodic confidence level determined in step S204 can reflect the possibility that the first historical time series data belongs to the periodic type. Therefore, the periodic confidence level can be directly extracted from the periodic features without additional determination.
[0162] Step S20513: Perform first-order difference calculation on the first historical time series data to obtain differential time series data, and determine the confidence level of each data in the differential time series data. The average confidence level of each data in the differential time series data is determined as the step confidence level.
[0163] First-order differencing involves calculating the difference between the current data value and the previous data value. First-order differencing effectively captures trends in time-series data, eliminating trend components and making the data more stable, thus facilitating subsequent processing. By determining the confidence level of each data point in the differencing time-series data, the reliability of each differencing data point can be evaluated. Data points with high confidence levels indicate that they better reflect the true trend.
[0164] For example, the first historical time series data is {t} n :v n The difference time series data obtained by first-order difference calculation is {t}. n :y n}, where t n For the nth time point, v n For the nth historical data, y n This is the nth difference data. For example, step S20513 can be implemented by the following formula:
[0165]
[0166] Where confidence is the step confidence level; N is the total number of historical data in the first historical time series data; σ(y n ) is y n The confidence level. It should be noted that yn The total number is N-1.
[0167] Optionally, the determination of the confidence level of each data point in the differential time series data in step S20513 can be implemented in the following two ways:
[0168] In the first case, for each data point in the differential time series data, if the absolute value of the data is less than the preset reference value, then the upper limit of the confidence level is determined as the confidence level of the data.
[0169] The upper confidence level is 1, and the lower confidence level is 0. The preset reference value is any small positive number and can be set according to actual needs; this embodiment does not impose any limitations on it.
[0170] In the second scenario, for each data point in the differential time series data, if the absolute value of the data is greater than or equal to the preset reference value, then the lower limit of the confidence level is determined as the confidence level of the data.
[0171] For example, δ is a preset reference value.
[0172] For each data point in the differential time series data, if the absolute value of the data is less than a preset reference value, it indicates that the absolute value of the data is small, and the difference between the historical data at the two time points used to calculate the data is small. Conversely, if the absolute value of the data is greater than or equal to the preset reference value, it indicates that the absolute value of the data is large, and the difference between the historical data at the two time points used to calculate the data is large. By comparing the absolute values of the differential data with the preset reference values, the reliability of each data point can be accurately assessed. Data points with smaller absolute values are assigned an upper confidence limit, indicating that these data points are more reliable; data points with larger absolute values are assigned a lower confidence limit, indicating that these data points may contain anomalies or noise.
[0173] Step S2052: Using a preset time series classification strategy, based on linear confidence, periodic confidence and step confidence, determine the time series type corresponding to the first historical time series data.
[0174] Optionally, step S2052 can be implemented by including the following steps S20521-S20525:
[0175] Step S20521: Determine whether the period confidence level is greater than the period confidence level threshold.
[0176] The period confidence threshold can be set according to actual needs, and this embodiment does not limit it, for example, 0.2. If the period confidence is greater than the period confidence threshold, then step S20522 is executed; otherwise, step S20523 is executed.
[0177] Step S20522: If the period confidence level is greater than the period confidence level threshold, then the time series type corresponding to the first historical time series data is determined to be periodic.
[0178] Among them, the higher the confidence level of the periodicity, the better the historical periodicity term can describe the overall trend of the data. Therefore, the time series type corresponding to the first historical time series data can be determined as periodic.
[0179] Step S20523: If the periodic confidence level is less than or equal to the periodic confidence level threshold, then determine whether the linear confidence level is greater than the linear confidence level threshold.
[0180] The lower the periodicity confidence level, the less accurately the historical periodic items can describe the overall trend of the data. Therefore, the time series type can be further determined by combining it with the linear confidence level. The linear confidence level threshold can be set according to actual needs, and this embodiment does not limit it, for example, 0.8. If the linear confidence level is greater than the linear confidence level threshold, then step S20524 is executed; otherwise, step S20525 is executed.
[0181] Step S20524: If the linear confidence level is greater than the linear confidence level threshold, then the time series type corresponding to the first historical time series data is determined to be linear.
[0182] Among them, the higher the linear confidence level, the better the historical trend term can describe the overall trend of the data. Therefore, the time series type corresponding to the first historical time series data can be determined as linear.
[0183] Step S20525: If the linear confidence level is less than or equal to the linear confidence level threshold, then determine whether the step confidence level is greater than the step confidence level threshold.
[0184] The lower the linear confidence level, the less accurately the historical trend term can describe the overall trend of the data. Therefore, the time series type can be further determined by combining the step confidence level. The step confidence level threshold can be set according to actual needs; this embodiment does not limit it, for example, 0.95. If the step confidence level is greater than the step confidence level threshold, step S20526 is executed; otherwise, step S20527 is executed.
[0185] Step S20526: If the step confidence level is greater than the step confidence level threshold, then the time series type corresponding to the first historical time series data is determined to be step type.
[0186] Among them, the higher the step confidence level, the more likely the first historical time series data is to have a step-like change trend. Therefore, the time series type corresponding to the first historical time series data can be determined as step type.
[0187] Step S20527: If the step confidence level is less than or equal to the step confidence level threshold, then the time series type corresponding to the first historical time series data is determined to be irregular.
[0188] Among them, the lower the step confidence level, the less likely the first historical time series data is to have a step change trend. Therefore, the time series type corresponding to the first historical time series data can be directly determined as irregular.
[0189] Step S206: Based on the time series prediction strategy corresponding to the time series type, determine the predicted time series data within the time period to be predicted.
[0190] In some embodiments, step S206 may be implemented in the following ways:
[0191] In the first case, when the timing type is linear, step S206 is implemented by including the following steps S206a-1 to S206a-4:
[0192] Step S206a-1: Use the trained support vector machine model to determine the predicted trend item sequence within the time period to be predicted; the trained support vector machine model is obtained by performing trend decomposition on the first historical time series data.
[0193] Optionally, each time point within the time period to be predicted is input into the trained support vector machine model, and the trained support vector machine model outputs the prediction data corresponding to each time point. This prediction data is also the prediction trend term. Accordingly, the prediction trend terms corresponding to each time point form a prediction trend term sequence.
[0194] Step S206a-2: Subtract the corresponding historical trend term from each historical data in the first historical time series data to obtain the historical random term sequence; the historical data and the corresponding historical trend term correspond to the same time point.
[0195] Step S206a-3: Slide fill the time period to be predicted based on the historical random item sequence to obtain the predicted random item sequence corresponding to the time period to be predicted.
[0196] Optionally, step S206a-3 can be implemented in the following ways:
[0197] The historical random item sequence is divided into multiple time segments according to the second sliding window;
[0198] Starting from the first time point of the time period to be predicted, the second sliding window is used as the sliding step size to slide within the time period to be predicted. During the sliding process, each time the second sliding window is slid, a time segment is extracted from multiple time segments and the extracted time segment is filled into the current sliding window. This process is repeated until the time period to be predicted is completely filled, thus obtaining the predicted random item sequence corresponding to the time period to be predicted.
[0199] The duration of the second sliding window can be set according to actual needs. This embodiment does not limit this, for example, 12 hours, 24 hours, 36 hours, 48 hours, etc.
[0200] Historical random term sequences contain past fluctuations and changes, which are very valuable for predicting future periods. By dividing the historical random term sequence into multiple time series segments and sliding them across the time period to be predicted, not only can the past fluctuations and changes contained in the historical random term sequence be incorporated into the predicted random term sequence, but outliers in a single time series segment can also be avoided from having too much impact on the prediction results.
[0201] Step S206a-4: For each time point in the time period to be predicted, the sum of the data corresponding to the time point in the predicted trend term sequence and the predicted random term sequence is determined as the predicted data for the time point.
[0202] In the first scenario, when the time series is linear, decomposing the first historical time series data into historical trend terms and historical random terms allows for a better capture of long-term trends and short-term fluctuations in the time series. On one hand, a trained support vector machine model is used to generate a predicted trend term sequence, enabling the prediction of the long-term trend of the time period. On the other hand, a predicted random term sequence is obtained by sliding fill based on the historical random term sequence, enabling the prediction of short-term fluctuations within the time period. The predicted trend term sequence reflects the long-term trend of the data within the predicted time period, while the predicted random term sequence reflects short-term fluctuations and changes. By determining the predicted data for the same time point as the sum of the predicted trend term and the predicted random term, a relatively accurate prediction is achieved.
[0203] In the second scenario, when the timing type is periodic, step S206 is implemented by including the following steps S206b-1 to S206b-4:
[0204] Step S206b-1: Use the trained support vector machine model to determine the predicted trend item sequence within the time period to be predicted; the trained support vector machine model is obtained by performing trend decomposition on the first historical time series data.
[0205] Optionally, this step can be implemented in the same way as step S206a-1, and will not be described again here.
[0206] Step S206b-2: Fill the time period to be predicted with a single-period term sequence to obtain the predicted period term sequence.
[0207] Optionally, starting from the first time point of the time period to be predicted, the slide window is used as the sliding step size within the time period to be predicted. During the sliding process, each time the third sliding window is slid, the periodic item sequence is filled into the current sliding window. This process is repeated until the time period to be predicted is completely filled, thus obtaining the prediction periodic item sequence corresponding to the time period to be predicted.
[0208] The duration of the third sliding window is the duration of one cycle, which is the cycle in the cycle feature determined in step S204.
[0209] Whether in the past or the future, the periodic fluctuations of data are a relatively stable process of change. Therefore, the single-period item sequence determined based on the first historical time series data can be directly filled into the time period to be predicted to obtain the predicted period item sequence.
[0210] Step S206b-3: Subtract the corresponding historical trend item and the corresponding historical period item from each historical data in the first historical time series data to obtain the historical random item sequence; the historical data and the corresponding historical trend item and the corresponding historical period item correspond to the same time point.
[0211] Step S206b-4: Slide fill the time period to be predicted based on the historical random item sequence to obtain the predicted random item sequence corresponding to the time period to be predicted.
[0212] Optionally, this step can be implemented in the same way as step S206a-3, and will not be described again here.
[0213] Step S206b-5: For each time point in the time period to be predicted, the sum of the data corresponding to the time points in the predicted trend sequence, predicted period sequence, and predicted random sequence is determined as the predicted data for the time point.
[0214] In the second scenario, when the time series is periodic, decomposing the first historical time series data into historical trend terms, historical periodic terms, and historical random terms allows for better capture of long-term trends, periodic fluctuations, and short-term fluctuations in the time series. On one hand, a trained support vector machine model is used to generate a predicted trend term sequence, enabling the prediction of the long-term trend of the time period. On the other hand, a predicted periodic term sequence is obtained by filling the time period with a single-period term sequence, enabling the prediction of periodic fluctuations. Furthermore, a predicted random term sequence is obtained by sliding-filling the time period with a historical random term sequence, enabling the prediction of short-term fluctuations. By determining the predicted data for the same time point as the sum of the predicted trend term, predicted periodic term, and predicted random term, a relatively accurate prediction is achieved.
[0215] In the third case, when the timing type is ladder-type, step S206 is implemented by following steps S206c-1 to S206c-3:
[0216] Step S206c-1: Determine at least one translation point from the first historical time series data.
[0217] Optionally, step S206c-1 can be implemented in the following ways:
[0218] First-order difference calculation is performed on the first historical time series data to obtain differential time series data;
[0219] Anomaly detection is performed on the differential time series data to determine whether the extreme points in the differential time series data are abnormal;
[0220] If any extreme point in the differential time series data is determined to be an anomaly, then the anomaly extreme point is determined as the translation point.
[0221] Optionally, the anomaly detection algorithm can be a box plot, N-sigma algorithm, ESD algorithm, isolated forest algorithm, or other anomaly detection algorithms. The extreme points include at least one of maxima and minima.
[0222] In this implementation, first-order difference calculation can effectively highlight the points of change in time series data, making abrupt changes and trend changes in the data more obvious. This helps to accurately identify translation points in time series data. By performing anomaly detection on the difference time series data, abnormal extreme points in the data can be identified. These abnormal points usually correspond to abrupt changes or significant changes in the time series data and can be used as candidates for translation points.
[0223] If the duration of the most recent translation time period is determined to be greater than the preset translation duration, then steps S206c-2 to S206c-3 are executed; otherwise, step S206c-4 is executed first, followed by steps S206c-2 to S206c-3.
[0224] The most recent translation time period refers to the time period from the translation point closest to the current time to the end time of the first historical time period. The preset translation duration can be set according to actual needs, and this embodiment does not limit it.
[0225] Step S206c-2: If the duration of the most recent translation time period is determined to be greater than the preset translation duration, then the historical data within the most recent translation time period is used as training samples to train the support vector machine model to obtain the trained support vector machine model.
[0226] Optionally, a support vector machine (SVM) model can be trained using the Sklearn interface. During training, the SVM model learns the overall trend of historical data within the most recent shift time period, which is then used to predict the trend term. The input data for the trained SVM model is the time point, and the output data is the predicted data for that time point.
[0227] Step S206c-3: Based on the trained support vector machine model, the first historical time series data, and the historical trend term sequence, a linear time series prediction strategy is adopted to determine the predicted time series data within the time period to be predicted.
[0228] Optionally, this step can be implemented in the following ways:
[0229] The trained support vector machine model is used to determine the sequence of predicted trend terms for the time period to be predicted.
[0230] Subtract the corresponding historical trend term from each historical data point in the first historical time series data to obtain the historical random term sequence; the historical data and the corresponding historical trend term correspond to the same point in time.
[0231] The predicted random term sequence is obtained by sliding fill based on the historical random term sequence for the time period to be predicted.
[0232] For each time point in the time period to be predicted, the sum of the data corresponding to the time point in the predicted trend term sequence and the predicted random term sequence is determined as the predicted data for that time point.
[0233] Optionally, the implementation of this step can be found in steps S206a-1 to S206a-4, and will not be repeated here.
[0234] In the third case, when the time series is of a stepped type, determining the shift point can effectively identify the points of change in the stepped time series data. This processing method can better capture the stepped changes in the data and improve the accuracy of prediction. By judging whether the duration of the most recent shift period is greater than the preset shift duration, it can be ensured that the model is trained only within a sufficiently long time period, thereby avoiding the impact of short-term fluctuations on model training. After the shift processing, adopting the corresponding time series prediction strategy for linear types can take advantage of the advantages of linear models to further improve the prediction accuracy.
[0235] Step S206c-4: If the duration of the most recent translation time period is less than or equal to the preset translation time period, then the previous time period before the most recent translation time period is translated so that the previous time period is connected with the most recent translation time period to obtain a new most recent translation time period; and so on, until the duration of the new most recent translation time period is greater than the preset translation time period, then the translation stops.
[0236] If the duration of the most recent translation time period is less than or equal to the preset translation time period, it means that the duration of the most recent translation time period is too short and cannot provide enough training samples for the support vector machine model. In this case, the previous time period can be translated to connect with the most recent translation time period to obtain a new most recent translation time period. This process continues until the duration of the new most recent translation time period is greater than the preset translation time period, which means that the duration of the new most recent translation time period is too long and can provide enough training samples for the support vector machine model. At this point, no further translation is needed.
[0237] When processing stepped time series data, if the shift time period is too short, it may lead to insufficient data, affecting the training and prediction of the model. This step ensures that the duration of the new shift time period is longer than the preset shift duration by gradually shifting and connecting the time periods. This can guarantee that there is enough data for training the model, which helps to improve the training effect and prediction accuracy of the model.
[0238] In the fourth case, when the timing type is irregular, step S206 is implemented by including the following steps S206d-1 to S206d-4:
[0239] Step S206d-1: Determine at least one translation point from the first historical time series data.
[0240] Optionally, this step can be implemented in the same way as step S206c-1, and will not be described again here.
[0241] Step S206d-2: Starting from the translation point closest to the current time, sequentially connect the time periods before the translation point with the time periods after the translation point to obtain the first historical time series data after translation.
[0242] Step S206d-3: Using the first historical time series data after translation as training samples, train the support vector machine model to obtain the trained support vector machine model.
[0243] Optionally, this step can be implemented in the same way as step S206c-2, and will not be described again here.
[0244] Step S206d-4: Based on the trained support vector machine model, the first historical time series data, and the historical trend item sequence, a linear time series prediction strategy is adopted to determine the predicted time series data within the time period to be predicted.
[0245] Optionally, this step can be implemented in the same way as step S206c-3, and will not be described again here.
[0246] In the fourth scenario, where the time series is irregular, by determining the shift point and shifting the first historical time series data, the irregular data can be transformed into time series data with certain regularity. This processing method can better capture the potential patterns in the data. By connecting the time periods before and after the shift point, abrupt changes and anomalies in the irregular data can be eliminated, making the data smoother and more continuous, which is helpful for subsequent model training and prediction. After the shift processing, adopting the corresponding time series prediction strategy for linear models can take advantage of the advantages of linear models and further improve the prediction accuracy.
[0247] Optionally, since the time series type is irregular, outliers are very likely to exist in the first historical time series data. Therefore, outliers can be replaced before time series prediction. Accordingly, before step S206d-1, the following steps are also included:
[0248] Anomaly detection is performed on the first historical time series data to determine whether the extreme points in the first historical time series data are abnormal.
[0249] If any extreme point in the first historical time series data is determined to be abnormal, a linear interpolation algorithm is used to replace the extreme point to obtain the updated first historical time series data.
[0250] Optionally, the anomaly detection algorithm can be a box plot, N-sigma algorithm, ESD algorithm, isolated forest algorithm, or other anomaly detection algorithms. The extreme points include at least one of maxima and minima.
[0251] By performing anomaly detection on the first historical time series data, abnormal extreme points can be identified in the data. These anomalies may be caused by data acquisition errors or other external factors. Abnormal extreme points can negatively affect model training and prediction, leading to inaccurate prediction results. By replacing abnormal extreme points with linear interpolation algorithms, the influence of these abnormal extreme points can be eliminated, the data can be smoothed, and the data can better reflect the actual trend of change. This reduces the interference of noise and abrupt changes on the prediction model, making the data more continuous and consistent, thereby improving the quality and reliability of the data, and ultimately improving the accuracy of prediction.
[0252] The above embodiments illustrate the time series prediction process. The following describes the application process of the predicted time series data within the time period to be predicted.
[0253] In some embodiments, when the first historical time-series data is resource capacity time-series data, the predicted time-series data can be applied to resource capacity optimization scenarios. Accordingly, after step S104, the time-series prediction method provided in this application further includes:
[0254] Based on the predicted time series data, the second historical time series data, and the upper limit of resource capacity within the time period to be predicted, the resource capacity optimization amount is determined; the second historical time series data is the time series data generated within the second historical time period, which is the time period before the current moment, and the second historical time period is continuous with the time period to be predicted.
[0255] The resource capacity is optimized based on the resource capacity optimization amount.
[0256] The duration of the second historical time period can be set according to actual needs, and this embodiment does not limit it. For example, if the time period to be predicted is one month after the current time, then the second historical time period can be 15 days or one month before the current time.
[0257] By combining the predicted time series data within the time period to be predicted and the second historical time series data, future resource demand can be predicted more accurately. Optimizing resource capacity based on the resource capacity optimization amount can ensure that resources reach their best state during use and improve resource utilization efficiency.
[0258] In some embodiments, when the resource capacity time-series data is memory capacity time-series data, the current resource capacity limit is the current memory capacity limit. Accordingly, Figure 4 This is a schematic diagram of a memory resource capacity optimization process provided in this application. Based on any of the above embodiments, this embodiment involves a memory resource capacity optimization process, such as... Figure 4 As shown, the process includes the following steps:
[0259] Step S301: Determine the strategy value based on the trend of the predicted time series data, and determine the ratio of the strategy value to the current memory capacity limit as the strategy ratio value; the trend is one of stable, rising or falling.
[0260] Optionally, determining the trend state of the predicted time series data includes: determining the difference between the first and last predicted data in the predicted time series data; if the difference is within a preset threshold range, the trend state is determined to be stable; if the difference exceeds the preset threshold range and the difference is greater than 0, the trend state is determined to be declining; if the difference exceeds the preset threshold range and the difference is less than 0, the trend state is determined to be rising. The preset threshold range can be set according to actual needs, and this embodiment does not limit it.
[0261] Optionally, the implementation method for determining the strategy value based on the trend state of the predicted time series data includes: if the trend state is stable, then the maximum historical data in the second historical time series data is determined as the strategy value; if the trend state is declining, then the current memory capacity is determined as the strategy value; if the trend state is rising, then the maximum predicted data in the predicted time series data is determined as the strategy value.
[0262] Optionally, if the current memory capacity limit is stored in advance, the stored current memory capacity limit can be directly obtained to calculate the strategy ratio value.
[0263] Step S302: The ratio of the target quantile value of the second historical time series data to the current memory capacity limit value is determined as the quantile ratio value.
[0264] Alternatively, the target quantile value may be the 0.95 quantile, the 0.75 quantile, or other suitable quantile values.
[0265] Step S303: If both the strategy ratio value and the quantile ratio value are less than the first preset ratio value, then it is determined that there is a need for scaling down.
[0266] Step S304: If it is determined that there is a need for capacity reduction, the resource capacity optimization amount is determined according to the preset memory capacity reduction strategy.
[0267] Optionally, the implementation methods for determining the resource capacity optimization amount according to the preset memory shrinkage strategy include:
[0268] The current memory capacity limit is reduced according to the preset capacity window. For each preset capacity window reduction, a new policy ratio value is determined based on the policy value and the reduced memory capacity limit value. This process continues until the policy ratio value is greater than the third preset ratio value, at which point the reduction stops.
[0269] The difference between the current maximum memory capacity and the maximum memory capacity obtained from the previous reduction is determined as the resource capacity optimization amount.
[0270] The size of the preset capacity window can be set according to actual needs, and this embodiment does not limit it. For example, the preset capacity window can be 1GB, 1.5GB, etc. The third preset ratio value can be set according to actual needs, and this embodiment does not limit it. For example, the third preset ratio value can be 0.5, 0.6, etc.
[0271] This implementation achieves scaling down by moving and converging windows. By gradually reducing the upper limit of memory capacity, it ensures that each adjustment is within a reasonable range, avoiding the risks of a large adjustment at once. After each reduction of a preset capacity window, a new policy ratio value is determined based on the policy value and the reduced upper limit of memory capacity, which can dynamically adjust the resource capacity.
[0272] Step S305: If both the strategy ratio value and the quantile ratio value are greater than the second preset ratio value, then it is determined that there is a need for expansion.
[0273] The first preset ratio value and the second preset ratio value can be set according to actual needs. This embodiment does not limit them. For example, the first preset ratio value is 0.1, 0.2, etc., and the second preset ratio value is 0.8, 0.95, etc.
[0274] Step S306: If it is determined that there is an expansion requirement, the resource capacity optimization amount is determined according to the preset memory expansion strategy.
[0275] Optionally, the implementation methods for determining the resource capacity optimization amount according to the preset memory expansion strategy include:
[0276] The current memory capacity limit is increased according to the preset capacity window. For each preset capacity window increase, a new policy ratio value is determined based on the policy value and the increased memory capacity limit. This process continues until the policy ratio value is less than the third preset ratio value, at which point the increase stops.
[0277] The difference between the previous memory capacity limit and the current memory capacity limit is determined as the resource capacity optimization amount.
[0278] The size of the preset capacity window can be set according to actual needs, and this embodiment does not limit it. For example, the preset capacity window can be 1GB, 1.5GB, etc. The third preset ratio value can be set according to actual needs, and this embodiment does not limit it. For example, the third preset ratio value can be 0.5, 0.6, etc.
[0279] This implementation method ensures that each adjustment is within a reasonable range by gradually increasing the upper limit of memory capacity, avoiding the risks of a large adjustment at once. After each expansion of a preset capacity window, a new policy ratio value is determined based on the policy value and the expanded upper limit of memory capacity, which can dynamically adjust the resource capacity.
[0280] In some embodiments, when the resource capacity time-series data is processor utilization time-series data, the current resource capacity upper limit is the current number of processors; and the number of processors refers to the number of processor cores. For example, the processor is a central processing unit (CPU), a virtual central processing unit (vCPU), or other processors. Figure 5 This is a schematic diagram of a processor utilization optimization process provided in this application. Based on any of the above embodiments, this embodiment involves a processor utilization optimization process, such as... Figure 5 As shown, the process includes the following steps:
[0281] Step S401: Determine the strategy value based on the trend status of the predicted time series data; the trend status is one of stable, rising, or falling.
[0282] Optionally, this step is implemented in the same way as the step S301 of determining the strategy value based on the trend of the predicted time series data, and will not be repeated here.
[0283] Step S402: Determine the target quantile value of the second historical time series data.
[0284] Alternatively, the target quantile value may be the 0.95 quantile, the 0.75 quantile, or other suitable quantile values.
[0285] Step S403: If both the strategy value and the target quantile value are less than the first preset value, then it is determined that there is a need for scaling down.
[0286] Step S404: If it is determined that there is a need for capacity reduction, the resource capacity optimization amount is determined according to the preset utilization rate capacity reduction strategy.
[0287] Optionally, the implementation methods for determining the optimized resource capacity according to the preset utilization rate scaling-down strategy include:
[0288] The number of processors is reduced one by one, and the new processor utilization rate is determined for each processor removed; this process is continued until the new processor utilization rate is greater than the third preset value, at which point the reduction stops.
[0289] The difference between the current number of processors and the number of processors reduced in the last iteration is determined as the resource capacity optimization amount; processor utilization is proportional to the number of processors.
[0290] The third preset value can be set according to actual needs. This embodiment does not limit this setting. For example, the third preset value can be 50, 60, etc.
[0291] In practical applications, processor utilization is directly proportional to the number of processors, as shown in the following formula:
[0292]
[0293] Where P is the current processor utilization rate, and N is the current number of processors. ′ This is the adjusted processor utilization, N ′ This is the adjusted number of processors.
[0294] This implementation method ensures that each adjustment is within a reasonable range by gradually reducing the number of processors, avoiding the risks of a large-scale adjustment at once. After reducing one processor at a time, the new processor utilization rate is determined, and the resource capacity can be dynamically adjusted.
[0295] Step S405: If both the strategy value and the target quantile value are greater than the second preset value, then it is determined that there is a need for expansion.
[0296] The first preset value and the second preset value can be set according to actual needs. This embodiment does not limit them. For example, the first preset ratio value is 10, 12, etc., and the second preset ratio value is 90, 95, etc.
[0297] Step S406: If it is determined that there is an expansion need, the resource capacity optimization amount is determined according to the preset utilization rate expansion strategy.
[0298] Optionally, the implementation methods for determining the optimized resource capacity according to the preset utilization rate expansion strategy include:
[0299] The number of processors is increased one by one, and the utilization rate of each new processor is determined; this process continues until the utilization rate of the new processor is less than the third preset value, at which point the increase stops.
[0300] The difference between the number of processors increased in the previous iteration and the current number of processors is determined as the resource capacity optimization amount.
[0301] The third preset value can be set according to actual needs. This embodiment does not limit this setting. For example, the third preset value can be 50, 60, etc.
[0302] This implementation method ensures that each adjustment is within a reasonable range by gradually increasing the number of processors, avoiding the risks of a large-scale adjustment at once. After each processor is added, the new processor utilization rate is determined, and the resource capacity can be dynamically adjusted.
[0303] In some embodiments, when the first historical time-series data is business performance indicator data, the predicted time-series data can also be applied to dynamic threshold anomaly detection scenarios. Accordingly, Figure 6 This is a schematic diagram of a dynamic threshold anomaly detection process provided in this application. Based on any of the above embodiments, this embodiment involves the process of dynamic threshold anomaly detection, such as... Figure 6 As shown, the process includes the following steps:
[0304] Step S501: Determine the upper and lower threshold values corresponding to each time point in the predicted time series data.
[0305] Optionally, step S501 can be implemented by including the following steps S5011-S5015:
[0306] Step S5011: Obtain the historical random item sequence of the first historical time series data.
[0307] Optionally, the historical random item sequence may be the historical random item sequence determined in step S206.
[0308] Step S5012: Determine the standard deviation and target quantile of the positive random terms.
[0309] Here, positive random terms refer to historical random terms greater than 0 in the historical random term sequence. Optionally, the target quantile value is the 0.95 quantile, the 0.75 quantile, or other suitable quantile values.
[0310] Step S5013: For each time point in the predicted time series data, the sum of the predicted data corresponding to that time point and the reference maximum value is determined as the upper limit of the threshold corresponding to that time point; the reference maximum value is the maximum value between three times the standard deviation and the target quantile value.
[0311] Step S5014: Determine the standard deviation and target quantile of the negative random term.
[0312] Here, negative random items refer to historical random items in the historical random item sequence that are less than 0. Optionally, the target quantile value is the 0.95 quantile, the 0.75 quantile, or other suitable quantile values.
[0313] Step S5015: For each time point in the predicted time series data, the sum of the predicted data corresponding to that time point and the reference maximum value is determined as the lower limit of the threshold corresponding to that time point; the reference maximum value is the maximum value between three times the standard deviation and the target quantile value.
[0314] By calculating the standard deviation and target quantile of positive and negative random terms, the fluctuation range in historical data can be quantified. Considering the standard deviation and target quantile of positive and negative random terms separately can more comprehensively reflect the fluctuation characteristics of the data. The reference maximum value is the maximum of three times the standard deviation and the target quantile value. This method of determination can ensure that the upper and lower limits of the threshold cover most of the data fluctuation range. By setting the upper and lower limits of the threshold, a reasonable fluctuation range can be provided for the predicted data.
[0315] Step S502: For each time point in the predicted time series data, if the predicted data for each time point within a consecutive preset duration is outside the threshold interval, an alarm is generated; the starting point of the threshold interval is the lower limit of the threshold corresponding to the time point, and the ending point is the upper limit of the threshold corresponding to the time point.
[0316] The continuous preset duration can be set according to actual needs. This embodiment does not limit this, for example, 10 minutes, 15 minutes, 20 minutes, etc.
[0317] By setting upper and lower threshold values for each time point, the fluctuation range of normal data can be clearly defined. By detecting whether the predicted data for each time point within a consecutive preset time period falls outside the threshold range, the accuracy of anomaly detection can be improved, avoiding false alarms caused by a single anomaly. When it is detected that the predicted data for each time point within a consecutive preset time period is outside the threshold range, an alarm is immediately generated. This timely warning mechanism helps users quickly identify and handle anomalies, reducing potential risks and losses.
[0318] Optionally, after step S502, the following step S503 is also included:
[0319] Step S503: For each time point in the predicted time series data, if the predicted data for each time point within a consecutive preset duration are all within the threshold range, then the alarm is eliminated.
[0320] By eliminating alarms when the predicted data at each time point within a consecutive preset time period is within the threshold range, alarm status can be dynamically managed. If the predicted data is within the normal range within a consecutive preset time period, it indicates that the business system has returned to normal. Eliminating alarms in a timely manner can avoid unnecessary interference and false alarms.
[0321] For example, for the first historical time series data, data preprocessing, trend and period decomposition, time series type classification, and time series prediction are performed sequentially to obtain predicted time series data. Then, based on the predicted time series data, resource capacity optimization, dynamic threshold anomaly detection, and alarms can be performed respectively. Specifically, data preprocessing includes missing data detection and missing segment filling, which includes calculating data acquisition frequency and data frequency normalization; trend and period decomposition includes support vector machine fitting, period determination, and period confidence determination; time series type classification includes determining linear confidence and determining step confidence, classifying according to a time series type classification strategy, and the time series types include linear, periodic, step-type, and irregular; in time series prediction, linear prediction strategies include trend prediction and linear random prediction; periodic prediction strategies include trend prediction, periodic prediction, and periodic random prediction; step-type prediction strategies include step-trend prediction and step-random prediction; and irregular prediction strategies include irregular trend prediction and irregular random prediction. Resource capacity optimization includes memory capacity optimization and processor utilization optimization; dynamic threshold anomaly detection and alarms include threshold upper and lower limit calculation, anomaly detection, and alarms.
[0322] Figure 7 This is a schematic diagram of the structure of a time series data prediction device provided in this application, as shown below. Figure 7 As shown, in this embodiment, the time series data prediction device 60 can be installed in an electronic device, and the time series data prediction device 60 includes:
[0323] The acquisition module 601 is used to acquire first historical time series data; the first historical time series data is time series data generated within a first historical time period.
[0324] The decomposition module 602 is used to perform trend and period decomposition on the first historical time series data to obtain trend features and periodic features; the trend features are used to characterize the overall trend of the first historical time series data within the first historical time period, and the periodic features are used to characterize the periodic fluctuations of the first historical time series data.
[0325] The determination module 603 is used to determine the time series type corresponding to the first historical time series data based on trend characteristics and periodic characteristics; the time series type is one of linear, periodic, step-type, or irregular.
[0326] The prediction module 604 is used to determine the predicted time series data within the time period to be predicted based on the time series prediction strategy corresponding to the time series type.
[0327] In some embodiments, the trend feature includes a sequence of historical trend items; the sequence of historical trend items includes historical trend items corresponding to each time point in the first historical time series data; the historical trend item corresponding to a time point is the trend component of the historical data corresponding to that time point.
[0328] The decomposition module 602, when performing trend decomposition on the first historical time series data to obtain trend characteristics, includes:
[0329] The training unit is used to train the support vector machine model using the first historical time series data as training samples, so as to obtain the trained support vector machine model.
[0330] The determination unit is used to input each time point in the first historical time series data into the trained support vector machine model, and use the trained support vector machine model to output the prediction data corresponding to each time point.
[0331] The determining unit is also used to determine the predicted data corresponding to each time point in the first historical time series data as the historical trend item corresponding to the time point, so as to obtain the historical trend item sequence.
[0332] In some embodiments, the decomposition module 602 further includes an anomaly detection unit, configured to perform anomaly detection on the first historical time series data before training the support vector machine model using the first historical time series data as training samples to obtain the trained support vector machine model, in order to determine whether the extreme points in the first historical time series data are abnormal; if any extreme point in the first historical time series data is determined to be abnormal, the median of multiple historical data within a preset time period centered on the abnormal extreme point is used to replace the abnormal extreme point.
[0333] In some embodiments, the periodic feature includes period, periodic confidence, single-period item sequence, and historical periodic item sequence; the single-period item sequence includes the historical periodic items corresponding to each time point within a period; the historical periodic item sequence includes the historical periodic items corresponding to each time point in the first historical time series data; the historical periodic item corresponding to a time point refers to the periodic component of the historical data corresponding to that time point.
[0334] The decomposition module 602, when performing periodic decomposition on the first historical time series data to obtain periodic features, includes:
[0335] The detrending unit is used to subtract the corresponding historical trend item from the historical data of each time point in the first historical time series data to obtain the detrended first historical time series data.
[0336] The determination unit is used to determine the period and period confidence level corresponding to the first historical time series data of detrending by using a preset period detection algorithm;
[0337] The division unit is used to divide the first historical time series data that has been detrended into multiple periodic segments according to the period;
[0338] A generation unit is used to generate single-period item sequences based on a period and multiple periodic segments;
[0339] The replacement unit is used to replace the historical data corresponding to each time point in each periodic segment with the historical periodic item corresponding to the time point in the single periodic item sequence to obtain the replaced periodic segment; and to splice multiple replaced periodic segments in chronological order to obtain the historical periodic item sequence.
[0340] In some embodiments, the determining unit is configured to:
[0341] Obtain multiple alternative periods for detrended first historical time series data;
[0342] Determine the confidence level corresponding to each alternative period;
[0343] The candidate period corresponding to the maximum confidence level is determined as the period corresponding to the first historical time series data in the detrended data, and the maximum confidence level is assigned to the period confidence level corresponding to the first historical time series data in the detrended data.
[0344] In some embodiments, the determining unit is configured to:
[0345] For each alternative period, perform the following operations, which include:
[0346] Create a detrended copy of the first historical time series data;
[0347] Using the first sliding window as the sliding step size, the copy is slid forward, and the historical data with time points in the first sliding window are moved to the end of the sequence to obtain the first historical time series data after sliding. The correlation coefficient between the first historical time series data after sliding and the first historical time series data after detrending is determined. This process is repeated, and a correlation coefficient is determined for each slide until the cumulative sliding step size exceeds the duration of the first historical time period, at which point the sliding stops.
[0348] The mean of the identified correlation coefficients is used as the confidence level for the candidate period.
[0349] In some embodiments, the generating unit is configured to:
[0350] Generate a blank periodic segment with a duration of period, containing multiple time points, and where the data corresponding to each time point is empty; the number of multiple time points is the same as the number of time points within a period.
[0351] For each time point in the blank periodic segment, the average value of the historical data corresponding to the reference time points in multiple periodic segments is determined as the historical periodic item corresponding to the time point; the reference time point is the time point in the periodic segment that corresponds to the time point.
[0352] For each time point in the blank periodic segment, the null value corresponding to the time point is replaced with the historical periodic item corresponding to the time point to obtain a single periodic item sequence.
[0353] In some embodiments, the determining module 603 includes:
[0354] The determination unit is used to determine the linear confidence, periodic confidence, and step confidence of the first historical time series data based on trend and periodic characteristics. The linear confidence is used to indicate the probability that the first historical time series data belongs to the linear type; the periodic confidence is used to indicate the probability that the first historical time series data belongs to the periodic type; and the step confidence is used to indicate the probability that the first historical time series data belongs to the step type.
[0355] The determination unit is also used to determine the time series type corresponding to the first historical time series data by adopting a preset time series classification strategy based on linear confidence, periodic confidence and step confidence.
[0356] In some embodiments, the trend feature includes a sequence of historical trend items; the sequence of historical trend items includes historical trend items corresponding to each time point in the first historical time series data; the historical trend item corresponding to a time point refers to the trend component of the historical data corresponding to that time point; the periodic feature includes periodic confidence.
[0357] Determine the unit, used for:
[0358] The number of neighborhood points in the first historical time series data is determined, and the ratio of this number to the total number of historical data in the first historical time series data is used as the linear confidence level; where a neighborhood point refers to historical data located in the neighborhood of the corresponding historical trend item.
[0359] Extracting periodic confidence from periodic features;
[0360] First-order difference calculation is performed on the first historical time series data to obtain differential time series data, and the confidence level of each data in the differential time series data is determined. The average confidence level of each data in the differential time series data is determined as the step confidence level.
[0361] In some embodiments, the determining unit is configured to:
[0362] For each data point in the differential time series data, if the absolute value of the data is less than the preset reference value, the upper limit of the confidence level is determined as the confidence level of the data.
[0363] or,
[0364] For each data point in the differential time series data, if the absolute value of the data is greater than or equal to a preset reference value, then the lower limit of the confidence level is determined as the confidence level of the data.
[0365] In some embodiments, the determining unit is configured to:
[0366] Determine whether the period confidence level is greater than the period confidence threshold;
[0367] If the period confidence level is greater than the period confidence level threshold, then the time series type corresponding to the first historical time series data is determined to be periodic.
[0368] If the periodic confidence level is less than or equal to the periodic confidence level threshold, then determine whether the linear confidence level is greater than the linear confidence level threshold.
[0369] If the linear confidence level is greater than the linear confidence level threshold, then the time series type corresponding to the first historical time series data is determined to be linear.
[0370] If the linear confidence level is less than or equal to the linear confidence level threshold, then determine whether the step confidence level is greater than the step confidence level threshold.
[0371] If the step confidence level is greater than the step confidence level threshold, then the time series type corresponding to the first historical time series data is determined to be step type;
[0372] If the step confidence level is less than or equal to the step confidence level threshold, then the time series type corresponding to the first historical time series data is determined to be irregular.
[0373] In some embodiments, the trend feature includes a historical trend item sequence; the historical trend item sequence includes historical trend items corresponding to each time point in the first historical time series data; the historical trend item corresponding to a time point refers to the trend component of the historical data corresponding to the time point; the predicted time series data includes the predicted data for each time point within the predicted time period.
[0374] In the case of a linear time series, prediction module 604 is used for:
[0375] The trained support vector machine model is used to determine the sequence of predicted trend terms within the time period to be predicted; the trained support vector machine model is obtained by performing trend decomposition on the first historical time series data.
[0376] Subtract the corresponding historical trend term from each historical data point in the first historical time series data to obtain the historical random term sequence; the historical data and the corresponding historical trend term correspond to the same point in time.
[0377] The predicted random term sequence is obtained by sliding fill based on the historical random term sequence for the time period to be predicted.
[0378] For each time point in the time period to be predicted, the sum of the data corresponding to the time point in the predicted trend term sequence and the predicted random term sequence is determined as the predicted data for that time point.
[0379] In some embodiments, the prediction module 604 is configured to:
[0380] The historical random item sequence is divided into multiple time segments according to the second sliding window;
[0381] Starting from the first time point of the time period to be predicted, the second sliding window is used as the sliding step size to slide within the time period to be predicted. During the sliding process, each time the second sliding window is slid, a time segment is extracted from multiple time segments and the extracted time segment is filled into the current sliding window. This process is repeated until the time period to be predicted is completely filled, thus obtaining the predicted random item sequence corresponding to the time period to be predicted.
[0382] In some embodiments, the trend feature includes a historical trend item sequence; the historical trend item sequence includes historical trend items corresponding to each time point in the first historical time series data; the historical trend item corresponding to a time point refers to the trend component of the historical data corresponding to that time point; the periodic feature includes period, periodic confidence, single-period item sequence, and historical periodic item sequence; the historical periodic item sequence includes historical periodic items corresponding to each time point in the first historical time series data; the historical periodic item corresponding to a time point refers to the periodic component of the historical data corresponding to that time point; the predicted time series data includes predicted data for each time point within the prediction period.
[0383] When the time series type is periodic, prediction module 604 is used for:
[0384] The trained support vector machine model is used to determine the sequence of predicted trend terms within the time period to be predicted; the trained support vector machine model is obtained by performing trend decomposition on the first historical time series data.
[0385] The time period to be predicted is filled with a single-period term sequence to obtain the predicted period term sequence;
[0386] Subtract the corresponding historical trend item and the corresponding historical cycle item from each historical data in the first historical time series data to obtain the historical random item sequence; the historical data and the corresponding historical trend item and the corresponding historical cycle item each correspond to the same point in time.
[0387] The predicted random term sequence is obtained by sliding fill based on the historical random term sequence for the time period to be predicted.
[0388] For each time point in the time period to be predicted, the sum of the data corresponding to the time point in the prediction trend sequence, prediction period sequence, and prediction random sequence is determined as the prediction data for that time point.
[0389] In some embodiments, the trend feature includes a historical trend item sequence; the historical trend item sequence includes historical trend items corresponding to each time point in the first historical time series data; the historical trend item corresponding to a time point refers to the trend component of the historical data corresponding to the time point; the predicted time series data includes the predicted data for each time point within the predicted time period.
[0390] In the case of a ladder-type time series, prediction module 604 is used for:
[0391] Determine at least one translation point from the first historical time series data;
[0392] If the duration of the most recent translation time period is determined to be greater than the preset translation duration, then the historical data within the most recent translation time period is used as the training sample to train the support vector machine model to obtain the trained support vector machine model; the most recent translation time period is the time period from the translation point closest to the current time to the end time of the first historical time period;
[0393] Based on the trained support vector machine model, the first historical time series data, and the historical trend term sequence, a linear time series prediction strategy is adopted to determine the predicted time series data within the time period to be predicted.
[0394] In some embodiments, the prediction module 604, when determining at least one translation point from the first historical time series data, is configured to:
[0395] First-order difference calculation is performed on the first historical time series data to obtain differential time series data;
[0396] Anomaly detection is performed on the differential time series data to determine whether the extreme points in the differential time series data are abnormal;
[0397] If any extreme point in the differential time series data is determined to be an anomaly, then the anomaly extreme point is determined as the translation point.
[0398] In some embodiments, the prediction module 604 is further configured to:
[0399] If the duration of the most recent translation time period is less than or equal to the preset translation time period, then the previous time period before the most recent translation time period is translated so that the previous time period is connected with the most recent translation time period to obtain a new most recent translation time period; and so on, until the duration of the new most recent translation time period is greater than the preset translation time period, then the translation stops.
[0400] In some embodiments, the trend feature includes a historical trend item sequence; the historical trend item sequence includes historical trend items corresponding to each time point in the first historical time series data; the historical trend item corresponding to a time point refers to the trend component of the historical data corresponding to the time point; the predicted time series data includes the predicted data for each time point within the predicted time period.
[0401] In the case of an irregular time series, prediction module 604 is used for:
[0402] Determine at least one translation point from the first historical time series data;
[0403] Starting from the shift point closest to the current time, the time periods before the shift point are sequentially connected with the time periods after the shift point to obtain the first historical time series data after the shift.
[0404] Using the first historical time series data after translation as training samples, a support vector machine model is trained to obtain the trained support vector machine model.
[0405] Based on the trained support vector machine model, the first historical time series data, and the historical trend term sequence, a linear time series prediction strategy is adopted to determine the predicted time series data within the time period to be predicted.
[0406] In some embodiments, the prediction module 604, before determining at least one translation point from the first historical time-series data, is further configured to:
[0407] Anomaly detection is performed on the first historical time series data to determine whether the extreme points in the first historical time series data are abnormal.
[0408] If any extreme point in the first historical time series data is determined to be abnormal, a linear interpolation algorithm is used to replace the extreme point to obtain the updated first historical time series data.
[0409] In some embodiments, a preprocessing module is further included, for:
[0410] The first historical time series data is preprocessed to obtain the updated first historical time series data;
[0411] Accordingly, the preprocessing module, when preprocessing the first historical time series data to obtain the updated first historical time series data, is used for:
[0412] If the duration of the missing segment is greater than the first preset duration, and the duration of the time series data following the missing segment is greater than the second preset duration, then the time series data following the missing segment will be determined as the updated first historical time series data; the missing segment refers to the time period of missing data.
[0413] If the duration of the missing segment is greater than the first preset duration, and the duration of the time series data following the missing segment is less than or equal to the second preset duration, then the time series data preceding the missing segment will be determined as the updated first historical time series data.
[0414] If the duration of the missing segment is less than or equal to the first preset duration, a linear interpolation algorithm is used to fill the missing segment, and the first historical time series data after filling the missing segment is determined as the updated first historical time series data.
[0415] In some embodiments, the preprocessing module, when filling missing segments using a linear interpolation algorithm, is used to:
[0416] Determine the data sampling frequency for the first historical time series data;
[0417] The first historical time series data is divided into multiple equally spaced sampling windows according to the reciprocal of the data sampling frequency, and the average value of the historical data in each sampling window is determined.
[0418] The missing segments are filled using a linear interpolation algorithm and the average value of historical data within each sampling window.
[0419] In some embodiments, where the first historical time-series data is resource capacity time-series data, an optimization processing module is further included, for:
[0420] Based on the predicted time series data, the second historical time series data, and the upper limit of resource capacity within the time period to be predicted, the resource capacity optimization amount is determined; the second historical time series data is the time series data generated within the second historical time period, which is the time period before the current moment, and the second historical time period is continuous with the time period to be predicted.
[0421] The resource capacity is optimized based on the resource capacity optimization amount.
[0422] In some embodiments, when the resource capacity time-series data is memory capacity time-series data, the current resource capacity upper limit is the current memory capacity upper limit.
[0423] The optimization processing module is used for:
[0424] Based on the trend of the predicted time series data, the strategy value is determined, and the ratio of the strategy value to the current memory capacity limit is determined as the strategy ratio value; the trend is one of stable, rising, or falling.
[0425] The ratio of the target quantile value of the second historical time series data to the current maximum memory capacity is determined as the quantile ratio value;
[0426] If both the strategy ratio and the percentile ratio are less than the first preset ratio, then there is a need for scaling down; if both the strategy ratio and the percentile ratio are greater than the second preset ratio, then there is a need for scaling up.
[0427] If a reduction in capacity is determined, the resource capacity optimization amount is determined according to the preset memory reduction strategy.
[0428] If an expansion requirement is determined, the resource capacity optimization amount is determined according to the preset memory expansion strategy.
[0429] In some embodiments, when determining the resource capacity optimization amount according to a preset memory shrinkage strategy, the optimization processing module is used to:
[0430] The current memory capacity limit is reduced according to the preset capacity window. For each preset capacity window reduction, a new policy ratio value is determined based on the policy value and the reduced memory capacity limit value. This process continues until the policy ratio value is greater than the third preset ratio value, at which point the reduction stops.
[0431] The difference between the current maximum memory capacity and the maximum memory capacity obtained from the previous reduction is determined as the resource capacity optimization amount.
[0432] In some embodiments, the optimization processing module, when determining the resource capacity optimization amount according to a preset memory expansion strategy, is used to:
[0433] The current memory capacity limit is increased according to the preset capacity window. For each preset capacity window increase, a new policy ratio value is determined based on the policy value and the increased memory capacity limit. This process continues until the policy ratio value is less than the third preset ratio value, at which point the increase stops.
[0434] The difference between the previous memory capacity limit and the current memory capacity limit is determined as the resource capacity optimization amount.
[0435] In some embodiments, when the resource capacity time-series data is the processor utilization time-series data, the current resource capacity upper limit is the current number of processors;
[0436] The optimization processing module is used for:
[0437] The strategy value is determined based on the trend of the predicted time series data; the trend can be one of stable, rising, or falling.
[0438] Determine the target quantile value for the second historical time series data;
[0439] If both the strategy value and the target quantile value are less than the first preset value, then there is a need for scaling down; if both the strategy value and the target quantile value are greater than the second preset value, then there is a need for scaling up.
[0440] If a reduction in capacity is determined, the resource capacity optimization amount is determined according to the preset utilization reduction strategy;
[0441] If an expansion requirement is determined, the resource capacity optimization amount is determined according to the preset utilization expansion strategy.
[0442] In some embodiments, the optimization processing module, when determining the resource capacity optimization amount according to a preset utilization scaling-down strategy, is used to:
[0443] The number of processors is reduced one by one, and the new processor utilization rate is determined for each processor removed; this process is continued until the new processor utilization rate is greater than the third preset value, at which point the reduction stops.
[0444] The difference between the current number of processors and the number of processors reduced in the last iteration is determined as the resource capacity optimization amount; processor utilization is proportional to the number of processors.
[0445] In some embodiments, the optimization processing module, when determining the resource capacity optimization amount according to a preset utilization expansion strategy, is used for:
[0446] The number of processors is increased one by one, and the utilization rate of each new processor is determined; this process continues until the utilization rate of the new processor is less than the third preset value, at which point the increase stops.
[0447] The difference between the number of processors increased in the previous iteration and the current number of processors is determined as the resource capacity optimization amount.
[0448] In some embodiments, an anomaly detection module is further included, for:
[0449] Determine the upper and lower threshold values corresponding to each time point in the predicted time series data;
[0450] If the predicted data for each time point in the predicted time series data are all outside the threshold range within a consecutive preset duration, an alarm will be generated. The starting point of the threshold range is the lower limit of the threshold corresponding to the time point, and the ending point is the upper limit of the threshold corresponding to the time point.
[0451] In some embodiments, the anomaly detection module, when determining the upper and lower threshold values corresponding to each time point in the predicted time series data, is used to:
[0452] Obtain the historical random item sequence of the first historical time series data;
[0453] Determine the standard deviation and target quantile of the positive random term;
[0454] For each time point in the predicted time series data, the sum of the predicted data corresponding to the time point and the reference maximum value is determined as the upper limit of the threshold value corresponding to the time point; the reference maximum value is the maximum value between three times the standard deviation and the target quantile value;
[0455] Determine the standard deviation and target quantile of the negative random term;
[0456] For each time point in the predicted time series data, the sum of the predicted data corresponding to the time point and the reference maximum value is determined as the lower limit of the threshold corresponding to the time point; the reference maximum value is the maximum value between three times the standard deviation and the target quantile value.
[0457] In some embodiments, the anomaly detection module is further configured to:
[0458] If the predicted data for each time point in the predicted time series data are all within the threshold range for a consecutive preset duration, then the alarm will be eliminated.
[0459] The time series data prediction device 60 provided in this embodiment can execute the technical solution of the corresponding method embodiment. Its implementation principle and technical effect are similar to those of the corresponding method embodiment, and will not be described again here.
[0460] This application also provides an electronic device. Figure 8 This is a schematic diagram of the structure of an electronic device provided in this application. For example... Figure 8 As shown, the electronic device 70 includes a processor 701 and a memory 702 communicatively connected to the processor 701.
[0461] The memory 702 stores computer-executable instructions; the processor 701 executes the computer-executable instructions stored in the memory 702 to implement the timing data prediction method provided in this application.
[0462] In this embodiment, the memory 702 and the processor 701 are connected via a bus. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, only one thick line is used in the figure, but this does not indicate that there is only one bus or one type of bus.
[0463] The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein. The various components are interconnected via different buses and can be mounted on a common motherboard or otherwise as required.
[0464] In an exemplary embodiment, a computer-readable storage medium is also provided, which stores computer-executable instructions that, when executed by a processor, are used to implement the time-series data prediction method provided in this application.
[0465] In an exemplary embodiment, a computer program product is also provided, including a computer program, which, when executed by a processor, is used to implement the time-series data prediction method provided in this application.
[0466] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the claims.
[0467] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for time series data prediction, the method comprising: The method comprises the following steps: obtaining first historical time series data; the first historical time series data is time series data generated in a first historical time period; performing trend cycle decomposition on the first historical time series data to obtain a trend feature and a cycle feature; the trend feature is used to represent the overall trend of the first historical time series data in the first historical time period, and the cycle feature is used to represent the periodic fluctuation of the first historical time series data; based on the trend feature and the cycle feature, determining a time series type corresponding to the first historical time series data; the time series type is one of linear type, periodic type, step type or irregular type; based on a time series prediction strategy corresponding to the time series type, determining prediction time series data in a to-be-predicted time period.
2. The method of claim 1, wherein, The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point is a trend component of historical data corresponding to the time point; performing trend decomposition on the first historical time series data to obtain a trend feature, comprising: training a support vector machine model using the first historical time series data as a training sample to obtain a trained support vector machine model; inputting respective time points in the first historical time series data into the trained support vector machine model, and outputting prediction data corresponding to each of the time points by using the trained support vector machine model; for each time point in the first historical time series data, determining the prediction data corresponding to the time point as a historical trend item corresponding to the time point to obtain a historical trend item sequence.
3. The method of claim 2, wherein, Before the step of training a support vector machine model using the first historical time series data as a training sample to obtain a trained support vector machine model, the method further comprises: performing anomaly detection on the first historical time series data to determine whether an extreme value point in the first historical time series data is abnormal; if it is determined that any extreme value point in the first historical time series data is abnormal, replacing a median value of historical data in a preset time period centered on the abnormal extreme value point with the abnormal extreme value point.
4. The method of claim 2, wherein, The cycle feature comprises a period, a period confidence, a single-period item sequence and a historical period item sequence; the single-period item sequence comprises historical period items corresponding to respective time points in a period; the historical period item sequence comprises historical period items corresponding to respective time points in the first historical time series data; a historical period item corresponding to a time point refers to a period component of historical data corresponding to the time point; performing cycle decomposition on the first historical time series data to obtain a cycle feature, comprising: subtracting respective historical trend items from historical data of respective time points in the first historical time series data to obtain detrended first historical time series data; determining a period and a period confidence corresponding to the detrended first historical time series data by using a preset period detection algorithm; dividing the detrended first historical time series data into a plurality of period segments according to the period; generating a single-period item sequence based on the period and the plurality of period segments; For each of the periodic segments, historical data corresponding to each time point in the periodic segment is replaced by a historical periodic item corresponding to the time point in the single-period item sequence to obtain a replaced periodic segment; and the plurality of replaced periodic segments are spliced in time sequence to obtain the historical periodic item sequence.
5. The method of claim 4, wherein, The adopting of the preset periodic detection algorithm comprises: obtaining a plurality of candidate periods of the detrended first historical time series data; determining a confidence degree corresponding to each of the candidate periods; determining the candidate period corresponding to the maximum confidence degree as the period corresponding to the detrended first historical time series data, and assigning the maximum confidence degree to the period confidence degree corresponding to the detrended first historical time series data.
6. The method of claim 5, wherein, The determining of the confidence degree corresponding to each of the candidate periods comprises: For each of the candidate periods, the following operations are performed: creating a copy of the detrended first historical time series data; sliding the copy forward by a first sliding window as a sliding step, moving historical data at time points in a front first sliding window to the end of the sequence to obtain a slid first historical time series data, and determining a correlation coefficient between the slid first historical time series data and the detrended first historical time series data; similarly, a correlation coefficient is determined for each sliding, until the cumulative sliding step exceeds the length of the first historical time period, and the sliding is stopped; determining the average of the plurality of determined correlation coefficients as the confidence degree corresponding to the candidate period.
7. The method of claim 4, wherein, The generating of the single-period item sequence based on the period and the plurality of periodic segments comprises: generating a blank periodic segment with a length of the period, containing a plurality of time points, and the data corresponding to each time point being null; the number of the plurality of time points is the number of time points in a period; for each time point in the blank periodic segment, determining the average of historical data corresponding to a reference time point in the plurality of periodic segments as a historical periodic item corresponding to the time point; the reference time point is a time point in the periodic segment corresponding to the time point; for each time point in the blank periodic segment, replacing the null value corresponding to the time point with the historical periodic item corresponding to the time point to obtain a single-period item sequence.
8. The method of claim 1, wherein, The determining of the time series type corresponding to the first historical time series data based on the trend feature and the period feature comprises: determining a linear confidence degree, a period confidence degree and a ladder confidence degree of the first historical time series data based on the trend feature and the period feature; the linear confidence degree is used to represent the possibility that the first historical time series data belongs to a linear type; the period confidence degree is used to represent the possibility that the first historical time series data belongs to a periodic type; and the ladder confidence degree is used to represent the possibility that the first historical time series data belongs to a ladder type; adopting a preset time series classification strategy to determine the time series type corresponding to the first historical time series data based on the linear confidence degree, the period confidence degree and the ladder confidence degree.
9. The method of claim 8, wherein, The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence; The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence; The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence; The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence; The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence; 10. The method of claim 9, wherein, The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence.
11. The method of claim 8, wherein, The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence.
12. The method of claim 1, wherein, The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a periodic confidence. The trend feature comprises a historical trend item sequence; the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; determine a prediction trend item sequence in the to-be-predicted time period by using the trained support vector machine model, wherein the trained support vector machine model is obtained by training when the trend decomposition is performed on the first historical time series data; subtract each historical data in the first historical time series data from a corresponding historical trend item to obtain a historical random item sequence, wherein the historical data and the corresponding historical trend item correspond to a same time point; slide fill the to-be-predicted time period based on the historical random item sequence to obtain a prediction random item sequence corresponding to the to-be-predicted time period; for each time point in the to-be-predicted time period, determine prediction data of the time point by summing data corresponding to the time point in the prediction trend item sequence and the prediction random item sequence.
13. The method of claim 12, wherein, The slide filling of the to-be-predicted time period based on the historical random item sequence to obtain the prediction random item sequence corresponding to the to-be-predicted time period comprises: divide the historical random item sequence into a plurality of time series segments according to a second sliding window; start from a first time point of the to-be-predicted time period, slide in the to-be-predicted time period with the second sliding window as a sliding step, and in the sliding process, extract a time series segment from the plurality of time series segments every time the second sliding window is slid, and fill the extracted time series segment into the current sliding window, and in this way, until the to-be-predicted time period is filled, the prediction random item sequence corresponding to the to-be-predicted time period is obtained.
14. The method of claim 1, wherein, The trend feature comprises a historical trend item sequence, and the historical trend item sequence comprises historical trend items corresponding to respective time points in the first historical time series data; the historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the periodic feature comprises a period, a period confidence, a single-period item sequence and a historical period item sequence, and the historical period item sequence comprises historical period items corresponding to respective time points in the first historical time series data; the historical period item corresponding to a time point refers to a period component of historical data corresponding to the time point; and the prediction time series data comprises prediction data of respective time points in the to-be-predicted time period; in a case where the time series type is a periodic type, the determination of the prediction time series data in the to-be-predicted time period based on the time series prediction strategy corresponding to the time series type comprises: determining a prediction trend item sequence in the to-be-predicted time period by using the trained support vector machine model, wherein the trained support vector machine model is obtained by training when the trend decomposition is performed on the first historical time series data; filling the to-be-predicted time period by using the single-period item sequence to obtain a prediction period item sequence; subtracting each historical data in the first historical time series data from a corresponding historical trend item and a corresponding historical period item to obtain a historical random item sequence, wherein the historical data, the corresponding historical trend item and the corresponding historical period item correspond to a same time point; slide filling the to-be-predicted time period based on the historical random item sequence to obtain a prediction random item sequence corresponding to the to-be-predicted time period; and For each time point in the to-be-predicted time period, a sum of data corresponding to the time point in the prediction trend item sequence, the prediction period item sequence, and the prediction random item sequence is determined as prediction data of the time point.
15. The method of claim 1, wherein, The trend feature includes a historical trend item sequence; the historical trend item sequence includes historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the prediction time series data includes prediction data of respective time points in the to-be-predicted time period; In a case where the time series type is a step type, the determining, based on the time series prediction strategy corresponding to the time series type, of the prediction time series data in the to-be-predicted time period includes: determining at least one translation point from the first historical time series data; if it is determined that a length of a latest translation time period is greater than a preset translation length, using historical data in the latest translation time period as a training sample to train a support vector machine model to obtain a trained support vector machine model; the latest translation time period is a time period from a translation point closest to a current time to an end time point of a first historical time period; based on the trained support vector machine model, the first historical time series data, and the historical trend item sequence, using a linear type corresponding time series prediction strategy to determine the prediction time series data in the to-be-predicted time period.
16. The method of claim 15, wherein, The determining, from the first historical time series data, of at least one translation point includes: performing first-order difference calculation on the first historical time series data to obtain difference time series data; performing anomaly detection on the difference time series data to determine whether an extreme value point in the difference time series data is abnormal; if it is determined that any extreme value point in the difference time series data is abnormal, determining the abnormal extreme value point as a translation point.
17. The method of claim 15, wherein, Further comprising: if it is determined that a length of a latest translation time period is less than or equal to a preset translation length, translating a last time period before the latest translation time period to make the last time period and the latest translation time period connect to each other to obtain a new latest translation time period; and translating in this way until a length of the new latest translation time period is greater than the preset translation length.
18. The method of claim 1, wherein, The trend feature includes a historical trend item sequence; the historical trend item sequence includes historical trend items corresponding to respective time points in the first historical time series data; a historical trend item corresponding to a time point refers to a trend component of historical data corresponding to the time point; the prediction time series data includes prediction data of respective time points in the to-be-predicted time period; In a case where the time series type is a random type, the determining, based on the time series prediction strategy corresponding to the time series type, of the prediction time series data in the to-be-predicted time period includes: determining at least one translation point from the first historical time series data; starting from a translation point closest to a current time, sequentially connecting time periods before the translation points to time periods after the translation points to obtain translated first historical time series data; and training the support vector machine model by taking the translated first historical time series data as a training sample, to obtain a trained support vector machine model; determining predicted time series data in the to-be-predicted time period based on the trained support vector machine model, the first historical time series data, and the historical trend item sequence, by using a linear type corresponding time series prediction strategy.
19. The method of claim 18, wherein, Before the determining of the at least one translation point from the first historical time series data, the method further comprises: performing anomaly detection on the first historical time series data to determine whether an extreme value point in the first historical time series data is abnormal; if it is determined that any extreme value point in the first historical time series data is abnormal, replacing the extreme value point by using a linear interpolation algorithm to obtain updated first historical time series data.
20. The method of claim 1, wherein, After the obtaining of the first historical time series data, the method further comprises: performing preprocessing on the first historical time series data to obtain updated first historical time series data. Correspondingly, the preprocessing on the first historical time series data to obtain updated first historical time series data comprises: if the length of the missing segment is greater than a first preset length, and the length of time series data located after the missing segment is greater than a second preset length, determining the time series data located after the missing segment as the updated first historical time series data; the missing segment refers to a time period of missing data; if the length of the missing segment is greater than the first preset length, and the length of time series data located after the missing segment is less than or equal to the second preset length, determining the time series data located before the missing segment as the updated first historical time series data; if the length of the missing segment is less than or equal to the first preset length, filling the missing segment by using a linear interpolation algorithm, and determining the first historical time series data after the filling of the missing segment as the updated first historical time series data.
21. The method of claim 20, wherein, The filling of the missing segment by using the linear interpolation algorithm comprises: determining a data sampling frequency of the first historical time series data; dividing the first historical time series data into a plurality of equally-spaced sampling windows according to the reciprocal of the data sampling frequency, and respectively determining average values of historical data in the sampling windows; filling the missing segment by using a linear interpolation algorithm and the average values of the historical data in the sampling windows.
22. The method of claim 1, wherein, In a case where the first historical time series data is resource capacity time series data, after the determining of the predicted time series data in the to-be-predicted time period based on the time series type corresponding time series prediction strategy, the method further comprises: determining a resource capacity optimization amount based on the predicted time series data in the to-be-predicted time period, second historical time series data, and a resource capacity upper limit value; the second historical time series data is time series data generated in a second historical time period, the second historical time period is a time period before the current time, and the second historical time period and the to-be-predicted time period are continuous; optimizing the resource capacity based on the resource capacity optimization amount.
23. The method of claim 22, wherein, In a case where the resource capacity time series data is memory capacity time series data, the current resource capacity upper limit value is a current memory capacity upper limit value. The determining the resource capacity optimization amount based on the predicted time series data, the second historical time series data and the current resource capacity upper limit value in the to-be-predicted time period comprises: determining a strategy value according to a trend state of the predicted time series data, and determining a strategy ratio value as a ratio of the strategy value to the current memory capacity upper limit value; the trend state is one of stable, rising or falling; determining a quantile ratio value as a ratio of a target quantile value of the second historical time series data to the current memory capacity upper limit value; if both the strategy ratio value and the quantile ratio value are less than a first preset ratio value, it is determined that there is a capacity reduction demand; if both the strategy ratio value and the quantile ratio value are greater than a second preset ratio value, it is determined that there is a capacity expansion demand; if it is determined that there is a capacity reduction demand, determining the resource capacity optimization amount according to a preset memory capacity reduction strategy; if it is determined that there is a capacity expansion demand, determining the resource capacity optimization amount according to a preset memory capacity expansion strategy.
24. The method of claim 23, wherein, The determining the resource capacity optimization amount according to the preset memory capacity reduction strategy comprises: reducing the current memory capacity upper limit value according to a preset capacity window, and determining a new strategy ratio value based on the strategy value and the reduced memory capacity upper limit value every time a preset capacity window is reduced; and in this way, until the strategy ratio value is greater than a third preset ratio value, the reduction is stopped; determining a resource capacity optimization amount as a difference between the current memory capacity upper limit value and a memory capacity upper limit value obtained by the last reduction.
25. The method of claim 23, wherein, The determining the resource capacity optimization amount according to the preset memory capacity expansion strategy comprises: enlarging the current memory capacity upper limit value according to a preset capacity window, and determining a new strategy ratio value based on the strategy value and the enlarged memory capacity upper limit value every time a preset capacity window is enlarged; and in this way, until the strategy ratio value is less than a third preset ratio value, the enlargement is stopped; determining a resource capacity optimization amount as a difference between a memory capacity upper limit value obtained by the last enlargement and the current memory capacity upper limit value.
26. The method of claim 22, wherein, In a case where the resource capacity time series data is processor usage rate time series data, the current resource capacity upper limit value is a current processor quantity; The determining the resource capacity optimization amount based on the predicted time series data, the second historical time series data and the current resource capacity upper limit value in the to-be-predicted time period comprises: determining a strategy value according to a trend state of the predicted time series data; the trend state is one of stable, rising or falling; determining a target quantile value of the second historical time series data; if both the strategy value and the target quantile value are less than a first preset value, it is determined that there is a capacity reduction demand; if both the strategy value and the target quantile value are greater than a second preset value, it is determined that there is a capacity expansion demand; if it is determined that there is a capacity reduction demand, determining the resource capacity optimization amount according to a preset usage rate capacity reduction strategy; if it is determined that there is a capacity expansion demand, determining the resource capacity optimization amount according to a preset usage rate capacity expansion strategy.
27. The method of claim 26, wherein, The determining the resource capacity optimization amount according to the preset usage rate capacity reduction strategy comprises: The number of processors is reduced one by one, and a new processor usage rate is determined after each reduction of a processor; and the reduction is continued until the new processor usage rate is greater than a third preset value. A difference between the current number of processors and the number of processors obtained after the last reduction is determined as the resource capacity optimization amount; and the processor usage rate is proportional to the number of processors.
28. The method of claim 26, wherein, The resource capacity optimization amount is determined according to the preset usage rate expansion strategy, including: The number of processors is increased one by one, and a new processor usage rate is determined after each increase of a processor; and the increase is continued until the new processor usage rate is less than a third preset value. A difference between the number of processors obtained after the last increase and the current number of processors is determined as the resource capacity optimization amount.
29. The method of claim 1, wherein, After the predicted time series data in the to-be-predicted time period is determined based on the time sequence prediction strategy corresponding to the time sequence type, the method further includes: Threshold upper limit values and threshold lower limit values corresponding to each time point in the predicted time series data are determined. For each time point in the predicted time series data, if the predicted data of each time point in a continuous preset time length are all located outside a threshold interval, an alarm is generated; the start point of the threshold interval is the threshold lower limit value corresponding to the time point, and the end point is the threshold upper limit value corresponding to the time point.
30. The method of claim 29, wherein, The threshold upper limit values and the threshold lower limit values corresponding to each time point in the predicted time series data are determined, including: A historical random item sequence of the first historical time series data is obtained. A standard deviation of positive random items and a target quantile value are determined. For each time point in the predicted time series data, a sum of the predicted data corresponding to the time point and a reference maximum value is determined as the threshold upper limit value corresponding to the time point; the reference maximum value is the maximum value of three times the standard deviation and the target quantile value. A standard deviation of negative random items and a target quantile value are determined. For each time point in the predicted time series data, a sum of the predicted data corresponding to the time point and a reference maximum value is determined as the threshold lower limit value corresponding to the time point; the reference maximum value is the maximum value of three times the standard deviation and the target quantile value.
31. The method of claim 29, wherein, The method further includes: For each time point in the predicted time series data, if the predicted data of each time point in a continuous preset time length are all located within a threshold interval, the alarm is eliminated.
32. A temporal data prediction apparatus characterized by comprising: The method includes: An obtaining module is configured to obtain first historical time series data; the first historical time series data is time series data generated in a first historical time period; A decomposition module is configured to perform trend cycle decomposition on the first historical time series data to obtain a trend feature and a cycle feature; The trend feature is used to represent an overall trend of the first historical time series data in the first historical time period, and the cycle feature is used to represent a periodic fluctuation of the first historical time series data; A determination module is configured to determine a time sequence type corresponding to the first historical time series data based on the trend feature and the cycle feature; the time sequence type is one of linear type, periodic type, step type, or irregular type; A prediction module is configured to determine predicted time series data in a to-be-predicted time period based on a time sequence prediction strategy corresponding to the time sequence type.
33. An electronic device, comprising: Comprising: a processor and a memory connected to the processor in communication; the memory storing computer-executable instructions; the processor executing the computer-executable instructions stored in the memory to implement the time series data prediction method according to any one of claims 1-31.
34. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the time series data prediction method according to any one of claims 1-31.
35. A computer program product comprising a computer program, characterised in that, The computer program, when executed by a processor, implements the time series data prediction method according to any one of claims 1-31.
Citation Information
Cited By
Quality control method and equipment for ocean observation data and medium
CN122112460A