Method and device for extracting time series features

By splitting the time window into multiple time slices and partitioning according to primary keys and time slices, the problem of data skew in time series feature extraction is solved, and data volume balance and efficient calculation are achieved.

CN113806353BActive Publication Date: 2024-10-15THE FOURTH PARADIGM BEIJING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010534425.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-12
Publication Date
2024-10-15
Estimated Expiration
2040-06-12

AI Technical Summary

Technical Problem

There is a data skew problem in the time series feature extraction process, which leads to an imbalance in the amount of partitioned data and affects computing parallelism and efficiency.

Method used

By splitting the time window into multiple time slices, partitioning the data in the data table according to the primary key and time slice, and assigning it to multiple computing nodes for processing, it ensures that the amount of data in each block is balanced and boundary data is processed Time tag to copy data to avoid cross-block pulls.

Benefits of technology

It effectively solves the problem of data skew, improves the balance and computing parallelism of partitioned data, and improves the efficiency of time series feature extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113806353B_ABST
    Figure CN113806353B_ABST
Patent Text Reader

Abstract

A method and device for time series feature extraction are provided. An input data table is obtained; if the ratio of the time window length to the time length of the total time range corresponding to the time field of the full amount of data in the data table is lower than a threshold, the total time range is split into multiple time slices, and the time window is used to characterize the time range of the data that needs to be relied on when extracting time series features from a single piece of data, and the time width of the time slice is greater than or equal to twice the length of the time window; the data in the data table is divided into multiple blocks according to the primary key and the time slice, each block corresponds to a time slice, and the primary key of the data in the same block is the same; multiple blocks are assigned to multiple computing nodes for time series feature extraction processing. Thus, by partitioning the data according to the primary key and the time slice, the originally tilted large data volume partition data can be split into multiple partitions with balanced data volume, and the data tilt problem caused by the small number of primary keys can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention generally relates to the field of feature engineering, and more specifically, to a method and device for realizing time series feature extraction. Background Art

[0002] In machine learning modeling feature engineering, time series features refer to the historical sample data within a time range where the timestamp of a certain sample is dependent on for feature extraction of the sample. This time range is the time window for time series feature extraction.

[0003] Time series features are a very important component of feature engineering in machine learning modeling. They can better characterize the overall characteristics of samples in the time dimension, effectively improve the expressiveness and quality of features, and enhance the subsequent model effects. However, in actual modeling scenarios, the extraction performance of time series features is often tested because of the problem of time window data skew.

[0004] The problem of time window data skew refers to the fact that partitioning by primary key column results in an imbalanced amount of data in different partitions or only a small number of partitions: (1) Unbalanced partition data volume means that the amount of data in each partition is equal to the amount of data under the primary key of the partition. If the amount of data under different primary keys is unbalanced, it will lead to an imbalanced partition data volume; (2) Too few partitions means that the number of partitions is equal to the number of different primary keys. If the number of partitions is too small (for example, primary key = gender), the computing parallelism is too small (equivalent to having many partitions with zero data volume), which will also lead to data skew problems.

[0005] Therefore, a time series feature extraction solution that can solve the data skew problem is needed. Summary of the invention

[0006] Exemplary embodiments of the present invention are intended to overcome the data skew problem that exists in the process of temporal feature extraction.

[0007] According to a first aspect of the present invention, a method for implementing time series feature extraction is provided, comprising: obtaining an input data table; if the ratio of the time window length to the time length of the total time range corresponding to the time field of the full amount of data in the data table is lower than a threshold value, splitting the total time range into multiple time slices, the time window is used to characterize the time range of data that needs to be relied on when extracting time series features from a single piece of data, and the time width of the time slice is greater than or equal to twice the time window length; dividing the data in the data table into multiple blocks according to the primary key and the time slice, wherein each block corresponds to a time slice, and the primary keys of the data in the same block are the same; and allocating the multiple blocks to multiple computing nodes for time series feature extraction processing.

[0008] Optionally, if the data in the data table is evenly distributed over time, the step of splitting the total time range into multiple time slices includes: calculating the total time range corresponding to the time field of the full data in the statistical table; determining the time width of each time slice based on the number of slices and the total time range, the time width of each time slice being equal to the ratio of the total time range to the number of slices; and splitting the total time range into multiple time slices according to the time width.

[0009] Optionally, if the data in the data table is not evenly distributed over time, the step of splitting the total time range into multiple time slices includes: calculating a histogram of the full amount of data in the data table, the horizontal axis of the histogram representing the time field value, and the vertical axis of the histogram representing the amount of data; based on the histogram, splitting the total time range into multiple time slices, wherein the amount of data in the time range corresponding to different time slices is equal or substantially equal.

[0010] Optionally, the method further includes: determining whether the data in the data table is evenly distributed over time.

[0011] Optionally, the method further includes: specifying the number of shards by a user; or setting the number of shards by a heuristic rule.

[0012] Optionally, the method also includes: in the process of dividing each data in the data table into blocks, determining whether the data is boundary data that needs to be relied upon for time series feature extraction of the data in the next block of the block where the data is located; if it is determined that the data is boundary data, marking the data as duplicate data and adding it to the next block, wherein the computing node ignores the time series feature extraction processing of the duplicate data.

[0013] According to the second aspect of the present invention, there is also provided a device for implementing time series feature extraction, comprising: an acquisition module for acquiring an input data table; a splitting module for splitting the total time range into multiple time slices if the ratio of the time window length to the time length of the total time range corresponding to the time field of the full amount of data in the data table is lower than a threshold value, the time window is used to characterize the time range of data that needs to be relied on when extracting time series features for a single piece of data, and the time width of the time slice is greater than or equal to twice the time window length; a partitioning module for partitioning the data in the data table into multiple blocks according to the primary key and the time slice, wherein each block corresponds to a time slice, and the primary keys of the data in the same block are the same; an allocation module for allocating multiple blocks to multiple computing nodes for time series feature extraction processing.

[0014] Optionally, if the data in the data table is evenly distributed over time, the splitting module includes: a statistical module, used to count the total time range corresponding to the time field of the full data in the statistical table; a determination module, used to determine the time width of each time slice based on the number of slices and the total time range, and the time width of each time slice is equal to the ratio of the total time range to the number of slices; a splitting sub-module, used to split the total time range into multiple time slices according to the time width.

[0015] Optionally, if the data in the data table is not evenly distributed over time, the splitting module includes: a statistical module, used to count the histogram of all the data in the statistical table, the horizontal axis of the histogram represents the time field value, and the vertical axis of the histogram represents the amount of data; a splitting sub-module, used to split the total time range into multiple time slices based on the histogram, wherein the amount of data in the time range corresponding to different time slices is equal or substantially equal.

[0016] Optionally, the device further includes: a first judgment module, configured to judge whether the data in the data table is evenly distributed over time.

[0017] Optionally, the acquisition module is further used to acquire the number of shards specified by the user; or the device further includes a setting module, which is used to set the number of shards through heuristic rules.

[0018] Optionally, the device also includes: a second judgment module, used to judge whether the data in the data table is boundary data that needs to be relied on for time series feature extraction when the division module divides the data in the next block of the block where the data is located during the process of dividing the data in the data table into blocks; a copy module, used to mark the data as copy data and add it to the next block if the second judgment module determines that the data is boundary data, wherein the computing node ignores the time series feature extraction processing of the copy data.

[0019] According to the third aspect of the present invention, a system is also proposed, comprising at least one computing device and at least one storage device storing instructions, wherein when the instructions are executed by the at least one computing device, they prompt the at least one computing device to execute the method described in the first aspect of the present invention.

[0020] According to a fourth aspect of the present invention, a computer-readable storage medium storing instructions is also proposed, wherein when the instructions are executed by at least one computing device, the at least one computing device is prompted to execute the method described in the first aspect of the present invention.

[0021] In the method and device for implementing time series feature extraction according to an exemplary embodiment of the present invention, by partitioning the data in the data table according to the primary key and time slice at the same time, the originally skewed large data volume partition data can be split into multiple partitions with balanced data volume, and the data skew problem caused by the small number of primary keys can also be solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 A flow chart of a method for extracting time series features according to an exemplary embodiment of the present invention is shown;

[0023] Figure 2 A flow chart of a method for extracting time series features according to another exemplary embodiment of the present invention is shown;

[0024] Figure 3 A structural block diagram of an apparatus for implementing time series feature extraction according to an exemplary embodiment of the present invention is shown. DETAILED DESCRIPTION

[0025] In order to enable those skilled in the art to better understand the present invention, exemplary embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0026] Figure 1 A flow chart of a method for extracting time series features according to an exemplary embodiment of the present invention is shown. Figure 1 The method shown can be implemented entirely in software by a computer program or executed by a specially configured computing device. Figure 1 The method shown.

[0027] When extracting time series features from data in a data table, if the data in the data table is partitioned only by the primary key, the amount of data in different partitions will be unbalanced or only a small number of partitions will be generated. Both situations will lead to data skew problems.

[0028] The time range of the data that needs to be relied upon when extracting time series features from a single data in a data table (generally historical data whose time field value is earlier than that data) can be called a time window. Generally speaking, the time window length of the data that is relied upon for time series feature extraction from different rows of data in a data table is the same. For example, if the time series feature extraction is "calculating the total transaction amount of the same user within three days for each transaction record", then the time window length is "three days".

[0029] This embodiment is mainly a data tilt solution proposed for short time window scenarios. Short time window refers to the time window length that the time series feature extraction depends on is significantly different from the time length of the total time range corresponding to the full amount of data in the data table, that is, the time window length accounts for a small proportion of the total time range, such as the ratio of the time window length to the total time range corresponding to the time field of the full amount of data in the data table is lower than the threshold (for the sake of distinction, the threshold here can be called the first threshold). For example, if the time series feature is "total transaction amount with the same user within three days of transaction", the time range of the full data is from 2014 to 2020, the length of the time window on which the time series feature depends, "three days", is smaller than the length of the total time range "2014 to 2020", "six years". At this time, the time window "three days" on which the time series feature depends can be regarded as a short time window; accordingly, if the time series feature is "total transaction amount with the same user within three years of transaction", the time range of the full data is still from 2014 to 2020, then the ratio of the length of the time window "three years" on which the time series feature depends to the length of the total time range "six years" from 2014 to 2020 is larger. At this time, the time window "three years" on which the time series feature depends is no longer regarded as a short time window, but can be regarded as a long time window.

[0030] See also Figure 1 , in step S110, the input data table is obtained.

[0031] A data table can be considered as a collection of multiple data items stored in rows. The data in a data table consists of multiple field values, among which there is at least one time field value. That is, each data item in a data table has a time field value for indicating a timestamp.

[0032] The data table may be a data table generated online, a data table generated and stored in advance, or a data table received from the outside through an input device or a transmission medium. The present invention does not limit the source of the data table.

[0033] In step S120, if the ratio of the time window length to the time length of the total time range corresponding to the time field of the full amount of data in the data table is lower than the threshold, the total time range is split into multiple time slices, wherein the time width of each time slice is greater than or equal to twice the time window.

[0034] Each time slice corresponds to a duration range, and the time width of the time slice is the size of the duration range corresponding to the time slice. By setting the time width of each time slice to be greater than or equal to twice the time window length, each time window can fall into at most two consecutive time slices.

[0035] As an example, the present invention proposes two ways of splitting time slices according to whether the data in the data table is evenly distributed over time.

[0036] Method 1: Split with equal width

[0037] Equal-width splitting means splitting the total time range corresponding to the time field of all data in the data table into multiple time slices with the same time width. This splitting method is suitable for the situation where the data in the data table is evenly distributed over time, that is, the amount of data in the same time interval is basically equal. When the data in the data table is evenly distributed over time, equal-width splitting can ensure that the amount of data in different time slices is basically equal, so as to avoid the situation where the amount of data in different partitions is unbalanced.

[0038] As an example, the total time range corresponding to the time field of the full amount of data in the statistical table can be counted first. For example, the data in the data table can be scanned (Scan) once, and the minimum value (Min) and maximum value (Max) of the time field (i.e., time column) of the full amount of data in the statistical table can be counted. The time range (Min, Max) between the minimum value and the maximum value is the total time range, and the time length of the total time range can be expressed as (Max-Min). Then, based on the number of shards N (also called the number of buckets) specified by the user or set by heuristic rules, the time width W of the time slice can be determined, W = (Max-Min) / N, where the number of shards N should satisfy the constraint condition of W>2×time window length. Thus, the total time range can be equally divided into N time slices according to the fixed time width W.

[0039] Method 2: Equal frequency splitting

[0040] Equal frequency splitting means splitting the total duration range corresponding to the time field of the full amount of data in the data table into multiple time slices with different time widths, with the purpose of ensuring that the amount of data in the split time slices is not very different. This splitting method is suitable for situations where the data in the data table is not evenly distributed over time, that is, the amount of data in the same time interval varies greatly. In the case where the data in the data table is not evenly distributed over time, equal frequency splitting can ensure that the amount of data in different time slices is not very different, thereby avoiding the occurrence of uneven data volume in different partitions.

[0041] As an example, first, a histogram of the total amount of data in the data table can be counted, the horizontal axis of the histogram represents the time field value, and the vertical axis of the histogram represents the amount of data. That is, the histogram of the time column of all the data in the data table can be counted. Then the total time range can be split into multiple time slices based on the histogram, and the amount of data in the time range corresponding to different time slices is equal or substantially equal. Among them, the number of slices N (that is, the number of time slices) can be specified by the user or set by heuristic rules. Therefore, in the case where the data in the data table is not evenly distributed over time, equal frequency bucketing can be performed according to the histogram of the time column of all the data in the data table, so that the amount of data in the time range corresponding to different time slices is not much different. In the equal frequency splitting method, the time width of different time slices is generally different, and the number of time slices N should be less than the number of histogram bars.

[0042] For example, the histogram can be merged into N time slices for the purpose of ensuring that the amount of data in different time slices is not much different (such as the difference is lower than a certain threshold), and the kth time slice can be expressed as (Min[k], Max[k]), the time width of the kth time slice is W[k], and the constraint minimum(W[k])>2*window length. Among them, Min[k] represents the minimum time field value in the kth time slice, Max[k] represents the maximum time field value in the kth time slice, and W[k]=Max[k]-Min[k].

[0043] In step S130, the data in the data table is divided into multiple blocks according to the primary key and the time slice.

[0044] Each block corresponds to a time slice, and the primary key of the data in the same block is the same. The primary key refers to the field value shared by the data within the time window range that the time series feature extraction depends on, that is, the target field value. Taking the time series feature extraction as "calculating the total transaction amount of the same user within three days of the transaction" as an example, the primary key can refer to the target field value of the user id.

[0045] Blocks can be regarded as partition results under the two dimensions of primary key and time slice. As an example, the number of partitions, that is, the number of blocks, can be determined based on the number of primary keys of the full data in the data table and the multiple time slices obtained in step S120. Each block corresponds to a "primary key + time slice" combination, and the number of blocks = the number of primary keys × the number of time slices. Taking the primary key as user id and the user id includes user 1, user 2 and user 3, and the time slices include T1, T2, and T3 as an example, the following 9 blocks can be set: (user 1, T1), (user 1, T2), (user 1, T3), (user 2, T1), (user 2, T2), (user 2, T3), (user 3, T1), (user 3, T2), (user 3, T3).

[0046] The data in the data table are divided into multiple blocks according to the primary key and the time slice. That is, for each piece of data in the data table, the time slice in which the time field value of the data is located can be determined according to the time field value of the data and the multiple time slices obtained by splitting in step S120, and then the data is divided into corresponding blocks according to the primary key value of the data and the time slice in which the time field value of the data is located.

[0047] Considering that the data in the data table is divided into multiple blocks according to the primary key and time slice, when the time series feature extraction is performed on the data located near the left boundary of the block, the time window of the data will cross the time boundary, that is, it is necessary to pull the historical data covered by the time window of the data from the previous block, and the data of different blocks are generally allocated to different computing nodes, making it more complicated to pull data across nodes.

[0048] In view of this phenomenon, the present invention proposes that, in the process of dividing each piece of data in a data table into blocks, it is possible to determine whether the piece of data is the boundary data that needs to be relied upon when extracting time series features from the data in the next block of the block where the piece of data is located. If the piece of data is determined to be boundary data, the piece of data is marked as duplicate data and added to the next block. The next block of a block refers to a block that corresponds to the same primary key as the block and whose corresponding time slice belongs to the time slice after the time slice corresponding to the block.

[0049] As an example, each piece of data in the data table can be regarded as a sample. For each sample, it can be determined whether it is a boundary sample, that is, whether it may fall in the time window of other samples in a later time slice. As an example, bucketId = the time slice id where the sample is located, timeBound = (bucketId, bucketId+1) can be set to characterize the boundary of bucketId. If the time field value of a sample is ≤ timeBound-time window, then the sample can be determined to be a boundary sample. If the sample is a boundary sample, copy the sample row, reset its time slice id = bucketId+1, and mark it as a copied sample. Among them, the operations of determining whether the sample is a boundary sample and copying the samples belonging to the boundary sample and resetting the time slice in which it is located can be performed simultaneously with step S120. That is, the boundary samples will fall into two blocks after being copied, which can avoid multiple traversals of the data in the data table and improve data processing efficiency.

[0050] By marking the data belonging to the boundary data as duplicate data and adding it to the next block, the data within the time window required for time series feature extraction processing for each data in the block assigned to the computing node can completely fall into the same partition. The computing node can complete the time series feature extraction processing for each data in the block assigned to it without pulling data across blocks.

[0051] The data marked as duplicate data in the block does not need to be processed for time series feature extraction, that is, the computing node can ignore the time series feature extraction of the data marked as duplicate data in the block. In other words, the duplicate data is only processed as the time window content when other non-duplicate data is processed for time series feature extraction in the block, and the time series feature extraction of the duplicate data itself will be calculated in the block corresponding to its original time slice.

[0052] In step S140, multiple blocks are allocated to multiple computing nodes for time series feature extraction processing.

[0053] One or more blocks can be allocated to a single computing node. After the computing node obtains the block allocated to it, it can perform time series feature extraction processing on each data (non-copy data) in the block. Different computing nodes can execute in parallel.

[0054] In summary, the present invention partitions the data in the data table according to the primary key and the time slice at the same time, so that the originally tilted large data volume partition data can be split into multiple partitions with balanced data volume (i.e., the blocks mentioned above), and the data tilt problem caused by the small number of primary keys can also be solved. For example, assuming that the primary key is a gender field including two quantities "male" and "female", if the partition is performed only according to the primary key, only two partition data will be obtained, which will make the parallelism too small, causing many computing nodes to be idle, and by partitioning the data in the data table according to the primary key and the time slice at the same time, the number of partitions can be increased, thereby solving the data tilt problem caused by the small number of primary keys. In addition, in principle, the present invention does not need to determine whether there is tilted data in the data table, nor does it need to handle the tilted primary key and the non-tilted primary key separately.

[0055] The present invention Figure 1 An exemplary implementation of the method shown is as follows.

[0056] Assume that the time series feature extraction processing operation is to calculate the "total transaction amount of the same user within three days of the transaction" for each row of transactions in the data table below.

[0057] User ID Trading Hours Transaction amount 0 2019.09.30 1$ 1 2019.09.27 2¥ 0 2019.09.24 3$ 1 2019.09.21 4¥ 0 2019.09.18 5$ 1 2019.09.15 6¥ 0 2019.09.12 7¥

[0058] 1. Bucketing in the time dimension

[0059] Taking equal-width bucketing (corresponding to the equal-width splitting mentioned above) as an example, the number of buckets (corresponding to the number of shards mentioned above) N = 2, the total time range (Min = 2019.09.12, Max = 2019.09.30), then the bucket width (corresponding to the time width of the time slice mentioned above) W = (30-12) / 2 = 9 days, and the table with bucket id (that is, time slice id) is as follows:

[0060] User ID Trading Hours Transaction amount BucketID 0 2019.09.30 1$ 2 0 2019.09.27 2¥ 1 0 2019.09.24 3$ 1 1 2019.09.21 4¥ 1 1 2019.09.18 5$ 0 1 2019.09.15 6¥ 0 0 2019.09.12 7¥ 0

[0061] 2. Data table partitioning

[0062] a) Boundary row copy

[0063] The data rows corresponding to the two transaction times 2019.09.21 and 2019.09.18 are boundary data and need to be copied, and the bucket (i.e., time slice) of the copied data must be reset.

[0064] The result after copying is:

[0065] User ID Trading Hours Transaction amount BucketID 0 2019.09.30 1$ 2 0 2019.09.27 2¥ 2 0 2019.09.27 2¥ 1 0 2019.09.24 3$ 1 1 2019.09.21 4¥ 1 1 2019.09.18 5$ 1 1 2019.09.18 5$ 0 1 2019.09.15 6¥ 0 0 2019.09.12 7¥ 0

[0066] b) The results of partitioning (i.e., block partitioning) by user ID + bucket ID are as follows:

[0067] Partition (0, 2)

[0068] 0 2019.09.30 1$ 2 0 2019.09.27 2¥ 2

[0069] Partition (0, 1)

[0070] 0 2019.09.27 2¥ 1 0 2019.09.24 3$ 1

[0071] Partition (1, 1)

[0072] 1 2019.09.21 4¥ 1 1 2019.09.18 5$ 1

[0073] Partition (1, 0)

[0074] 1 2019.09.18 5$ 0 1 2019.09.15 6¥ 0

[0075] Partition (0, 0)

[0076] 0 2019.09.12 7¥ 0

[0077] c) Partition allocation

[0078] The above multiple partitions can be assigned to multiple computing nodes, such as partition (0, 2) can be assigned to computing node 1, partition (0, 1) can be assigned to computing node 2, partition (1, 1) can be assigned to computing node 3, partition (1, 0) can be assigned to computing node 4, and partition (0, 0) can be assigned to computing node 5. After receiving the assigned partitions (i.e., blocks), the computing nodes can sort the data in the partitions, such as sorting by user ID + time field value, and the sorting result is the same as above.

[0079] d) Feature calculation

[0080] Excluding the duplicated data, the time window of each data is in the same partition. The overall time series feature extraction results are as follows.

[0081]

[0082] So far, combined with Figure 1 The present invention has made a detailed description of the implementation scheme of time series feature extraction under the condition of a short time window. The method of implementing time series feature extraction of the present invention can rely on a distributed computing framework, that is, the method of implementing time series feature extraction of the present invention can be executed using a distributed computing framework. Among them, the distributed computing framework can be but is not limited to a Map-Reduce computing framework, such as a spark framework. The present invention will not go into details about the specific implementation details of using a distributed computing framework (such as a Map-Reduce computing framework).

[0083] In addition, the present invention also provides a solution for realizing time series feature extraction for a long time window. A long time window means that the length of the time window on which the time series feature extraction depends is not much different from the time length of the time range corresponding to the full amount of data in the data table, that is, the time window length accounts for a large proportion of the time length of the total time range, such as the ratio of the time window length to the time length of the total time range corresponding to the time field of the full amount of data in the data table is higher than a threshold.

[0084] The present invention proposes a time series feature extraction processing optimization scheme for long time windows. The premise for the implementation of this optimization scheme is that the time series feature extraction operation is an aggregatable calculation along the time dimension. Aggregatable calculation refers to the time series feature extraction operation within the time window. The time window can be split into non-overlapping sub-time periods, and each sub-time period independently calculates the sub-time series feature extraction results. By aggregating the sub-time series feature extraction results, the final time series feature extraction results within the time window can be obtained. Among them, time series feature extraction operations such as summation, maximum / minimum value calculation, etc. are all aggregatable calculations.

[0085] The principle of the time series feature extraction and processing optimization solution proposed by the present invention for long time windows is to split the total time range corresponding to the time field of the full amount of data in the data table into multiple time slices, and split the time series feature extraction and processing within the time window of a single data in the data table into: local calculation of fixed time slices (including the prefix time part and the suffix time part described below) + merge calculation of different time slices. Among them, the feature calculation of the time slice can be performed only once, that is, the feature calculation of the time slice can be calculated once and used everywhere. Therefore, by fully reusing the calculation results of the time slice, the present invention has the advantages of effectively balancing the partitioned parallel calculations and can reduce redundant calculations.

[0086] Combine the following Figure 2 The specific implementation details of the time series feature extraction and processing optimization solution proposed by the present invention for a long time window are further explained.

[0087] Figure 2 A flow chart of a method for extracting time series features according to another exemplary embodiment of the present invention is shown. Figure 2 The method shown can be implemented entirely in software by a computer program or executed by a specially configured computing device. Figure 2 The method shown.

[0088] See also Figure 2 In step S210, the input data table is obtained. For step S210, please refer to the above combined Figure 1 The description of step S110 is not repeated here.

[0089] In step S220, if the ratio of the time window length to the time length of the total time range corresponding to the time field of the full data in the data table is higher than a threshold (which can be called the second threshold for easy distinction), and the time series feature extraction operation is an aggregatable calculation along the time dimension, the total time range is split into multiple time slices, and the time window can divide the time slice.

[0090] When the time series feature extraction operation satisfies the requirements of aggregate calculation, the total time range corresponding to the time field of the full amount of data in the data table can be split into multiple time slices. The time width (i.e., time length) of the time slice should be set to be divisible by the time window, and the time widths of these multiple time slices can be the same, that is, the total time range can be equally split into multiple time slices. For example, assuming that the total time range is 2014-2019 (years) and the time window is "three years", it can be split into multiple short time slices such as 2014-2015, 2015-2016, 2016-2017, 2017-2018, and 2018-2019.

[0091] In step S230, the data in the data table is divided into multiple blocks according to the primary key and the time slice. Figure 1 The description of step S130 is not repeated here.

[0092] In step S240, the plurality of blocks are allocated to the plurality of first computing nodes for local time series feature extraction processing.

[0093] This embodiment divides the temporal feature extraction processing of a single data in a time window into three parts of local temporal feature extraction processing: feature calculation of the prefix time part, feature calculation of the suffix time part, and feature calculation of the block between the prefix time part and the suffix time part. The prefix time part corresponds to the time range from the time field value of the data to the time boundary between the block where the data is located and the previous block; the suffix time part corresponds to the time range from the data with the earliest time field value in the time window of the data (which can be called the first data for easy distinction) to the time boundary between the block where the data (i.e., the first data) is located and the next block; the block between the prefix time part and the suffix time part refers to the block corresponding to the same primary key as the data in the block corresponding to the time slice between the prefix time part and the suffix time part. Among them, the previous block of the block refers to a block that corresponds to the same primary key as the block and whose corresponding time slice belongs to the previous time slice of the time slice corresponding to the block, and the next block of the block refers to a block that corresponds to the same primary key as the block and whose corresponding time slice belongs to the next time slice of the time slice corresponding to the block.

[0094] For ease of description, the feature obtained by performing feature calculation (i.e., local time series feature extraction) on the data within the time range from the time field value of a certain data to the time boundary between the block where the data is located and the previous block can be called the prefix aggregation sub-feature of the data, and the prefix aggregation sub-feature is used to characterize the local time series feature extraction result of the data within the time range from the time boundary between the block where the data is located and the previous block. The feature obtained by performing feature calculation on the data within the time range from the time field value of a certain data to the time boundary between the block where the data is located and the next block can be called the suffix aggregation sub-feature of the data, and the suffix aggregation sub-feature is used to characterize the local time series feature extraction result of the data within the time range from the time boundary between the block where the data is located and the next block. The feature obtained by performing feature calculation on the full amount of data in a block can be called the block aggregation sub-feature of the block, and the block aggregation sub-feature is used to characterize the local time series feature extraction result of the full amount of data in a block.

[0095] For example, assuming that the data table is a transaction record table for multiple users, the total time range corresponding to the full amount of data in the data table is 2014-2020 (years), and the time series feature extraction process is "calculating the total transaction amount of the same user within three years of the transaction", 2014-2020 is split into 2014-2015, 2015-2016, 2016-2017, 2017-2018, 2018-2019, and 2019-2020. The time series feature extraction process of the transaction data of user A with the time field value of 2019.05.04 can be split into:

[0096] (Total transaction amount of user A from 2016.05.04 to 2017.01.01)+

[0097] (Total transaction amount of user A in 2017–2018)+

[0098] (Total transaction amount of user A in 2018–2019)+

[0099] (Total transaction amount of user A from 2019.01.01 to 2019.05.04).

[0100] Among them, 2019.01.01–2019.05.04 is the prefix time part, and "2019.01.01–2019.05.04 User A's total transaction amount" is the prefix aggregation sub-feature obtained by calculating the features of User A's transaction data in the prefix time part; 2016.05.04-2017.01.01 is the suffix time part, and "2016.05.04-2017.01.01 User A's total transaction amount" is the feature calculation of User A's transaction data in the suffix time part. The suffix aggregation sub-feature obtained; 2018-2019 and 2019-2020 are the time slices between the prefix time part and the suffix time part, "Total transaction amount of user A in 2017-2018" is the block aggregation sub-feature obtained by performing feature calculation on the full data in the block "2017-2018 user A transaction data", and "Total transaction amount of user A in 2018-2019" is the block aggregation sub-feature obtained by performing feature calculation on the full data in the block "2018-2019 user A transaction data".

[0101] In this embodiment, multiple first computing nodes do not directly calculate the timing feature extraction results of each data in the block, but perform local timing feature extraction processing to obtain block aggregation sub-features of each block and prefix aggregation sub-features and suffix aggregation sub-features of each data in each block.

[0102] As an example of this embodiment, the same block can be assigned to a single first computing node, and the single first computing node is responsible for calculating the block aggregation sub-features of the assigned block and the prefix aggregation sub-features and suffix aggregation sub-features of each piece of data in the block. That is, the first computing node can perform feature calculations on the entire amount of data in the assigned block to obtain the block aggregation sub-features of the block; and for each piece of data in the block, the first computing node can also perform feature calculations on the data in the time range from the time field value of the data in the block to the time boundary between the block where the data is located and the previous block to obtain the prefix aggregation sub-features of the data; and for each piece of data in the block, the first computing node can also perform feature calculations on the data in the time range from the time field value of the data in the block to the time boundary between the block where the data is located and the next block to obtain the suffix aggregation sub-features of the data.

[0103] As another example of this embodiment, the same block can also be assigned to multiple first computing nodes, and these multiple first computing nodes are responsible for calculating the block aggregation sub-features, prefix aggregation sub-features, and suffix aggregation sub-features. For example, the same block can be assigned to three first computing nodes (such as node 1, node 2, and node 3), respectively. The first computing node (such as node 1) of the three first computing nodes can be responsible for calculating the block aggregation sub-features, the second computing node (such as node 2) of the three first computing nodes can be responsible for calculating the prefix aggregation sub-features of each data in the block, and the third computing node (such as node 3) of the three first computing nodes can be responsible for calculating the suffix aggregation sub-features of each data in the block. That is, node 1 can be used to perform feature calculation on the full amount of data in the block assigned to the computing node to obtain the block aggregation sub-feature of the block; node 2 can be used to perform feature calculation on each piece of data in the block assigned to the computing node, for the data within the time range from the time field value of the data in the block to the time boundary between the block where the data is located and the previous block, to obtain the prefix aggregation sub-feature of the data; node 3 can be used to perform feature calculation on each piece of data in the block assigned to the computing node, for the data within the time range from the time field value of the data in the block to the time boundary between the block where the data is located and the next block, to obtain the suffix aggregation sub-feature of the data.

[0104] 1. Calculation of block aggregation sub-features

[0105] The first computing node may perform feature calculation on the full amount of data in the allocated block to obtain the block aggregation sub-feature of the block. The block aggregation sub-features of different blocks may be stored in a memory, such as a shared memory, to facilitate subsequent reuse of the block aggregation sub-features of the block.

[0106] For example, assuming that the total time range corresponding to the time field of the full amount of data in the data table is 2014.01.01-2019.12.31, and the time series feature extraction process is "calculating the total transaction amount of the same user within three years", the total time range is split into 6 short time slices, and the split results are: 2014.01.01-2015.01.01, 2015.01.01-2016.01.01, 2016.01.01-2017.01.01, 2017.01.01-2018.01.01, 2018.01.01-2019.01.01, 2019.01.01-2020.01.01. Partitioning the data in the data table according to the primary key (that is, user id) + time slice can obtain multiple blocks, and the number of blocks = the number of primary keys × the number of time slices. By calculating the aggregate features of the full data in each block, we can get the block aggregate sub-features of each block. Here, the block aggregate sub-features of each block are used to represent the "total transaction amount of the same user within each time slice bucket range".

[0107] 2. Calculation of prefix aggregation sub-features

[0108] For each piece of data in the block assigned to the first computing node, the first computing node can perform feature calculation on the data within a time range from the time field value of the piece of data in the block to the time boundary between the block where the piece of data is located and the previous block, so as to obtain the prefix aggregation sub-feature of the piece of data.

[0109] For example, assuming that the time series feature extraction process is "calculate the total transaction amount of the same user within three years", and the block data assigned to a first computing node is the transaction amount data of a user in the time slice of 2019.01.01-2020.01.01, then for a transaction amount data with a time field value of 2019.05.04 in the block, the first computing node can calculate the total transaction amount of the user in the time range of 2019.01.01-2019.05.04 to obtain the prefix aggregation sub-feature of the transaction amount data.

[0110] As an example, the first computing node can arrange all the data in the block assigned to it in ascending order according to the time field value to obtain a first sequence of data. For each piece of data in the first sequence of data, the computing node can perform feature calculation based on the piece of data and the data that precedes the piece of data in the first sequence of data to obtain the prefix aggregation sub-feature of the piece of data.

[0111] As an example, the first computing node may also arrange all the data in the block assigned to it in descending order according to the time field value to obtain a second sequence of data. For each piece of data in the second sequence of data, the computing node may perform aggregate feature calculation based on the piece of data and the data that follows the piece of data in the second sequence of data to obtain a prefix aggregate sub-feature of the piece of data.

[0112] Since the time window data required to calculate the prefix aggregation sub-features of a piece of data are all located in a single block, there is no problem of pulling data across blocks, so the calculation of the prefix aggregation sub-features of data in different blocks can be executed in parallel.

[0113] 3. Calculation of suffix aggregate features

[0114] For a single piece of data in the block assigned to the first computing node, the first computing node can perform feature calculation on the data within a time range from the time field value of the piece of data in the block to the time boundary between the block where the piece of data is located and the next block, so as to obtain the suffix aggregation sub-feature of the piece of data.

[0115] For example, assuming that the time series feature extraction process is "calculate the total transaction amount of the same user within three years", the block data assigned to a first computing node is the transaction amount data of a user in the time slice of 2016.01.01-2017.01.01, then for a transaction amount data with a time field value of 2016.05.04 in the block, the first computing node can calculate the total transaction amount of the user in the time range of 2016.05.04-2017.01.01 to obtain the suffix aggregation sub-feature of the transaction amount data.

[0116] As an example, the first computing node can arrange all the data in the block assigned to it in descending order according to the time field value to obtain a second sequence of data. For each piece of data in the second sequence of data, the computing node performs feature calculation based on the piece of data and the data before the piece of data in the second sequence of data to obtain the suffix aggregation sub-feature of the piece of data.

[0117] As an example, the first computing node may also arrange all the data in the block assigned to it in ascending order according to the time field value to obtain a first sequence of data. For each piece of data in the first sequence of data, the computing node performs aggregate feature calculation based on the piece of data and the data that follows the piece of data in the first sequence of data to obtain a suffix aggregate sub-feature of the piece of data.

[0118] Since the time window data required to calculate the suffix aggregation sub-features of a piece of data are all located in a single block, there is no problem of pulling the data required for calculation across blocks. Therefore, the calculation of the suffix aggregation sub-features of data in different blocks can be executed in parallel.

[0119] As mentioned above, the time series feature extraction processing of a single data in the data table within the time window can be divided into three parts of local time series feature extraction processing: feature calculation of the prefix time part (i.e., prefix aggregation sub-feature), feature calculation of the suffix time part (i.e., suffix aggregation sub-feature), and feature calculation of the block between the prefix time part and the suffix time part (i.e., block aggregation sub-feature).

[0120] With the help of multiple first computing nodes, the block aggregation sub-features of each block, the prefix aggregation sub-features and suffix aggregation sub-features of each data in each block can be obtained. Therefore, when calculating the time series feature extraction result of each data in the data table, the corresponding prefix aggregation sub-features, suffix aggregation sub-features and block aggregation sub-features can be directly searched, and the time series feature extraction result of the data can be determined based on the found prefix aggregation sub-features, suffix aggregation sub-features and block aggregation sub-features. For example, the found prefix aggregation sub-features, suffix aggregation sub-features and block aggregation sub-features can be aggregated to obtain the time series feature extraction result of the data.

[0121] Specifically, for a single piece of data in a data table, the prefix time part, the suffix time part, and the time slice between the prefix time part and the suffix time part of the data can be first determined; then, based on the prefix aggregation sub-features obtained by performing feature calculations on the data in the prefix time part, the suffix aggregation sub-features obtained by performing feature calculations on the data in the suffix time part, and the block aggregation sub-features obtained by performing feature calculations on the full amount of data in the block corresponding to the time slice between the prefix time part and the suffix time part and corresponding to the same primary key as the data, the time series feature extraction result of the data is determined. Among them, the prefix aggregation sub-features obtained by performing feature calculations on the data in the prefix time part are the prefix aggregation sub-features of the data, and the suffix aggregation sub-features obtained by performing feature calculations on the data in the suffix time part are the suffix aggregation sub-features of the first piece of data with the earliest time field value in the time window of the data.

[0122] In the present invention, the time series feature extraction result of each data in the data table can be calculated by a second computing node different from the first computing node. In order to facilitate the second computing node to determine the first data with the earliest time field value in the time window of each data, the present invention proposes that each data in the input table can be copied, the copied data is marked as copied data, and the time slice where the copied data is located is reset. The time slice where the copied data is located after the reset is k′=k+T / W, where k is the sequence number of the time slice where the data is located before the reset, T is the time length of the time window, and W is the time length of the time slice. Then, the data in the data table is re-divided into multiple blocks according to the primary key and the time slice, where each block corresponds to a time slice, and the primary key of the data in the same block is the same. In this way, it can be ensured that each data and the first data with the earliest time field value in its time window are in the same block, that is, in the same partition. Finally, the multiple blocks obtained after the re-division can be assigned to multiple second computing nodes, and the second computing nodes calculate the time series feature extraction result of each non-copy data in the block assigned to it.

[0123] For each non-replicated data in the block assigned to the second computing node, since the data with the earliest time field value in the time window of the data (i.e., the first data) is in the same partition as the data, the second computing node can search for the replicated data with the earliest time field value in the time window of the data in the block as the first data with the earliest time field value in the time window of the non-replicated data. After finding the first data, the second computing node can aggregate the prefix aggregation sub-feature of the non-replicated data calculated by the first computing node, the suffix aggregation sub-feature of the first data, and the block aggregation sub-feature of the block with the same primary key as the non-replicated data corresponding to the complete time slice covered by the time window of the non-replicated data, so as to obtain the time series feature extraction result of the data.

[0124] For example, the present invention constrains that the window length of the time window can be divided by the time width W of the time slice. Therefore, assuming that the time slice id of a certain data is k, it can be guaranteed that the time slice id of the last data r_last in the time window of the data is (k-time window length / W), where the last data r_last is also the data with the earliest time field value in the time window of data r, that is, the first data mentioned above. After copying each data in the data table, for each copied data, the time slice k′=k+time window length / W can be reset, and the copied data can be marked. Then the data in the data table (including copied data and non-copied data) is partitioned according to (primary key, time slice id), and for each data r in each block:

[0125] (1) Search for r_last in the block;

[0126] (2) Calculate the time slice k to which r belongs;

[0127] (3) Calculate the time slice k_last to which r_last belongs;

[0128] (4) Obtain the calculation result of the block aggregation sub-feature. The calculation result of the block aggregation sub-feature of the i-th time slice under the r primary key is expressed as partial_sum(i).

[0129] Then the time series feature extraction result f(r) of data r can be recorded as,

[0130] f(r)=suffix_sum(r_last)+

[0131] partial_sum(k_last+1)+

[0132] partial_sum(k_last+2)+…+

[0133] partial_sum(k–1)+

[0134] prefix_sum(r).

[0135] Among them, suffix_sum(r_last) represents the suffix aggregation sub-feature of data r_last, and prefix_sum(r) represents the prefix aggregation sub-feature of data r.

[0136] The calculation of the time series feature extraction results of data in different blocks can be performed in parallel. And there is no need to traverse the entire time window in the same partition, but directly use the local time series feature extraction results (i.e. prefix aggregation sub-features, suffix aggregation sub-features and block aggregation sub-features) calculated by the first computing node, so a lot of redundant calculations can be reduced. For example, if the transaction time of a row of samples is 2019.05.04 and the user id = 1, and the last transaction in its time window occurred on 2016.09.04; then its time series features can be directly calculated as follows:

[0137] sum(user 1 transaction amount in the three years up to 2019.05.04) = sum(2016.09.04–2019.05.04|userid=1) = suffix_sum(2016.09.04–2017.01.01|userid=1) +

[0138] partial_sum(2017.01.01–2018.01.01|userid=1)+

[0139] partial_sum(2018.01.01–2019.01.01|userid=1)+

[0140] prefix_sum(2019.01.01–2019.05.04|userid=1).

[0141] So far, combined with Figure 2 The present invention provides a detailed description of the implementation scheme for extracting time series features under long time windows.

[0142] As an example, after obtaining the input data table, we can determine whether the time window is a short time window or a long time window according to the specific time series feature extraction logic, and determine which time series feature extraction scheme to use according to the judgment result ( Figure 1 The solution shown or Figure 2 The operation of determining whether the time window is a short time window or a long time window can be manually implemented or automatically determined by setting a corresponding threshold.

[0143] In addition, it is also possible to pre-determine whether there may be data skew in the data table, and if it is determined that there is data skew in the data table, it is determined which solution provided by the present invention is used. If it is determined that there is no data skew problem in the data table, the existing partitioning scheme can be used, that is, the data in the data table is partitioned according to the primary key. For example, it is possible to perform a pre-run of the data after downsampling the data table, and to count the distribution ratios of the running time of different parallel tasks recorded, or to pre-count the amount of data under different primary keys in the data table to determine whether there is a skewed key.

[0144] The method for extracting time series features of the present invention can also be implemented as a device for extracting time series features. Figure 3 The structural block diagram of the device for realizing time series feature extraction according to an exemplary embodiment of the present invention is shown. Among them, the functional units of the device for realizing time series feature extraction can be realized by hardware, software or a combination of hardware and software that realizes the principle of the present invention. It can be understood by those skilled in the art that Figure 3 The functional units described may be combined or divided into sub-units to implement the principles of the above invention. Therefore, the description herein may support any possible combination, division, or further limitation of the functional units described herein.

[0145] The following is a brief description of the functional units that a device for implementing time series feature extraction may have and the operations that each functional unit may perform. For the details involved, please refer to the relevant description above and will not be repeated here.

[0146] See also Figure 3The device 300 for implementing time series feature extraction includes an acquisition module 310, a splitting module 320, a division module 330 and an allocation module 340.

[0147] As an example, the device 300 for implementing time series feature extraction can be used to implement time series feature extraction processing under short time window conditions. The acquisition module 310 is used to obtain the input data table; the splitting module 320 is used to split the total time range into multiple time slices if the ratio of the time window length to the time length of the total time range corresponding to the time field of the full amount of data in the data table is lower than the threshold value. The time window is used to characterize the time range of the data that needs to be relied on when extracting time series features for a single piece of data, and the time width of the time slice is greater than or equal to 2 times the time window length; the partitioning module 330 is used to divide the data in the data table into multiple blocks according to the primary key and time slice, wherein each block corresponds to a time slice, and the primary key of the data in the same block is the same; the allocation module 340 is used to allocate multiple blocks to multiple computing nodes for time series feature extraction processing.

[0148] If the data in the data table is evenly distributed over time, the splitting module 320 may include a statistical module, a determination module, and a splitting submodule. The statistical module is used to count the total time range corresponding to the time field of the full amount of data in the statistical table; the determination module is used to determine the time width of each time slice according to the number of slices and the total time range, and the time width of each time slice is equal to the ratio of the total time range to the number of slices; the splitting submodule is used to split the total time range into multiple time slices according to the time width.

[0149] If the data in the data table is not evenly distributed over time, the splitting module 320 may include a statistical module and a splitting submodule. The statistical module is used to calculate a histogram of the total amount of data in the data table, where the horizontal axis of the histogram represents the time field value and the vertical axis of the histogram represents the amount of data; the splitting submodule is used to split the total time range into multiple time slices based on the histogram, where the amount of data in the time range corresponding to different time slices is equal or substantially equal.

[0150] The device 300 for implementing time series feature extraction may further include a first judgment module for judging whether the data in the data table is evenly distributed over time.

[0151] The acquisition module may also be used to acquire the number of slices specified by the user; or the apparatus 300 for implementing time series feature extraction may further include a setting module for setting the number of slices through heuristic rules.

[0152] The device 300 for implementing time series feature extraction may further include a second judgment module and a replication module. The second judgment module is used to judge whether the data in the data table is the boundary data that needs to be relied on for time series feature extraction when the partition module divides each data in the data table into blocks; the replication module is used to mark the data as replication data and add it to the next block if the second judgment module determines that the data is the boundary data, wherein the computing node ignores the time series feature extraction processing of the replication data.

[0153] As an example, the device 300 for implementing time series feature extraction is also used to implement time series feature extraction processing under long time windows. Among them, the acquisition module 310 is used to obtain the input data table. The splitting module 320 is used to split the total time range into multiple time slices if the ratio of the time window length to the time length of the total time range corresponding to the time field of the full amount of data in the data table is higher than the threshold, and the time series feature extraction is an aggregatable calculation along the time dimension. The time window is used to characterize the time range of the data that needs to be relied on when extracting time series features for a single piece of data, and the time window can divide the time slice. The partitioning module 330 is used to divide the data in the data table into multiple blocks according to the primary key and the time slice, wherein each block corresponds to a time slice, and the primary key of the data in the same block is the same. The allocation module 340 is used to allocate multiple blocks to multiple first computing nodes for local time series feature extraction processing to obtain block aggregation sub-features of each block, prefix aggregation sub-features and suffix aggregation sub-features of each data in each block. The block aggregation sub-features are used to characterize the local time series feature extraction results of the full data in the block, the prefix aggregation sub-features are used to characterize the local time series feature extraction results of the data within the time range of the time boundary between the block where a certain data is located and the previous block, and the suffix aggregation sub-features are used to characterize the local time series feature extraction results of the data within the time range of the time boundary between the block where a certain data is located and the next block.

[0154] The allocation module 340 can allocate the same block to a single first computing node, and the first computing node performs feature calculation on the full amount of data in the allocated block to obtain the block aggregation sub-feature of the block. For each piece of data in the block, the first computing node performs feature calculation on the data within a time range from the time field value of the data in the block to the time boundary between the block where the data is located and the previous block to obtain the prefix aggregation sub-feature of the data. For each piece of data in the block, the first computing node performs feature calculation on the data within a time range from the time field value of the data in the block to the time boundary between the block where the data is located and the next block to obtain the suffix aggregation sub-feature of the data.

[0155] The allocation module 340 can also allocate the same block to three first computing nodes respectively, the first computing node among the three first computing nodes is used to perform feature calculation on the full amount of data in the block allocated to the computing node to obtain the block aggregation sub-feature of the block, the second computing node among the three first computing nodes is used to perform feature calculation on each piece of data in the block allocated to the computing node, for the data within a time range from the time field value of the data in the block to the time boundary between the block where the data is located and the previous block, to obtain the prefix aggregation sub-feature of the data, and the third computing node among the three first computing nodes is used to perform feature calculation on each piece of data in the block allocated to the computing node, for the data within a time range from the time field value of the data in the block to the time boundary between the block where the data is located and the next block, to obtain the suffix aggregation sub-feature of the data.

[0156] The device 300 for implementing time series feature extraction may also include a first determination module and a second determination module. The first determination module is used to determine the prefix time part, the suffix time part and the time slice between the prefix time part and the suffix time part of the single data in the data table, the prefix time part corresponds to the time range from the time field value of the data to the time boundary between the block where the data is located and the previous block, and the suffix time part corresponds to the time range from the first data with the earliest time field value in the time window of the data to the time boundary between the block where the first data is located and the next block. The second determination module is used to determine the time series feature extraction result of the data based on the prefix aggregation sub-feature obtained by feature calculation of the data in the prefix time part, the suffix aggregation sub-feature obtained by feature calculation of the data in the suffix time part, and the block aggregation sub-feature obtained by feature calculation of the full amount of data in the block corresponding to the same primary key as the data in the block corresponding to the time slice between the prefix time part and the suffix time part.

[0157] The device 300 for implementing time series feature extraction may also include a replication module. The replication module is used to replicate each piece of data in the input table, mark the replicated data as replicated data, and reset the time slice where the replicated data is located. The time slice where the replicated data is located after the reset is k′=k+T / W, where k is the serial number of the time slice where the data is located before the reset, T is the time length of the time window, and W is the time length of the time slice. The partitioning module re-divides the data in the data table into multiple blocks according to the primary key and the time slice, where each block corresponds to a time slice, and the primary key of the data in the same block is the same. The allocation module allocates the multiple blocks obtained after the partitioning module is re-divided to multiple second computing nodes, and the second computing nodes calculate the time series feature extraction results of each non-replicated data in the block allocated to it.

[0158] For each non-replicated data in the block assigned to the second computing node, the second computing node searches for the replicated data with the earliest time field value in the time window of the data in the block, as the first data with the earliest time field value in the time window of the non-replicated data. The second computing node aggregates the prefix aggregation sub-feature of the non-replicated data calculated by the first computing node, the suffix aggregation sub-feature of the first data, and the block aggregation sub-feature of the block with the same primary key as the non-replicated data corresponding to the complete time slice covered by the time window of the non-replicated data, so as to obtain the time series feature extraction result of the data.

[0159] It should be understood that the specific implementation of the device 300 for extracting time series features according to the exemplary embodiment of the present invention can be referred to in conjunction with Figure 1 , Figure 2 The relevant specific implementation methods described are implemented and will not be repeated here.

[0160] Reference above Figure 1 , Figure 2 A method for implementing time series feature extraction and an apparatus for implementing time series feature extraction according to an exemplary embodiment of the present invention are described. It should be understood that the above method can be implemented by a program recorded on a computer readable medium. For example, according to an exemplary embodiment of the present invention, a computer readable storage medium storing instructions can be provided, wherein the computer readable medium records a program for executing the program. Figure 1 or Figure 2 A computer program showing a method for processing time series data.

[0161] The computer program in the above-mentioned computer-readable medium can be run in an environment deployed in a computer device such as a client, a host, an agent device, a server, etc. It should be noted that the computer program can be used to execute Figure 1 or Figure 2 In addition to the steps shown, it can also be used to perform additional steps other than the above steps or perform more specific processing when performing the above steps. The contents of these additional steps and further processing have been referred to in Figure 1 or Figure 2 The description has been made, and will not be repeated here to avoid repetition.

[0162] It should be noted that the device for implementing timing feature extraction according to the exemplary embodiment of the present invention can completely rely on the operation of the computer program to realize the corresponding functions, that is, each device corresponds to each step in the functional architecture of the computer program, so that the entire system is called through a special software package (for example, lib library) to realize the corresponding function.

[0163] on the other hand, Figure 3The various devices shown may also be implemented by hardware, software, firmware, middleware, microcode, or any combination thereof. When implemented by software, firmware, middleware, or microcode, the program code or code segment for performing the corresponding operation may be stored in a computer-readable medium such as a storage medium, so that the processor may perform the corresponding operation by reading and running the corresponding program code or code segment.

[0164] For example, an exemplary embodiment of the present invention may also be implemented as a computing device, which includes a storage component and a processor, wherein a computer executable instruction set is stored in the storage component, and when the computer executable instruction set is executed by the processor, the method for implementing timing feature extraction is executed.

[0165] Specifically, the computing device may be deployed in a server or client, or may be deployed on a node device in a distributed network environment. In addition, the computing device may be a PC, a tablet device, a personal digital assistant, a smart phone, a web application, or other device capable of executing the above instruction set.

[0166] Here, the computing device is not necessarily a single computing device, but may be any device or circuit collection that can execute the above instructions (or instruction sets) individually or jointly. The computing device may also be part of an integrated control system or system manager, or may be configured as a portable electronic device that is interconnected with a local or remote (e.g., via wireless transmission) interface.

[0167] In the computing device, the processor may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller or a microprocessor. By way of example and not limitation, the processor may also include an analog processor, a digital processor, a microprocessor, a multi-core processor, a processor array, a network processor, etc.

[0168] Some operations described in the method for realizing time series feature extraction according to the exemplary embodiment of the present invention can be realized by software, some operations can be realized by hardware, and in addition, these operations can also be realized by a combination of software and hardware.

[0169] The processor may execute instructions or codes stored in one of the storage components, which may also store data. Instructions and data may also be sent and received over a network via a network interface device, which may employ any known transmission protocol.

[0170] The storage component may be integrated with the processor, for example, RAM or flash memory is arranged within an integrated circuit microprocessor, etc. In addition, the storage component may include a separate device, such as an external disk drive, a storage array, or any other storage device that can be used by a database system. The storage component and the processor may be operatively coupled, or may communicate with each other, such as through an I / O port, a network connection, etc., so that the processor can read files stored in the storage component.

[0171] In addition, the computing device may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, a mouse, a touch input device, etc.) All components of the computing device may be connected to each other via a bus and / or a network.

[0172] The operations involved in the method for realizing timing feature extraction according to an exemplary embodiment of the present invention can be described as various interconnected or coupled functional blocks or functional diagrams. However, these functional blocks or functional diagrams can be equally integrated into a single logical device or operated according to non-exact boundaries.

[0173] For example, as described above, the apparatus for implementing timing feature extraction according to an exemplary embodiment of the present invention may include a storage component and a processor, wherein a computer executable instruction set is stored in the storage component, and when the computer executable instruction set is executed by the processor, the method for implementing timing feature extraction mentioned above is executed.

[0174] The above describes various exemplary embodiments of the present invention, it should be understood that the above description is only exemplary, not exhaustive, and the present invention is not limited to the disclosed exemplary embodiments. Without departing from the scope and spirit of the present invention, many modifications and changes are obvious to those of ordinary skill in the art. Therefore, the scope of protection of the present invention should be based on the scope of the claims.

Claims

1. A method for extracting time series features, comprising: Obtain an input data table, wherein each data in the data table has a time field value for indicating a timestamp; If the ratio of the time window length to the total time range length corresponding to the time field of all data in the data table is lower than the threshold, the total time range is split into multiple time slices. The time window is used to represent the time range of the data that needs to be relied on when extracting time series features for a single piece of data. The time width of the time slice is greater than or equal to twice the time window length. Dividing the data in the data table into multiple blocks according to the primary key and the time slice, each block corresponds to a time slice, and the primary key of the data in the same block is the same; Allocating the multiple blocks to multiple computing nodes for time series feature extraction processing, Among them, the data in the data table are divided into multiple blocks according to the primary key and the time slice, including: for each data in the data table, determining the time slice in which the time field value of the data is located; and dividing the data into corresponding blocks according to the primary key value of the data and the time slice in which the time field value of the data is located.

2. The method according to claim 1, wherein: If the data in the data table is evenly distributed over time, the step of splitting the total time range into multiple time slices includes: Count the total time range corresponding to the time field of all data in the data table; Determine the time width of each time slice according to the number of slices and the total time range, wherein the time width of each time slice is equal to the ratio of the total time range to the number of slices; The total time range is divided into multiple time slices according to the time width.

3. The method according to claim 1, wherein: If the data in the data table is not evenly distributed over time, the step of splitting the total time range into multiple time slices includes: A histogram of all data in the data table is generated, wherein the horizontal axis of the histogram represents the time field value, and the vertical axis of the histogram represents the data volume; The total time range is divided into a plurality of time slices based on the histogram, wherein the data amounts in the time ranges corresponding to different time slices are equal or substantially equal.

4. The method according to claim 2 or 3, further comprising: Determine whether the data in the data table is evenly distributed over time.

5. The method according to claim 2 or 3, further comprising: The number of shards is specified by the user; or The number of shards is set using heuristic rules.

6. The method according to claim 1, further comprising: In the process of dividing each piece of data in the data table into blocks, it is determined whether the piece of data is the boundary data that needs to be relied upon when extracting the time series features of the data in the next block of the block where the piece of data is located; If it is determined that the piece of data is boundary data, the piece of data is marked as duplicate data and added to the next block, wherein the computing node ignores the temporal feature extraction processing of the duplicate data.

7. A device for extracting time series features, comprising: An acquisition module, used for acquiring an input data table, wherein each data in the data table has a time field value for indicating a timestamp; A splitting module, for splitting the total time range into multiple time slices if the ratio of the time window length to the time length of the total time range corresponding to the time field of the full amount of data in the data table is lower than a threshold value, wherein the time window is used to represent the time range of the data that needs to be relied upon when extracting time series features for a single piece of data, and the time width of the time slice is greater than or equal to twice the time window length; A partitioning module, used to partition the data in the data table into multiple blocks according to a primary key and a time slice, wherein each block corresponds to a time slice, and the primary key of the data in the same block is the same; an allocation module, used to allocate the multiple blocks to multiple computing nodes for time series feature extraction processing, The partitioning module determines the time slice of the time field value of each piece of data in the data table, and partitions the data into corresponding blocks according to the primary key value of the data and the time slice of the time field value of the data.

8. The device according to claim 7, wherein: If the data in the data table is evenly distributed over time, the splitting module includes: A statistics module, used to count the total time range corresponding to the time field of all data in the data table; A determination module, configured to determine a time width of each time slice according to the number of slices and the total time range, wherein the time width of each time slice is equal to a ratio of the total time range to the number of slices; The splitting submodule is used to split the total time range into multiple time slices according to the time width.

9. The device according to claim 7, wherein: If the data in the data table is not evenly distributed over time, the splitting module includes: A statistical module, used to generate a histogram of all data in the data table, wherein the horizontal axis of the histogram represents the time field value and the vertical axis of the histogram represents the data volume; The splitting submodule is used to split the total time range into multiple time slices based on the histogram, wherein the data amounts in the time ranges corresponding to different time slices are equal or substantially equal.

10. The device according to claim 8 or 9, further comprising: The first judgment module is used to judge whether the data in the data table is evenly distributed over time.

11. The device according to claim 8 or 9, wherein: The acquisition module is further used to acquire the number of shards specified by a user; or the device further includes a setting module, which is used to set the number of shards through a heuristic rule.

12. The apparatus according to claim 7, further comprising: A second judgment module is used to judge whether the data in the data table is the boundary data that needs to be relied on when extracting the time series features of the data in the next block of the block where the data is located, during the process of the division module dividing each data in the data table into blocks; A copy module is used to mark the data as copy data and add it to the next block if the second judgment module determines that the data is boundary data, wherein the computing node ignores the time series feature extraction processing of the copy data.

13. A system comprising at least one computing device and at least one storage device storing instructions, wherein: When the instructions are executed by the at least one computing device, the at least one computing device is prompted to perform the method of any one of claims 1 to 6.

14. A computer-readable storage medium storing instructions, wherein: When the instructions are executed by at least one computing device, the at least one computing device is prompted to perform the method according to any one of claims 1 to 6.