A method and device for analyzing time series data, and a medium

CN122838841APending Publication Date: 2026-09-29ANHUI SANQI JIYU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611007314.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-08
Publication Date
2026-09-29

AI Technical Summary

Technical Problem

然而,这种人为设定的方式存在以下不足:用户需要手动计算参考时间窗口的起止时间,操作复杂且容易因时间对齐错误导致分析偏差;固定的周期分析无法适应时序数据本身的动态变化规律,使得参考时间窗口内的数据形态与当前时间窗口差异较大,从而影响了环比分析的准确性

Benefits of technology

[0021]在本申请实施例中,获取时序数据以及所述时序数据对应的预设时间窗口长度;根据所述预设时间窗口长度确定当前时间窗口并将所述当前时间窗口内的时序数据确定为当前序列,根据所述当前时间窗口确定参考时间窗口并将所述参考时间窗口内的时序数据确定为参考序列;在确定出满足环比可比条件的情况下,基于所述当前序列与所述参考序列确定环比分析结果。上述时序数据的环比分析方法,在环比分析中自适应确定参考时间窗口,提高时间窗口之间的数据可比性,从而提高环比分析结果的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122838841A_ABST
    Figure CN122838841A_ABST
Patent Text Reader

Abstract

The application discloses a method and device for analyzing time series data, and equipment and a medium. The method comprises the following steps: acquiring time series data and a preset time window length corresponding to the time series data; determining a current time window according to the preset time window length, determining time series data in the current time window as a current sequence, determining a reference time window according to the current time window, and determining time series data in the reference time window as a reference sequence; and determining a round-over analysis result based on the current sequence and the reference sequence when it is determined that a round-over comparable condition is met. In the technical solution, the reference time window is adaptively determined in the round-over analysis, the data comparability between time windows is improved, and the accuracy of the round-over analysis result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of data analysis technology, specifically relating to a method, apparatus, equipment, and medium for month-on-month analysis of time series data. Background Technology

[0002] With the development of big data, the Internet of Things, and cloud computing technologies, various business systems continuously generate large amounts of time-series data, such as user traffic, equipment operating parameters, transaction data, and network traffic data. To promptly grasp business trends or equipment operating status, statistical analysis of time-series data across different time periods is typically required. Among these, month-on-month analysis, by comparing the data differences between the current time window and a reference time window, reflects the growth or decline of indicators, and is therefore widely used in various data analysis scenarios.

[0003] In existing technologies, reference time windows are typically set manually, such as according to conventional time periods like days, weeks, months, or quarters, and comparative analysis is performed based on the data within the reference time window and the current time window. However, this manual approach has the following drawbacks: users need to manually calculate the start and end times of the reference time window, which is complex and prone to analytical bias due to time alignment errors; fixed-period analysis cannot adapt to the dynamic changes in time series data, resulting in significant differences between the data format within the reference time window and the current time window, thus affecting the accuracy of the comparative analysis. Summary of the Invention

[0004] This application provides a method, apparatus, device, and medium for month-on-month analysis of time series data. The purpose is to adaptively determine the reference time window in month-on-month analysis, improve the comparability of data between time windows, and thus improve the accuracy of month-on-month analysis results.

[0005] In a first aspect, embodiments of this application provide a method for month-on-month analysis of time-series data, the method comprising: Acquire time-series data and the preset time window length corresponding to the time-series data; The current time window is determined according to the preset time window length, and the time series data within the current time window is determined as the current sequence. A reference time window is determined according to the current time window, and the time series data within the reference time window is determined as the reference sequence. If the conditions for month-on-month comparability are met, the month-on-month analysis results are determined based on the current sequence and the reference sequence.

[0006] Furthermore, determining the reference time window based on the current time window includes: Acquire historical time-series data and calculate the period length drift rate based on the historical time-series data; determine a prediction time window length according to the period length drift rate and the preset time window length; determine a start time of the current time window as an end time of a reference time window, and determine a start time of the reference time window according to the end time of the reference time window and the prediction time window length.

[0007] Further, the period length drift rate is calculated based on the historical time series data, comprising: determine a plurality of historical time windows according to the preset time window length, and determine time series data in each historical time window as a historical subsequence; extract feature time points in each historical subsequence; wherein the feature time points comprise at least one of a local maximum value time point, a local minimum value time point, a zero-crossing time point, and a first derivative maximum value time point; calculate the period length drift rate according to the feature time points in each historical subsequence.

[0008] Further, the period length drift rate is calculated according to the feature time points in each historical subsequence, comprising: for each historical subsequence, arrange the feature time points in the historical subsequence in ascending order of time to obtain a feature time point sequence; calculate a period length drift vector between the feature time point sequences of adjacent historical subsequences, and calculate a drift consistency index of the period length drift vector; determine a valid period length drift vector when the drift consistency index exceeds a preset consistency threshold, and calculate the period length drift rate according to the valid period length drift vector.

[0009] Further, the drift consistency index of the period length drift vector is calculated, comprising: generate a drift direction vector according to the period length drift vector, and statistically determine a maximum direction consistent sequence length and a total number of direction changes according to the drift direction vector; calculate a ratio of the maximum direction consistent sequence length to a vector length of the period length drift vector as a first ratio, and calculate a ratio of the total number of direction changes to the vector length of the period length drift vector as a second ratio; determine the drift consistency index according to the first ratio and the second ratio.

[0010] Further, the ring-by-comparison comparable condition is determined, comprising: calculate a dynamic time warping path between the current sequence and the reference sequence; According to the dynamic time warping path, a dynamic time warping distance is calculated, and the dynamic time warping distance is divided by the preset time window length to obtain a normalized dynamic time warping distance. In a case where the normalized dynamic time warping distance is less than a preset comparable distance threshold, it is determined that the inter-period comparable condition is met.

[0011] Further, the determining the inter-period analysis result based on the current sequence and the reference sequence comprises: According to the dynamic time warping path, a time-warping alignment of the reference sequence is performed to obtain an aligned reference sequence; A point-by-point difference calculation is performed on the aligned reference sequence and the current sequence to obtain an inter-period difference vector, and an inter-period analysis result is generated based on the inter-period difference vector.

[0012] In a second aspect, an embodiment of the present application provides an inter-period analysis device for time series data, and the device comprises: An inter-period triggering module is configured to acquire time series data and a preset time window length corresponding to the time series data; A sequence determining module is configured to determine a current time window according to the preset time window length, and determine a current sequence as the time series data in the current time window; determine a reference time window according to the current time window, and determine a reference sequence as the time series data in the reference time window; An inter-period analysis module is configured to, in a case where it is determined that the inter-period comparable condition is met, determine an inter-period analysis result based on the current sequence and the reference sequence.

[0013] Further, the sequence determining module is specifically configured to: Acquire historical time series data, and calculate a period length drift rate based on the historical time series data; Determine a predicted time window length according to the period length drift rate and the preset time window length; Determine a start time of the current time window as an end time of the reference time window, and determine a start time of the reference time window according to the end time of the reference time window and the predicted time window length.

[0014] Further, the sequence determining module is specifically configured to: Determine a plurality of historical time windows according to the preset time window length, and determine historical sub-sequences as the time series data in the historical time windows; Extract feature time points in each of the historical sub-sequences; wherein the feature time points comprise at least one of a local maximum value time point, a local minimum value time point, a zero-crossing time point, and a first derivative maximum value time point; The period length drift rate is calculated according to the feature time points in each historical subsequence.

[0015] Further, the sequence determination module is specifically configured to: For each historical subsequence, the feature time points in the historical subsequence are arranged in ascending order of time to obtain a feature time point sequence; A period length drift vector is calculated between the feature time point sequences of adjacent historical subsequences, and a drift consistency index of the period length drift vector is calculated; The period length drift vector whose drift consistency index exceeds a preset consistency threshold is determined as an effective period length drift vector, and a period length drift rate is calculated according to the effective period length drift vector.

[0016] Further, the sequence determination module is specifically configured to: A drift direction vector is generated according to the period length drift vector, and a maximum direction consistent sequence length and a total number of direction changes are counted according to the drift direction vector; A ratio of the maximum direction consistent sequence length to a vector length of the period length drift vector is calculated as a first ratio, and a ratio of the total number of direction changes to the vector length of the period length drift vector is calculated as a second ratio; A drift consistency index is determined according to the first ratio and the second ratio.

[0017] Further, the ring ratio analysis module is specifically configured to: A dynamic time warping path is calculated between the current sequence and the reference sequence; A dynamic time warping distance is calculated according to the dynamic time warping path, and the dynamic time warping distance is divided by a preset time window length to obtain a normalized dynamic time warping distance; In a case where the normalized dynamic time warping distance is less than a preset comparable distance threshold, it is determined that the ring ratio comparable condition is met.

[0018] Further, the ring ratio analysis module is specifically configured to: The reference sequence is time-warping aligned according to the dynamic time warping path to obtain an aligned reference sequence; A ring ratio difference vector is obtained by point-by-point difference calculation between the aligned reference sequence and the current sequence, and a ring ratio analysis result is generated according to the ring ratio difference vector.

[0019] In a third aspect, an electronic device is provided, which includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, and the program or instructions, when executed by the processor, implement the method of the first aspect.

[0020] In a fourth aspect, a readable storage medium is provided, which stores a program or instructions, and the program or instructions, when executed by a processor, implement the method of the first aspect.

[0021] In the embodiments of the present application, the timing data and a preset time window length corresponding to the timing data are obtained, a current time window is determined according to the preset time window length, and timing data in the current time window is determined as a current sequence; a reference time window is determined according to the current time window, and timing data in the reference time window is determined as a reference sequence; in a case where it is determined that a link ratio comparison condition is met, a link ratio analysis result is determined based on the current sequence and the reference sequence. The link ratio analysis method of the timing data adaptively determines a reference time window in link ratio analysis, improves data comparability between time windows, and thus improves accuracy of a link ratio analysis result. BRIEF DESCRIPTION OF DRAWINGS

[0022] Figure 1 FIG. 1 is a flowchart of a link ratio analysis method of timing data provided by an embodiment of the present application; Figure 2 FIG. 2 is a flowchart of another link ratio analysis method of timing data provided by an embodiment of the present application; Figure 3 FIG. 3 is a flowchart of still another link ratio analysis method of timing data provided by an embodiment of the present application; Figure 4 FIG. 4 is a structural diagram of a link ratio analysis device of timing data provided by an embodiment of the present application; Figure 5 FIG. 5 is a structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to make the purposes, technical solutions and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the drawings. It can be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application. In addition, it should be noted that, for the convenience of description, only parts related to the present application are shown in the drawings, but not all. Before discussing the example embodiments in more detail, it should be mentioned that some example embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the operations (or steps) as sequential processes, many of the operations can be implemented in parallel, concurrently or simultaneously. In addition, the order of the operations can be rearranged. The processes can be terminated when the operations are completed, but can also have additional steps not included in the drawings. The processes can correspond to methods, functions, procedures, subroutines, etc.

[0024] The technical solutions in the embodiments of the present application will be described clearly in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art belong to the scope of protection of the present application.

[0025] The terms "first", "second", and the like in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than that illustrated or described herein, and the objects distinguished by "first", "second", etc. are usually a class, not limited to the number of objects, for example, the first object can be one or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / ", generally means that the front and rear associated objects are in an "or" relationship.

[0026] The time series data's ring ratio analysis method, device, equipment and medium provided by the embodiments of the present application will be described in detail below in conjunction with the drawings and specific embodiments and their application scenarios.

[0027] First, the present application is applicable to the scene that needs to analyze the time series data.

[0028] Among them, the time series data can be a sequence of data points collected and recorded at fixed time intervals, each data point containing a timestamp and a corresponding index value, for example, the CPU average utilization rate collected every 1 minute by the server cluster, the total amount of commodity transactions counted daily by the e-commerce platform, the average wind speed value recorded every 10 minutes by the wind turbine generator set, or the vehicle flow count passed by the road traffic portal every 5 minutes.

[0029] The period-to-period analysis can be to compare the time series data in a current time window with time series data in a previous adjacent and equal-length time window, to reflect the continuous dynamic change trend of the time series data in a short period.

[0030] Accordingly, the period-to-period analysis needs to be performed on the time series data, which can be that a user displays the enablement of the period-to-period analysis for the time series data by configuring an EnablePeriodComparison field, or that the user sets an alarm rule for the time series data and sets an alarm triggering condition to be related to a period-to-period analysis result, for example, a period-to-period growth rate being greater than a preset threshold, a period-to-period growth rate being less than a preset threshold, a period-to-period change absolute value being greater than a preset threshold, or a period-to-period change absolute value being less than a preset threshold.

[0031] Based on the above use scenarios, it can be understood that the execution subject of the present application can be a terminal device with data storage and computing capabilities.

[0032] Figure 1 is a flowchart of a period-to-period analysis method for time series data provided by an embodiment of the present application. As shown in Figure 1 , the method specifically includes the following steps: S101, obtaining time series data and a preset time window length corresponding to the time series data.

[0033] In an embodiment, the time series data can be obtained by actively pulling the time series data through a data collection agent, or subscribing to a real-time data stream from a message queue.

[0034] The time window can be a continuous interval on a time axis of the time series data, and all data points in the time window constitute an analysis unit.

[0035] Accordingly, the preset time window length is a time span of the time window that is set in advance, and the preset time window length can be preconfigured according to a collection period of the time series data and a business analysis requirement.

[0036] In an embodiment, the preset time window length corresponding to the time series data can be set by a user directly inputting the preset time window length, or the preset time window length corresponding to the time series data can be obtained by the user inputting a business scenario identifier corresponding to the time series data and querying a mapping table between the business scenario identifier and the preset time window length.

[0037] S102, determining a current time window according to the preset time window length and determining time series data in the current time window as a current sequence, determining a reference time window according to the current time window and determining time series data in the reference time window as a reference sequence.

[0038] The current time window can be a time window ending at a current time point (or a user-specified time point) and backtracking a preset time window length.

[0039] The current sequence can be a set of all data points in the time series data arranged in time sequence within the current time window.

[0040] In an embodiment, the manner of determining the time series data within the current time window as the current sequence can be to filter all data points in the time series data with timestamps falling within the current time window by a database query statement (e.g., a BETWEEN query statement) and arrange them in ascending order of time to form a sequence, which is the current sequence.

[0041] The reference time window can be a historical time window used for the comparison analysis with the current time window.

[0042] In an embodiment, the manner of determining the reference time window according to the current time window can be to determine the start time of the current time window as the end time of the reference time window, subtract the preset time window length from the end time of the reference time window to obtain the start time of the reference time window, and determine the reference time window according to the start time and the end time of the reference time window.

[0043] The reference sequence can be a set of all data points in the time series data arranged in time sequence within the reference time window.

[0044] In an embodiment, the manner of determining the time series data within the reference time window as the reference sequence can be to filter all data points in the time series data with timestamps falling within the reference time window by a database query statement (e.g., a BETWEEN query statement) and arrange them in ascending order of time to form a sequence, which is the reference sequence.

[0045] S103, in the case where it is determined that the comparison analysis comparable condition is met, determining a comparison analysis result based on the current sequence and the reference sequence.

[0046] The comparison analysis comparable condition can be a prerequisite judgment criterion for determining whether the current sequence and the reference sequence are comparable in a statistical or business sense, so as to ensure that the comparison analysis result generated based on the two has reasonableness and credibility.

[0047] In an embodiment, the manner of determining that the comparison analysis comparable condition is met can be to calculate the data completeness of the current sequence and the reference sequence respectively, and determine that the comparison analysis comparable condition is met when the data completeness of the current sequence and the reference sequence are both higher than a preset completeness threshold.

[0048] In one embodiment, the way of calculating the data integrity of the current sequence / reference sequence can be as follows: dividing the length of the time window corresponding to the current sequence / reference sequence by the preset collection period to obtain the expected total number of data points, counting the actual total number of data points in the time window corresponding to the current sequence / reference sequence, and dividing the actual total number of data points by the expected total number of data points to obtain the data integrity.

[0049] The relative analysis result can be an index for quantifying the change direction and amplitude of the current sequence relative to the reference sequence, such as a relative growth rate and a relative change absolute value.

[0050] In one embodiment, the way of determining the relative analysis result based on the current sequence and the reference sequence can be as follows: calculating a first statistical value of the current sequence and a second statistical value of the reference sequence, respectively, determining the difference between the first statistical value and the second statistical value as the relative change absolute value, and / or dividing the difference by the second statistical value to obtain the relative growth rate. The first statistical value and the second statistical value each include at least one of the average value, the maximum value, the minimum value, and the total sum of the index values of the data points in the current sequence and the reference sequence.

[0051] In the embodiments of the present application, the time series data and the preset time window length corresponding to the time series data are obtained, the current time window is determined according to the preset time window length, and the time series data in the current time window is determined as the current sequence. The reference time window is determined according to the current time window, and the time series data in the reference time window is determined as the reference sequence. In the case where the relative comparison condition is met, the relative analysis result is determined based on the current sequence and the reference sequence. The relative analysis method of the time series data adaptively determines the reference time window in the relative analysis, improves the data comparability between the time windows, and thus improves the accuracy of the relative analysis result.

[0052] Figure 2 is a flowchart of another relative analysis method of time series data provided by the embodiments of the present application. As shown in Figure 2 the specific steps include the following steps: S201, obtaining time series data and a preset time window length corresponding to the time series data.

[0053] S202, obtaining historical time series data and calculating a period length drift rate based on the historical time series data.

[0054] The historical time series data can be time series data collected and stored before the current time window.

[0055] In an embodiment, the manner of obtaining the historical time series data can be to filter all data points in the time series data whose timestamps are before the start time of the current time window by a database query statement (e.g., a WHERE query statement), as the historical time series data.

[0056] The period length drift rate can be a relative change rate of actual time spans between adjacent periods in the historical time series data.

[0057] In an embodiment, the manner of calculating the period length drift rate based on the historical time series data can be to determine a plurality of historical time windows according to the preset time window length, determine maximum value time points in each historical time window, calculate time spans between adjacent maximum value time points, and calculate ratios of each time span to its previous time span, and calculate an average of the ratios as the period length drift rate.

[0058] In an embodiment, the calculating the period length drift rate based on the historical time series data comprises: determining a plurality of historical time windows according to the preset time window length, and determining time series data in each historical time window as a historical sub-sequence; extracting feature time points in each historical sub-sequence; wherein the feature time points comprise at least one of local maximum value time points, local minimum value time points, zero-crossing time points, and first derivative maximum value time points; and calculating the period length drift rate according to the feature time points in each historical sub-sequence.

[0059] The historical time windows can be time windows divided according to time sequence and according to the preset time window length; and the historical sub-sequences can be sets of all data points in the historical time series data arranged in time sequence within the historical time windows.

[0060] In an embodiment, the manner of determining a plurality of historical time windows according to the preset time window length can be to take the start time of the current time window as the end time of the last historical time window, subtract the preset time window length from the end time as the start time of the historical time window, and take the start time of the historical time window as the end time of the previous historical time window, and so on, to sequentially divide a plurality of continuous and non-overlapping historical time windows.

[0061] In an embodiment, the manner of determining time series data in each historical time window as a historical sub-sequence can be to filter all data points in the historical time series data whose timestamps are within the historical time window by a database query statement (e.g., a BETWEEN query statement), and arrange the data points in ascending order of time to form a sequence, as the historical sub-sequence.

[0062] The feature time point can be a key time point for characterizing the morphological features and / or structural features of the historical subsequence, and can include at least one of a local maximum time point, a local minimum time point, a zero-crossing time point, and a first derivative maximum time point.

[0063] Specifically, the local maximum time point can be a time point corresponding to a data point in the historical subsequence, the value of which is greater than the values of its adjacent two sides; the local minimum time point can be a time point corresponding to a data point in the historical subsequence, the value of which is less than the values of its adjacent two sides; the zero-crossing time point can be a time point corresponding to a point in the historical subsequence, the value of which crosses the zero value line when the value changes from positive to negative or from negative to positive; and the first derivative maximum time point can be a time point corresponding to a point in the historical subsequence, the first derivative of which reaches a local maximum.

[0064] In an embodiment, the manner of extracting the feature time points in each historical subsequence can be that, for each data point in the historical subsequence, if the value of the current data point is greater than the values of its previous and next data points, the timestamp of the current data point is determined as a local maximum time point; if the value of the current data point is less than the values of its previous and next data points, the timestamp of the current data point is determined as a local minimum time point; the first derivative values of each data point are calculated by difference calculation on the historical subsequence, and the time point corresponding to the local maximum point in the first derivative sequence is searched as a first derivative maximum time point; and the zero-crossing time point is calculated by linear interpolation from the adjacent data points across the zero value.

[0065] In an embodiment, the manner of calculating the period length drift rate according to the feature time points in each historical subsequence can be that, for each historical subsequence, the average value of the time span between each feature time point and the corresponding feature time point in the previous historical subsequence is calculated as an average time span, and the ratio of each average time span to its previous average time span is calculated, and the average value of each ratio is calculated as the period length drift rate.

[0066] In an embodiment, the calculation of the period length drift rate according to the feature time points in each historical subsequence includes: arranging the feature time points in each historical subsequence in ascending order of time to obtain a feature time point sequence; calculating a period length drift vector between the feature time point sequences of adjacent historical subsequences, and calculating a drift consistency index of the period length drift vector; determining the period length drift vectors with the drift consistency index exceeding a preset consistency threshold as effective period length drift vectors, and calculating the period length drift rate according to the effective period length drift vectors.

[0067] The sequence of feature time points can be an ordered time point set obtained by arranging feature time points in the same historical subsequence in chronological order.

[0068] The period length drift vector can be a vector composed of time difference values between feature time points at corresponding positions in the sequence of feature time points of the adjacent two historical subsequences.

[0069] The drift consistency index can be a statistical quantity for measuring the dispersion or consistency degree between components in the period length drift vector.

[0070] In an embodiment, the drift consistency index of the period length drift vector can be calculated by calculating the standard deviation of each component in the period length drift vector, and calculating the ratio of the standard deviation to the average of each component in the period length drift vector as the drift consistency index.

[0071] In an embodiment, the method for calculating the drift consistency index of the period length drift vector comprises: generating a drift direction vector according to the period length drift vector, and calculating the maximum direction consistent sequence length and the total number of direction changes according to the drift direction vector; calculating the ratio of the maximum direction consistent sequence length to the vector length of the period length drift vector as a first ratio, and calculating the ratio of the total number of direction changes to the vector length of the period length drift vector as a second ratio; determining the drift consistency index according to the first ratio and the second ratio.

[0072] The drift direction vector can be a vector composed of the positive and negative signs of each component in the difference vector between the period length drift vector and the previous period length drift vector.

[0073] The maximum direction consistent sequence length can be the vector length of the longest subvector composed of consecutive same signs in the drift direction vector; and the total number of direction changes can be the total number of times that the sign changes between adjacent components in the drift direction vector.

[0074] The vector length of the period length drift vector can be the number of components in the period length drift vector.

[0075] The ratio of the maximum direction consistent sequence length to the vector length of the period length drift vector (i.e. the first ratio) represents the proportion of time span change directions of adjacent periods at multiple feature point positions that remain consistent, and is used to measure the persistence or trend stability of the drift direction.

[0076] The ratio of the total number of direction changes to the vector length of the period length drift vector (i.e., the second ratio) represents the proportion of the frequent occurrence of the reversal of the change direction of the time span of adjacent periods at the plurality of feature point positions, and is used to measure the volatility or disorder degree of the drift direction.

[0077] In one embodiment, according to the manner of determining the drift consistency index according to the first ratio and the second ratio, the difference between the first ratio and the second ratio can be calculated as the drift consistency index.

[0078] The advantage of this scheme is that by converting the numerical period length drift vector into a symbolic drift direction vector, the complex time span change analysis is simplified into consistency analysis of the direction sequence, significantly reducing the computational complexity, and the first ratio and the second ratio respectively quantify the drift consistency from the two complementary dimensions of continuous same direction and direction stability, providing a unified and reliable basis for the screening of effective period length drift vectors.

[0079] The preset consistency threshold can be a critical value for determining whether the period length drift vector has a consistent drift trend.

[0080] The drift consistency index of the period length drift vector exceeding the preset consistency threshold indicates that the components in the period length drift vector have high consistency, i.e., the time length change of adjacent periods at each feature point position presents the same stretching trend (overall lengthening or overall shortening), so the period length drift vector can represent the true period length change rule, rather than accidental fluctuations caused by noise or abnormal points, and therefore the period length drift vector can be determined as an effective period length drift vector.

[0081] In one embodiment, according to the manner of calculating the period length drift rate from the effective period length drift vector, the average value of the components of the effective period length drift vector can be calculated as the average time span, the ratio of each average time span to its previous average time span can be calculated, the number of interval periods between each effective period length drift vector and its previous effective period length drift vector can be counted, the nth root of the number of interval periods corresponding to each ratio can be calculated, and the average value of the nth roots of the number of interval periods can be calculated as the period length drift rate.

[0082] The advantage of this scheme is that by calculating the period length drift vector between adjacent feature time point sequences and introducing the drift consistency index, it can quantitatively evaluate whether adjacent periods have a consistent stretching trend at a plurality of feature positions, and accordingly screen out effective period length drift vectors with global representativeness, effectively eliminating invalid drifts caused by local noise, acquisition abnormalities or non-periodic jitter, and ensuring the high quality of the drift data participating in the final calculation.

[0083] The advantage of this scheme is that by extracting the feature time point to calculate the period length drift rate, the interference of data noise and slight fluctuations on the period determination can be effectively avoided, and the flexible selection and combination of various types of feature time points are supported, so that the calculation of the period length drift rate can adapt to time series data with different waveform features.

[0084] S203, determining a predicted time window length according to the period length drift rate and the preset time window length.

[0085] The predicted time window length can be the time window length that the reference time window should adopt according to the period length drift rate.

[0086] In one embodiment, the way of determining the predicted time window length according to the period length drift rate and the preset time window length can be dividing the preset time window length by the period length drift rate to obtain the predicted time window length.

[0087] S204, determining the start time of the reference time window according to the end time of the reference time window and the predicted time window length.

[0088] In one embodiment, the way of determining the start time of the reference time window according to the end time of the reference time window and the predicted time window length can be subtracting the predicted time window length from the end time of the reference time window to obtain the start time of the reference time window.

[0089] S205, determining time series data in the current time window as a current sequence, determining a reference time window according to the current time window and determining time series data in the reference time window as a reference sequence.

[0090] S206, determining a same-period analysis result based on the current sequence and the reference sequence in a case where it is determined that the same-period comparable condition is met.

[0091] The advantage of this scheme is that by introducing historical time series data to calculate the period length drift rate and adaptively correcting the time window length based on the period length drift rate, the length of the reference time window is no longer fixed and can be dynamically adjusted according to the period fluctuation of the time series data itself, so that the misalignment problem of the fixed period window caused by acquisition jitter, network delay or system clock deviation can be effectively overcome.

[0092] Figure 3 is a flowchart of another same-period analysis method of time series data provided by an embodiment of the present application. As shown in the figure, the method comprises the following steps: Figure 3 ​ S301, obtain timing data and a preset time window length corresponding to the timing data.

[0093] S302, determine a current time window according to the preset time window length and determine timing data in the current time window as a current sequence, determine a reference time window according to the current time window and determine timing data in the reference time window as a reference sequence.

[0094] S303, calculate a dynamic time warping path between the current sequence and the reference sequence.

[0095] The dynamic time warping path can be a nonlinear alignment mapping relationship between the current sequence and the reference sequence established by a dynamic time warping algorithm, and the dynamic time warping path is composed of a plurality of matching point pairs, each matching point pair associates one data point in the current sequence with one or more data points in the reference sequence to achieve the best alignment of the current sequence and the reference sequence on the time axis.

[0096] In one embodiment, the way of calculating the dynamic time warping path between the current sequence and the reference sequence can adopt constructing a cumulative distance matrix between the current sequence and the reference sequence, each element in the cumulative distance matrix representing the minimum cumulative distance of the first i data points in the current sequence and the first j data points in the reference sequence under the optimal alignment, calculating the cumulative distance matrix according to the dynamic programming recursion formula row by row and column by column, starting from the right bottom element of the cumulative distance matrix, backtracking to the left top corner according to the inverse direction of the minimum cumulative distance, and recording the continuous element positions passed through during backtracking as the dynamic time warping path.

[0097] S304, calculate a dynamic time warping distance according to the dynamic time warping path, and divide the dynamic time warping distance by the preset time window length to obtain a normalized dynamic time warping distance.

[0098] The dynamic time warping distance can be the cumulative sum of the distance metrics corresponding to each matching point pair along the dynamic time warping path, which is used to quantify the overall difference degree of the current sequence and the reference sequence under the optimal nonlinear alignment.

[0099] In one embodiment, the way of calculating the dynamic time warping distance according to the dynamic time warping path can adopt traversing each matching point pair on the dynamic time warping path, respectively calculating the distance metric value between the current sequence data point and the reference sequence data point in each matching point pair, and accumulating and summing the distance metric values of all matching point pairs, taking the accumulation result as the dynamic time warping distance.

[0100] The normalized dynamic time warping distance can be a dimensionless ratio obtained by dividing the dynamic time warping distance by the preset time window length, and is used to eliminate the dimensional difference of the accumulated distance caused by different time window lengths, so that the comparability determination under different time window lengths has a unified reference benchmark.

[0101] S305, in the case where the normalized dynamic time warping distance is less than a preset comparable distance threshold, it is determined that the inter-period comparability condition is met.

[0102] The preset comparable distance threshold can be a critical value preset for determining whether the current sequence and the reference sequence have similar patterns, and the preset comparable distance threshold can be preset according to the strictness of the similarity requirement of the business scenario.

[0103] The normalized dynamic time warping distance being less than the preset comparable distance threshold indicates that the average difference degree per unit time of the current sequence and the reference sequence under optimal nonlinear alignment is within an acceptable range, that is, the current sequence and the reference sequence have high similarity in pattern trend, and do not present significantly different fluctuation patterns, so it can be determined that the inter-period comparability condition is met.

[0104] S306, in the case where it is determined that the inter-period comparability condition is met, an inter-period analysis result is determined based on the current sequence and the reference sequence.

[0105] In one embodiment, the inter-period analysis result is determined based on the current sequence and the reference sequence, including: time warping alignment of the reference sequence according to the dynamic time warping path to obtain an aligned reference sequence; point-by-point difference calculation of the aligned reference sequence and the current sequence to obtain an inter-period difference vector, and generation of an inter-period analysis result according to the inter-period difference vector.

[0106] The aligned reference sequence can be a new sequence having one-to-one correspondence with the current sequence in the time dimension, obtained by resampling and mapping the reference sequence on the time axis according to the dynamic time warping path.

[0107] In one embodiment, the method of aligning a reference sequence with a dynamic time warp path to obtain an aligned reference sequence can be achieved by acquiring each pair of matching points on the dynamic time warp path. For each data point in the current sequence, the reference sequence data points that match that data point in the dynamic time warp path are mapped and interpolated according to the matching relationship. If a reference sequence data point matches a single data point in the current sequence, then that reference sequence data point is directly used as the data point at the corresponding position in the aligned reference sequence. If multiple reference sequence data points match a single data point in the current sequence, then the average or weighted average of these reference sequence data points is taken as the data point at the corresponding position in the aligned reference sequence. If a data point in the reference sequence does not match any data point in the current sequence, then that reference sequence data point is discarded. Finally, an aligned reference sequence of the same length as the current sequence is obtained.

[0108] The cycle difference vector can be a vector composed of the differences between each data point in the current sequence and the corresponding data point in the alignment reference sequence.

[0109] In one embodiment, the method for generating month-on-month analysis results based on the month-on-month difference vector can be as follows: the average value of each component in the month-on-month difference vector can be determined as the average month-on-month change value; and / or, the average absolute value of each component in the month-on-month difference vector can be determined as the average absolute value of the month-on-month change; and / or, the maximum and minimum values ​​in the month-on-month difference vector can be determined as the maximum and minimum month-on-month change values, respectively; and / or, the standard deviation of each component in the month-on-month difference vector can be calculated as a month-on-month change stability index. By summarizing the above various month-on-month analysis indices, the month-on-month analysis results can be obtained.

[0110] The advantage of this scheme is that by using a dynamic time warping path to align the reference sequence with the waveform of the current sequence on the time axis, the waveform of the reference sequence can be matched with that of the current sequence, thus eliminating the effects of timing misalignment.

[0111] The advantage of this approach is that by introducing a dynamic time warping algorithm to calculate the dynamic time warping path between the current sequence and the reference sequence, the similarity comparison between the current sequence and the reference sequence is no longer limited by strict alignment requirements on the time axis. It can effectively tolerate sequence misalignment caused by acquisition time deviation, phase shift, or local rate changes, thereby more accurately capturing the true similarity between the two current sequences and the reference sequence in terms of morphological trends. This can more realistically reflect the comparability of the sequences at the business semantic level, providing a more reliable foundation for the accuracy of subsequent month-on-month analysis results.

[0112] Figure 4 This is a schematic diagram of a time-series data month-on-month analysis device provided in an embodiment of this application. Figure 4 As shown, the device includes: The cycle comparison triggering module 410 is configured to obtain time series data and a preset time window length corresponding to the time series data; The sequence determining module 420 is configured to determine a current time window according to the preset time window length, and determine time series data in the current time window as a current sequence; determine a reference time window according to the current time window, and determine time series data in the reference time window as a reference sequence; The cycle comparison analysis module 430 is configured to, in a case where it is determined that a cycle comparison comparable condition is met, determine a cycle comparison analysis result based on the current sequence and the reference sequence.

[0113] Further, the sequence determining module 420 is specifically configured to: obtain historical time series data, and calculate a period length drift rate based on the historical time series data; determine a predicted time window length according to the period length drift rate and the preset time window length; determine a start time of the current time window as an end time of the reference time window, and determine a start time of the reference time window according to the end time of the reference time window and the predicted time window length.

[0114] Further, the sequence determining module 420 is specifically configured to: determine a plurality of historical time windows according to the preset time window length, and determine time series data in each of the historical time windows as a historical sub-sequence; extract a feature time point in each of the historical sub-sequences; wherein the feature time point comprises at least one of a local maximum value time point, a local minimum value time point, a zero-crossing time point, and a first derivative maximum value time point; calculate a period length drift rate according to the feature time points in each of the historical sub-sequences.

[0115] Further, the sequence determining module 420 is specifically configured to: for each of the historical sub-sequences, arrange the feature time points in the historical sub-sequence in ascending order of time to obtain a feature time point sequence; calculate a period length drift vector between the feature time point sequences of adjacent historical sub-sequences, and calculate a drift consistency index of the period length drift vector; determine a period length drift vector with the drift consistency index exceeding a preset consistency threshold as an effective period length drift vector, and calculate a period length drift rate according to the effective period length drift vector.

[0116] Further, the sequence determining module 420 is specifically configured to: generate a drift direction vector according to the period length drift vector, and count a maximum direction consistent sequence length and a total number of direction changes according to the drift direction vector; calculate a ratio of the maximum direction consistent sequence length and a vector length of the period length drift vector as a first ratio, and calculate a ratio of the total number of direction changes and the vector length of the period length drift vector as a second ratio; determine a drift consistency index according to the first ratio and the second ratio.

[0117] Further, the cycle comparison analysis module 430 is specifically configured to: calculate a dynamic time warping path between the current sequence and the reference sequence; calculate a dynamic time warping distance according to the dynamic time warping path, and divide the dynamic time warping distance by the preset time window length to obtain a normalized dynamic time warping distance; determine that the cycle comparison condition is met in a case where the normalized dynamic time warping distance is less than a preset comparable distance threshold.

[0118] Further, the cycle comparison analysis module 430 is specifically configured to: perform time warping alignment on the reference sequence according to the dynamic time warping path to obtain an aligned reference sequence; perform point-by-point difference calculation on the aligned reference sequence and the current sequence to obtain a cycle comparison difference vector, and generate a cycle comparison analysis result according to the cycle comparison difference vector.

[0119] In the embodiments of the present application, a cycle comparison triggering module is configured to obtain time series data and a preset time window length corresponding to the time series data; a sequence determining module is configured to determine a current time window according to the preset time window length, and determine a current sequence by using time series data in the current time window; determine a reference time window according to the current time window, and determine a reference sequence by using time series data in the reference time window; and a cycle comparison analysis module is configured to determine a cycle comparison analysis result based on the current sequence and the reference sequence in a case where it is determined that a cycle comparison condition is met. The cycle comparison analysis device of the time series data adaptively determines a reference time window in cycle comparison analysis, improves data comparability between time windows, and thus improves accuracy of a cycle comparison analysis result.

[0120] The time series data's ring ratio analysis device in the embodiments of the present application can be a device, or a component in a terminal, an integrated circuit, or a chip. The device can be a mobile electronic device, or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc., and the embodiments of the present application do not make a specific limitation.

[0121] The time series data's ring ratio analysis device in the embodiments of the present application can be a device with an operating system. The operating system can be an Android operating system, an IOS operating system, or other possible operating systems, and the embodiments of the present application do not make a specific limitation.

[0122] The time series data's ring ratio analysis device provided in the embodiments of the present application can implement the processes implemented by each of the above embodiments, and thus the details are not described herein again.

[0123] Figure 5 FIG. 1 is a structural schematic diagram of an electronic device provided in an embodiment of the present application. As shown in FIG. 1, the electronic device 100 includes a processor 101, a memory 102, and a program or instruction stored in the memory 102 and executable on the processor 101. The program or instruction is executed by the processor 101 to implement the processes of the above time series data's ring ratio analysis embodiments, and thus the same technical effects can be achieved. Details are not described herein again to avoid repetition. Figure 5

[0124] It should be noted that the electronic device in the embodiments of the present application includes the above-mentioned mobile electronic device and non-mobile electronic device.

[0125] The embodiments of the present application further provide a readable storage medium, and the readable storage medium stores a program or instruction. The program or instruction is executed by a processor to implement the processes of the above time series data's ring ratio analysis embodiments, and thus the same technical effects can be achieved. Details are not described herein again to avoid repetition.

[0126] ​The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0127] It should be noted that, in this document, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element preceded by "comprises... a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that includes the element. In addition, it should be noted that the scope of the methods and apparatus of the present embodiments are not limited by the order of the steps or the sequences for performing the steps, and can include performing the steps in different order, or substantially concurrently, or in reverse order, such as described, and can also add, omit, or combine various steps. In addition, features described with reference to certain examples can be combined in other examples.

[0128] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment method can be realized by means of software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a plurality of instructions for making a terminal (which can be a mobile phone, computer, server, or network device, etc.) execute the method described in each embodiment of the present application.

[0129] The embodiments of the present application are described above in combination with the drawings, but the present application is not limited to the above specific embodiments, and the above specific embodiments are only illustrative, not restrictive, and those skilled in the art can make many forms under the inspiration of the present application without departing from the scope of the present application and the protection scope of the claims.

[0130] The above merely describes the preferred embodiments of the present application and the technical principles applied. The present application is not limited to the specific embodiments described herein, and various obvious changes, modifications and replacements made by those skilled in the art without departing from the scope of the present application shall not be excluded. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and more other equivalent embodiments can be included without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.

Claims

1. A method for month-on-month analysis of time series data, characterized in that, The method includes: Acquire time-series data and the preset time window length corresponding to the time-series data; The current time window is determined according to the preset time window length, and the time series data within the current time window is determined as the current sequence. A reference time window is determined according to the current time window, and the time series data within the reference time window is determined as the reference sequence. If the conditions for month-on-month comparability are met, the month-on-month analysis results are determined based on the current sequence and the reference sequence.

2. The method for month-on-month analysis of time series data according to claim 1, characterized in that, Determining the reference time window based on the current time window includes: Acquire historical time-series data and calculate the period length drift rate based on the historical time-series data; The prediction time window length is determined based on the period length drift rate and the preset time window length. The start time of the current time window is determined as the end time of the reference time window, and the start time of the reference time window is determined based on the end time of the reference time window and the predicted time window length.

3. The method for month-on-month analysis of time series data according to claim 2, characterized in that, The calculation of the period length drift rate based on the historical time series data includes: Multiple historical time windows are determined according to the preset time window length, and the time series data within each historical time window is determined as a historical subsequence. Extract feature time points from each of the historical subsequences; wherein, the feature time points include at least one of local maximum time points, local minimum time points, zero-crossing time points, and first derivative maximum time points; The period length drift rate is calculated based on the characteristic time points in each of the aforementioned historical subsequences.

4. The method for month-on-month analysis of time series data according to claim 3, characterized in that, The calculation of the period length drift rate based on the characteristic time points in each of the historical sub-sequences includes: For each of the aforementioned historical subsequences, the characteristic time points in the historical subsequences are arranged in ascending order of time to obtain a characteristic time point sequence; Calculate the period length drift vector between the characteristic time point sequences of adjacent historical subsequences, and calculate the drift consistency index of the period length drift vector; The period length drift vector that exceeds the preset consistency threshold is determined as the effective period length drift vector, and the period length drift rate is calculated based on the effective period length drift vector.

5. The method for month-on-month analysis of time series data according to claim 4, characterized in that, The calculation of the drift consistency index of the period length drift vector includes: A drift direction vector is generated based on the period length drift vector, and the length of the maximum direction-consistent sequence and the total number of direction changes are calculated based on the drift direction vector. The ratio of the length of the maximum direction-consistent sequence to the vector length of the period length drift vector is calculated as the first ratio, and the ratio of the total number of direction changes to the vector length of the period length drift vector is calculated as the second ratio. The drift consistency index is determined based on the first ratio and the second ratio.

6. The method for month-on-month analysis of time series data according to claim 1, characterized in that, The determination of meeting the month-on-month comparability criteria includes: Calculate the dynamic time warping path between the current sequence and the reference sequence; The dynamic time bending distance is calculated based on the dynamic time bending path, and the dynamic time bending distance is divided by the preset time window length to obtain the normalized dynamic time bending distance. If the normalized dynamic time bending distance is less than a preset comparable distance threshold, the condition of satisfying the month-on-month comparability is determined.

7. The method for month-on-month analysis of time series data according to claim 6, characterized in that, The determination of the month-on-month analysis result based on the current sequence and the reference sequence includes: The reference sequence is time-warped and aligned according to the dynamic time warping path to obtain an aligned reference sequence. The alignment reference sequence and the current sequence are compared point by point to obtain the month-on-month difference vector, and the month-on-month analysis results are generated based on the month-on-month difference vector.

8. A device for month-on-month analysis of time series data, characterized in that, The device includes: The month-on-month triggering module is used to acquire time-series data and the preset time window length corresponding to the time-series data; The sequence determination module is used to determine the current time window based on the preset time window length and determine the time series data within the current time window as the current sequence, and to determine a reference time window based on the current time window and determine the time series data within the reference time window as a reference sequence; The month-on-month analysis module is used to determine the month-on-month analysis results based on the current sequence and the reference sequence, provided that the month-on-month comparability conditions are met.

9. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the month-on-month analysis method for time-series data as described in any one of claims 1-7.

10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the time-series data comparison method as described in any one of claims 1-7.