Timing feature calculation method and system, computer device and readable storage medium
By adopting a declarative syntax structure for the temporal feature calculation model, the problems of complex logic and poor readability in traditional temporal feature calculation are solved, and flexible and efficient feature calculation and concatenation are achieved, ensuring the temporal correctness and calculation accuracy of features.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-21
- Publication Date
- 2026-03-31
AI Technical Summary
Traditional time-series feature calculation logic is complex, has poor readability, and is difficult to optimize in a distributed environment.
The time-series feature calculation model adopts a declarative syntax structure, including stateless transition statements, time-series aggregation statements, and feature concatenation statements. It generates data streams through stateless transitions, filters related data streams for aggregation calculation, and performs feature concatenation based on the main event time.
It improves the flexibility and reusability of data preprocessing, avoids time travel issues, ensures the temporal correctness of features, reduces computational logic complexity, and improves readability and accuracy.
Smart Images

Figure CN121188077B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, system, computer device, and readable storage medium for calculating time-series characteristics. Background Technology
[0002] In the field of data analysis and computing, time series feature engineering is widely used in scenarios such as financial risk control and risk detection to extract valuable features from time series data to support subsequent modeling or decision-making. Traditionally, standard SQL (Structured Query Language) or general-purpose programming languages (such as Python and Java) are typically used for time series feature computation. However, defining complex time window features using standard SQL often requires writing multi-level nested subqueries or complex window functions, resulting in verbose code, unclear logic, and poor readability and maintainability. Using general-purpose programming languages, on the other hand, requires manually implementing low-level logic such as data iteration, state management, and window computation, leading to low development efficiency and difficulty in optimization in a distributed environment.
[0003] There is currently no effective solution to the problems of complex computational logic and poor readability of time-series features in traditional technologies. Summary of the Invention
[0004] Therefore, it is necessary to provide a method, system, computer device, and readable storage medium for calculating time-series characteristics to address the aforementioned technical problems.
[0005] In a first aspect, this application provides a method for calculating time-series features, the method comprising:
[0006] Obtain the task information and source data stream corresponding to the target time-series feature task; the task information includes the main event associated entity, main event time, aggregation object, and time window constraints corresponding to the target time-series feature task;
[0007] Obtain a time-series feature calculation model; the time-series feature calculation model includes stateless transition statements, time-series aggregation statements, and feature concatenation statements;
[0008] Based on the stateless transition statement, the source data stream is stateless transitioned to obtain the corresponding stateless transition data stream;
[0009] Based on the time-series aggregation statement, the associated data stream that matches the entity associated with the main event is filtered out from the stateless transition data stream, and the associated data stream is subjected to time-series aggregation calculation under the time window constraint to obtain the corresponding time-series aggregation features;
[0010] Based on the feature concatenation statement, the time-series aggregated features are concatenated using the main event time as the time-series alignment benchmark to generate the time-series feature result corresponding to the target time-series feature task.
[0011] In one embodiment, the task information further includes the stateless transition operation type corresponding to the target temporal feature task; the step of performing a stateless transition on the source data stream based on the stateless transition statement to obtain the corresponding stateless transition data stream includes:
[0012] Based on the stateless transition operation type and the source data stream, the stateless transition statement is instantiated with parameters to obtain an executable stateless transition statement.
[0013] By executing the executable stateless transition statement, the source data stream is statelessly transitioned to obtain the corresponding stateless transitioned data stream.
[0014] In one embodiment, the task information further includes the time-series aggregation operation type corresponding to the target time-series feature task; the step of filtering the associated data stream matching the main event associated entity from the stateless transition data stream based on the time-series aggregation statement, and performing time-series aggregation calculation on the associated data stream under the time window constraint to obtain the corresponding time-series aggregation feature includes:
[0015] Based on the main event associated entity, the time-series aggregation operation type, the aggregation object, the time window constraint, and the stateless transition data stream, the time-series aggregation statement is parameterized to obtain an executable time-series aggregation statement;
[0016] By executing the executable time-series aggregation statement, associated data streams that match the entity associated with the main event are filtered from the stateless transition data stream, and time-series aggregation calculations are performed on the associated data streams under the time window constraint to obtain the corresponding time-series aggregation features.
[0017] In one embodiment, the step of filtering out associated data streams matching the entity associated with the main event from the stateless transition data stream by executing the executable time-series aggregation statement, and performing time-series aggregation calculations on the associated data streams under the time window constraint to obtain corresponding time-series aggregation features includes:
[0018] By executing the executable time-series aggregation statement, the associated data stream that matches the entity associated with the main event is filtered out from the stateless transition data stream;
[0019] Based on the time window constraint, extract the window slice data corresponding to the time window constraint from the associated data stream;
[0020] Perform time-series aggregation calculations on the target window slice data corresponding to the aggregation object in the window slice data to generate corresponding time-series aggregation features.
[0021] In one embodiment, the step of performing feature concatenation on the temporal aggregated features based on the feature concatenation statement and using the main event time as the temporal alignment benchmark to generate the temporal feature result corresponding to the target temporal feature task includes:
[0022] Based on the main event associated entity, the main event time, and the time-series aggregation features, the feature concatenation statement is parameterized to obtain an executable feature concatenation statement;
[0023] By executing the executable feature concatenation statement, the time-series aggregated features are concatenated using the main event time as the time-series alignment benchmark, thereby generating the time-series feature result corresponding to the target time-series feature task.
[0024] In one embodiment, the step of executing the executable feature concatenation statement to concatenate the temporal aggregated features using the main event time as the temporal alignment reference, and generating the temporal feature result corresponding to the target temporal feature task, includes:
[0025] For each entity associated with the main event, at least one candidate time-series aggregation feature that matches the entity associated with the main event is determined from the time-series aggregation features based on a preset dimension matching rule;
[0026] Based on preset time alignment rules, target time aggregation features that match the time of the main event are determined from the candidate time aggregation features;
[0027] The main event associated entity, the main event time, and the target time series aggregate feature are concatenated to generate the time series feature result corresponding to the target time series feature task.
[0028] In one embodiment, each of the candidate time-series aggregation features has a corresponding event time; the step of determining the target time-series aggregation feature that matches the main event time from the candidate time-series aggregation features based on a preset time-series alignment rule includes:
[0029] From the candidate time-series aggregated features, a first candidate feature whose event time is earlier than the main event time is selected;
[0030] The first candidate feature with the latest event time is determined as the target time-series aggregation feature aligned with the time of the main event.
[0031] In one embodiment, the method for constructing the time-series feature calculation model includes:
[0032] Acquire stateless transition logic, stateful temporal aggregation calculation logic, and feature association logic;
[0033] The stateless transition logic is encapsulated to obtain stateless transition statements represented by a declarative syntax structure;
[0034] The stateful temporal aggregation calculation logic is encapsulated to obtain a temporal aggregation statement represented by a declarative syntax structure;
[0035] The feature association logic is encapsulated to obtain a feature concatenation statement represented by a declarative syntax structure.
[0036] Secondly, this application also provides a time-series feature calculation device, the device comprising:
[0037] The first acquisition module is used to acquire task information and source data stream corresponding to the target time-series feature task; the task information includes the main event associated entity, main event time, aggregation object and time window constraint corresponding to the target time-series feature task;
[0038] The second acquisition module is used to acquire the time-series feature calculation model; the time-series feature calculation model includes stateless transition statements, time-series aggregation statements, and feature concatenation statements.
[0039] A stateless transition module is used to perform stateless transition on the source data stream based on the stateless transition statement to obtain a corresponding stateless transition data stream;
[0040] The time-series aggregation module is used to filter out the associated data stream that matches the entity associated with the main event from the stateless transition data stream based on the time-series aggregation statement, and perform time-series aggregation calculation on the associated data stream under the time window constraint to obtain the corresponding time-series aggregation features;
[0041] The feature splicing module is used to splice the time-series aggregated features based on the feature splicing statement and with the main event time as the time-series alignment benchmark, to generate the time-series feature result corresponding to the target time-series feature task.
[0042] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described in any of the above embodiments.
[0043] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any of the above embodiments.
[0044] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in any of the above embodiments.
[0045] The aforementioned time-series feature calculation method, system, computer equipment, and readable storage medium, by acquiring task information and source data streams corresponding to the target time-series feature task, perform stateless transformation on the source data streams based on stateless transformation statements to generate stateless transformed data streams, thereby improving the flexibility and reusability of data preprocessing; based on time-series aggregation statements, they filter out associated data streams that match the entities associated with the main event from the stateless transformed data streams, and complete aggregation calculations under time window constraints to generate corresponding time-series aggregated features; furthermore, based on feature concatenation statements, using the time of the main event as the time-series alignment benchmark, they concatenate the time-series aggregated features with the main event features, effectively avoiding time travel problems and ensuring the time-series correctness of the features; and by implementing time-series feature calculation based on the time-series feature calculation model, they can effectively reduce the complexity of the overall calculation logic and improve the readability and accuracy of the time-series feature calculation process. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 This is an application environment diagram of the time series feature calculation method in one embodiment;
[0048] Figure 2 This is a flowchart illustrating a time-series feature calculation method in one embodiment;
[0049] Figure 3 This is a flowchart illustrating the construction method of a time-series feature calculation model in one embodiment;
[0050] Figure 4 This is a flowchart illustrating the temporal aggregation feature generation steps in one embodiment;
[0051] Figure 5 This is a flowchart illustrating the steps for generating time-series feature results in one embodiment;
[0052] Figure 6 This is a structural block diagram of a timing feature calculation device in one embodiment;
[0053] Figure 7This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0055] The time-series feature calculation method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be located on a cloud or other network server. Terminal 102 can be, but is not limited to, various personal computers, laptops, and tablets. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0056] In one embodiment, such as Figure 2 As shown, Figure 2 This is a flowchart illustrating a time-series feature calculation method in one embodiment. This embodiment uses the application of the time-series feature calculation method to a terminal as an example. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0057] Step S201: Obtain the task information and source data stream corresponding to the target time-series feature task.
[0058] Among them, the target time-series feature task refers to a specific business event from which time-series features need to be extracted.
[0059] The task information includes the main event associated entity, main event time, aggregation object, and time window constraints corresponding to the target time-series characteristic task. It can be understood that the main event refers to the core business event upon which the target time-series characteristic task depends.
[0060] Here, "Main Event Associated Entity" refers to the main object describing the feature. "Main Event Time" refers to the timestamp of the main event. It can be understood that the main event time is the time reference point for generating the time-series feature results. "Aggregation Object" refers to the numerical field to be aggregated. "Time Window Constraint" is used to constrain the time column and time range corresponding to feature calculation.
[0061] The source data stream refers to the original data stream corresponding to the target time-series feature task, which may include, but is not limited to, fields such as timestamp, entity ID, and behavior type. For example, in a payment event, the source data stream could be a transfer data stream.
[0062] In an exemplary embodiment, in the target time-series feature task of "when a user logs into the App at 10:30:00 on 2025-04-05, calculate the user's cumulative payment amount in the past 7 days", the main event can be understood as the user login event; the entity associated with the main event is the user, which can be uniquely identified by the user_id field, but is not limited to; the main event time is the timestamp of the main event (i.e., the login event), which is 10:30:00 on 2025-04-05; the aggregation object is the payment amount; the time window constraint is the past 7 days, for example, [10:30:00 on 2025-03-29, 2025-04-05, 10:30:00], that is, 7 days backward from the main event time.
[0063] Step S202: Obtain the time series feature calculation model.
[0064] The time-series feature computation model employs a declarative syntax structure. This means that by using a declarative syntax, users only need to define the business logic for the features, without needing to concern themselves with the underlying implementation details, thus improving the readability, maintainability, and reusability of the time-series feature computation model. Essentially, the time-series feature computation model is a directed acyclic graph that defines the computational path for feature generation.
[0065] The temporal feature computation model includes stateless transition statements, temporal aggregation statements, and feature concatenation statements. It should be noted that these statements all employ a declarative syntax structure, decoupling the computational logic from the execution engine and making feature definitions independent of the underlying runtime environment. Furthermore, by decoupling stateless transitions and stateful aggregations, clear and efficient computational logic is achieved.
[0066] Stateless transition statements define the stateless transition calculation logic. This logic performs stateless transition operations based on preset scalar functions and preset basic operators. Preset scalar functions are functions used to perform value-by-value calculations or transformations on fields of a single data record. Preset scalar functions do not introduce external state or depend on historical data; they may include, but are not limited to, LOWER() and TRIM(). Preset basic operators are symbols or keywords used for basic logic and arithmetic operations, constructing filtering conditions, field mappings, or derived fields. Preset basic operators may include, but are not limited to, arithmetic operators and comparison operators. It should be noted that the specific limitations of preset scalar functions and preset basic operators are related to the actual time-series feature calculation task and are not specifically defined here.
[0067] The temporal aggregation statement defines the stateful temporal aggregation calculation logic. This logic is used to perform temporal aggregation calculations based on preset event-related entities, preset time window constraints, preset aggregation functions, and preset aggregation objects. The preset event-related entities, preset time window constraints, preset aggregation functions, and preset aggregation objects are all related to the actual temporal feature calculation task and are not specifically limited here.
[0068] The feature concatenation statement defines the feature association logic. This logic, based on preset dimension matching rules and preset time-series alignment rules, aligns the time-series aggregated features with the main event. The preset dimension matching rules ensure that all participating time-series aggregated features share the same associated entity (e.g., user, device), preventing concatenation errors or data misalignment due to inconsistent dimensions. The preset time-series alignment rules determine the unified time reference used for concatenating multiple time-series aggregated features, ensuring temporal consistency during feature concatenation and preventing logical errors; for example, using the main event time as the endpoint of the timeline for feature time-series alignment.
[0069] Step S203: Based on the stateless transition statement, perform a stateless transition on the source data stream to obtain the corresponding stateless transition data stream.
[0070] Stateless transitions refer to operations that perform calculations or transformations on each independent data record, the results of which depend only on the current input record itself, and not on any historical data, intermediate states or external context information.
[0071] In one exemplary embodiment, the stateless transition data stream can be represented, but is not limited to, a view, without specific limitation herein.
[0072] In an exemplary embodiment, based on a stateless transition statement, an executable stateless transition statement is obtained by instantiating the stateless transition statement with parameters. Then, by executing the executable stateless transition statement, the source data stream can be statelessly transitioned to obtain the corresponding stateless transition data stream.
[0073] Step S204: Based on the time-series aggregation statement, filter out the associated data streams that match the entities associated with the main event from the stateless transition data stream, and perform time-series aggregation calculation on the associated data streams under the time window constraint to obtain the corresponding time-series aggregation features.
[0074] It is understandable that different entities associated with a main event have their own corresponding associated data streams. An associated data stream refers to an independent subset of data in a stateless data stream that matches the entity associated with the main event.
[0075] The temporal aggregation feature is used to characterize the temporal behavior pattern of entities associated with the main event before the main event occurs. In an exemplary embodiment, the temporal aggregation feature can be represented in the form of a view, but is not limited to that in this embodiment.
[0076] In an exemplary embodiment, based on a time-series aggregation statement, an executable time-series aggregation statement is obtained by instantiating the time-series aggregation statement with parameters. Then, by executing the executable time-series aggregation statement, it is possible to filter out the associated data stream that matches the entity associated with the main event from the stateless transition data stream, and perform time-series aggregation calculation on the associated data stream under the time window constraint to obtain the corresponding time-series aggregation features.
[0077] Step S205: Based on the feature concatenation statement, the time-series aggregated features are concatenated using the main event time as the time-series alignment benchmark to generate the time-series feature result corresponding to the target time-series feature task.
[0078] Among them, using the main event time as the time alignment benchmark means using the main event time as the end point of the time axis to perform feature time alignment, thereby achieving strict alignment of multiple time-series aggregated features on the time axis.
[0079] In one exemplary embodiment, the temporal feature results may be represented, but are not limited to, in the form of a view, and are not specifically limited thereto.
[0080] In an exemplary embodiment, based on the feature concatenation statement, an executable feature concatenation statement is obtained by instantiating the feature concatenation statement with parameters. Then, by executing the executable feature concatenation statement, the time-series aggregated features can be concatenated with the main event time as the time-series alignment benchmark to generate the time-series feature result corresponding to the target time-series feature task.
[0081] It should be noted that the parameter instantiation described in the above embodiments refers to the instantiation of parameter placeholders in the declarative syntax structure, so that the declarative statement is transformed into specific instructions or operation logic that can be parsed and executed by the system. Based on this, users only need to define the relevant information for parameter instantiation without worrying about the underlying implementation details, which effectively simplifies the calculation logic of time-series feature calculation.
[0082] In this embodiment, by acquiring the task information and source data stream corresponding to the target temporal feature task, a stateless transformation is performed on the source data stream based on a stateless transformation statement to generate a stateless transformation data stream, thereby improving the flexibility and reusability of data preprocessing. Based on a temporal aggregation statement, associated data streams matching the entities associated with the main event are selected from the stateless transformation data stream, and aggregation calculation is completed under the constraint of a time window to generate the corresponding temporal aggregation features. Furthermore, based on a feature concatenation statement, the temporal aggregation features are concatenated with the main event using the time of the main event as the temporal alignment benchmark, effectively avoiding the time travel problem and ensuring the temporal correctness of the features. The temporal feature calculation is implemented based on a temporal feature calculation model, which can effectively reduce the complexity of the overall calculation logic and improve the readability and accuracy of the temporal feature calculation process.
[0083] In one embodiment, such as Figure 3 As shown, Figure 3 This is a flowchart illustrating a method for constructing a time-series feature calculation model in one embodiment; the method for constructing the time-series feature calculation model includes the following steps:
[0084] Step S301: Obtain the stateless transition logic, the stateful temporal aggregation calculation logic, and the feature association logic.
[0085] Among them, the stateless transition logic is used to perform stateless transition operations based on preset scalar functions and preset basic operators; for example, data cleaning, format conversion, or simple mathematical operations based on a single row of data.
[0086] Among them, there is a state-series aggregation calculation logic, which is used to perform time-series aggregation calculations based on preset event-related entities, preset time window constraints, preset aggregation functions, and preset aggregation objects.
[0087] Among them, the feature association logic is used to perform association and alignment of temporal aggregated features with the main event based on preset dimension matching rules and preset temporal alignment rules.
[0088] It should be noted that the specific implementation forms, content structures, and configuration methods of stateless transition logic, stateful time-series aggregation calculation logic, and feature association logic need to be flexibly defined according to different business scenarios, data source structures, feature targets, and system architectures, and are not specifically limited here.
[0089] Step S302: Encapsulate the stateless transition logic to obtain a stateless transition statement represented by a declarative syntax structure.
[0090] Encapsulating stateless transition logic involves transforming it into structured, parsable declarative statements. For example, encapsulating stateless transition logic into SQL-like declarative statements. These stateless transition statements include SELECT clauses. It's important to note that the SELECT clause in stateless transition statements only supports scalar functions; aggregate functions are prohibited.
[0091] In an exemplary embodiment, the stateless transition logic is encapsulated to obtain a stateless transition statement represented by a declarative syntax structure, namely the CREATE LOGIC VIEW statement. The CREATE LOGIC VIEW statement includes a SELECT clause; the SELECT clause in the CREATE LOGIC VIEW statement is only allowed to use scalar functions (such as LOWER(), TRIM(), etc.) and basic operators, and aggregate functions (such as SUM(), AVG(), etc.) are prohibited to ensure its stateless processing characteristics.
[0092] Step S303: Encapsulate the stateful temporal aggregation calculation logic to obtain a temporal aggregation statement represented by a declarative syntax structure.
[0093] Specifically, for stateful time-series aggregation calculation logic, this refers to encapsulating the stateful time-series aggregation calculation logic into structured, parsable declarative statements. For example, encapsulating the stateful time-series aggregation calculation logic into SQL-like declarative statements. These time-series aggregation statements include SELECT and OVER clauses; the SELECT clause supports the use of aggregate functions; the OVER clause includes a time keyword, namely the TIME BY keyword; the time keyword is used to define the time field (i.e., the basis for time window segmentation) and the time window (i.e., the time span range) corresponding to the time-series aggregation calculation.
[0094] In an exemplary embodiment, the stateful time-series aggregation calculation logic is encapsulated to obtain a time-series aggregation statement represented by a declarative syntax structure, namely the CREATE TIME VIEW statement. The CREATE TIME VIEW statement includes a SELECT clause and an OVER clause; the SELECT clause in the CREATE TIME VIEW statement must use an aggregate function; the syntax of the OVER clause in the CREATE TIME VIEW statement is: OVER (PARTITION BY [dimension column] TIME BY [time column] RANGE '[time window]'); where, dimension column is used to specify the dimension column of the entity associated with the main event; in TIME BY [time column] RANGE '[time window]', time column is used to define the time field column corresponding to the time-series aggregation calculation; time window is used to define the time span range corresponding to the time-series aggregation calculation.
[0095] It's worth noting that the window definition for `TIME BY [time column] RANGE '[time window]'` supports flexible time range settings, meeting the needs of fine-grained time-series calculations in complex business scenarios. For example, the system can easily implement sliding window calculations that "exclude the most recent period" through extended syntax, effectively avoiding feature crossing or data leakage issues. For instance, it supports compound time expressions like `RANGE '3d-10h'`, whose semantics are: statistically analyze behavioral data from the past 3 days, but exclude data from the most recent 10 hours.
[0096] It should be noted that this application explicitly specifies the time field column used for time window segmentation and the specific time window by introducing TIME BY [time column] RANGE '[time window]', making the semantics more in line with time series scenarios and the syntax more concise; for example, RANGE '1d' means a rolling window based on one day.
[0097] In one exemplary embodiment, taking the calculation of the sum of all transaction amounts for each account over the past 24 hours as an example, the structure of the corresponding CREATE TIME VIEW statement is as follows:
[0098] "CREATE TIME VIEW v1 AS"
[0099] SELECT nvl(SUM(oper_amount) OVER (PARTITION BY acct_no TIME BY timeRANGE '1d'),2) as feat1
[0100] FROM wps.wps_cctest_flows_1;”;
[0101] Here, `CREATE TIME VIEW v1` indicates the creation of a time-series aggregated feature view named `v1`, supporting efficient referencing in subsequent feature stitching tasks; `wps.wps_cctest_flows_1` is the data source corresponding to the time-series aggregate calculation; `acct_no` represents the account number; `oper_amount` represents the operation amount; `time` represents the timestamp of the operation. `SUM(oper_amount)` sums the operation amounts; `PARTITION BY acct_no` indicates grouping by account number, with each account's `acct_no` maintaining its aggregate status independently; `TIME BY time` specifies that the `time` field is used as the basis for dividing the time window; `RANGE '1d'` defines the time window as a rolling window of "the past 1 day". `feat1` represents the generated time-series aggregated feature column, whose value is the sum of the operation amounts for each account in the past 24 hours (if no record is found, it is filled with the default value using `nvl(..., 2)`).
[0102] Step S304: Encapsulate the feature association logic to obtain a feature concatenation statement represented by a declarative syntax structure.
[0103] The feature association logic is used to align time-series aggregated features with the main event based on preset dimension matching rules and preset time-series alignment rules. The preset dimension matching rules ensure that all time-series aggregated features participating in the splicing share the same associated entity of the main event (such as user, device, etc.), avoiding splicing errors or data misalignment due to inconsistent dimensions. The preset time-series alignment rules determine the unified time base used when splicing multiple time-series aggregated features, ensuring time-series consistency during feature splicing and preventing logical errors; for example, using the main event time as the endpoint of the timeline for feature time-series alignment.
[0104] The feature concatenation statement includes the USE keyword; the USE keyword is used to declaratively introduce one or more time-series aggregate features to achieve dimensional and temporal alignment between the main event and the time-series aggregate features.
[0105] In an exemplary embodiment, the feature association logic is encapsulated to obtain a feature concatenation statement represented by a declarative syntax structure, which is a CREATE TIME TABLE statement. The CREATE TIME TABLE statement includes the USE keyword. The USE keyword is used to declaratively introduce one or more time-series aggregated features pre-computed based on the CREATE TIME VIEW statement to achieve dimensional and time alignment between the main event and the time-series aggregated features.
[0106] In an exemplary embodiment, assume that time-series aggregated feature view v1 includes a time-series aggregated feature column feat1; time-series aggregated feature view v2 includes a time-series aggregated feature column feat2; based on the CREATE TIME VIEW statement, time-series aggregated feature view v1 and time-series aggregated feature view v2 are associated with the main event to construct the corresponding time-series feature results (i.e., wide table features); taking wps.wps_cctest_flows_3 as the main event table as an example, the structure of the CREATE TIME VIEW statement is as follows:
[0107] "CREATE time TABLE mhk.res AS
[0108] SELECT
[0109] val(f1.feat1) as feat1,
[0110] val(f2.feat2) as feat2
[0111] FROM wps.wps_cctest_flows_3 USE v1 f1, v2 f2;”;
[0112] `CREATE time TABLE mhk.res` creates a time-series feature result table named `mhk.res`, representing the final concatenated wide feature table, which can be output to downstream models or storage systems. `val()` is the feature extraction function; where `f1` is a temporary alias for the time-series aggregated feature view `v1`, and `f2` is a temporary alias for the time-series aggregated feature view `v2`. These temporary aliases are used for convenient referencing in subsequent queries. `FROM wps.wps_cctest_flows_3 USEv1 f1, v2 f2` means that, based on `wps.wps_cctest_flows_3`, the features `feat1` and `feat2` calculated in `v1` and `v2` are time-aligned and concatenated to generate a per-transaction-level wide time-series feature table.
[0113] Understandably, by using USE [view alias], one can directly and conveniently reference the time-series aggregated feature columns calculated in the corresponding time-series aggregated feature view, and combine them with the main event associated entity and the main event time in the main event table to form the final result.
[0114] In this embodiment, by independently encapsulating the stateless transition logic and the stateful time-series aggregation calculation logic, the decoupling of data preprocessing and feature calculation is achieved. This avoids the resource waste caused by the redundant coupling of cleaning logic and aggregation logic in traditional SQL, and improves computational efficiency and maintainability. At the same time, by declaratively encapsulating the feature association logic, the pre-calculated time-series aggregation feature view is directly referenced using the USE keyword. Alignment is performed by dimension subject (e.g., the main event associated entity) and time-series consistency association is performed based on the main event time to generate a per-item-level feature wide table, which significantly simplifies the feature splicing process and reduces development complexity.
[0115] In one embodiment, the task information further includes the stateless transition operation type corresponding to the target temporal feature task; based on the stateless transition statement, the source data stream is statelessly transitioned to obtain the corresponding stateless transition data stream, including the following steps:
[0116] Step 1: Based on the stateless transition operation type and the source data stream, instantiate the stateless transition statement with parameters to obtain an executable stateless transition statement.
[0117] Among them, the stateless transformation operation type is used to declare specific processing operations that perform independent and deterministic transformations on each record in the source data stream. These operations do not depend on historical states or context information, but only on the field values of the current event to complete preprocessing logic such as cleaning, standardization, type conversion, and null value handling, ensuring the standardization and consistency of the output data and providing a high-quality input foundation for subsequent time series feature calculations.
[0118] Among them, stateless transition statements can be executed directly and can be parsed and run.
[0119] Step 2: By executing executable stateless transition statements, the source data stream is statelessly transitioned to obtain the corresponding stateless transitioned data stream.
[0120] It should be noted that since stateless transition statements have a declarative syntax structure, they need to be instantiated in practice. That is, the placeholder parameters in the stateless transition statement are replaced with specific values to generate an executable stateless transition statement that can be executed directly. Then, by parsing and executing the executable stateless transition statement, the stateless transition data stream corresponding to the source data stream can be directly generated.
[0121] In this embodiment, the stateless transition statement is instantiated with parameters based on the stateless transition operation type and the source data stream to obtain an executable stateless transition statement; this not only avoids manually writing repetitive stateless transition logic, improving development efficiency and consistency, but also achieves decoupling between stateless transition logic and aggregation logic.
[0122] In one embodiment, the task information further includes the time-series aggregation operation type corresponding to the target time-series feature task; based on the time-series aggregation statement, the associated data stream matching the entity associated with the main event is filtered from the stateless transition data stream, and the associated data stream is subjected to time-series aggregation calculation under the time window constraint to obtain the corresponding time-series aggregation feature, including the following steps:
[0123] Step 1: Based on the main event associated entity, the time-series aggregation operation type, the aggregation object, the time window constraint, and the stateless transition data stream, instantiate the parameters of the time-series aggregation statement to obtain an executable time-series aggregation statement.
[0124] The time-series aggregation operation type is used to declare the specific calculation logic for statistical analysis of data within a time window. For example, the time-series aggregation operation type may include, but is not limited to, summation, averaging, etc.
[0125] The time-series aggregation statement includes a SELECT clause and an OVER clause. The SELECT clause in the time-series aggregation statement must use an aggregate function. The syntax of the OVER clause in the time-series aggregation statement is: OVER (PARTITION BY [dimension column] TIME BY [time column] RANGE '[time window]'). Here, the dimension column is used to specify the dimension column of the entity associated with the main event, and TIME BY [time column] RANGE '[time window]' is used to define the basis for splitting the time window and the range of the time window.
[0126] It should be noted that this application explicitly specifies the column used for time window segmentation and the specific time window by introducing TIME BY [time column] RANGE '[time window]', making the semantics more in line with the time sequence scenario and the syntax more concise.
[0127] Among them, the executable time-series aggregation statements can be directly parsed and run.
[0128] Understandably, when performing time-series aggregation calculations, it is only necessary to specify the main event associated entity, the time-series aggregation operation type, the aggregation object, the time window constraints, and the stateless transition data flow to complete the parameter instantiation of the time-series aggregation statement. Users do not need to understand the details of the underlying processing logic implementation to achieve automatic feature generation and efficient calculation.
[0129] Step 2: By executing executable time-series aggregation statements, filter out the associated data streams that match the entities associated with the main event from the stateless transition data streams, and perform time-series aggregation calculations on the associated data streams under time window constraints to obtain the corresponding time-series aggregation features.
[0130] In this embodiment, elements such as event-related entities, time-series aggregation operation types, aggregation objects, time window constraints, and stateless transition data streams are written into the time-series aggregation statement, which can directly realize the automatic generation of executable aggregation logic. This not only avoids manually writing repetitive window functions and improves the efficiency and consistency of feature development, but also realizes centralized management and cross-task reuse of aggregation logic, enhancing the flexibility, maintainability, and computational reliability of time-series feature calculation.
[0131] In one embodiment, such as Figure 4 As shown, Figure 4 This is a flowchart illustrating the time-series aggregation feature generation steps in one embodiment. By executing executable time-series aggregation statements, associated data streams matching the entities associated with the main event are filtered from the stateless transition data stream. Time-series aggregation calculations are then performed on the associated data streams under time window constraints to obtain the corresponding time-series aggregation features. The steps include:
[0132] Step S410: By executing an executable time-series aggregation statement, the associated data stream that matches the entity associated with the main event is filtered from the stateless transition data stream.
[0133] Within this framework, different entities associated with the main event have their own corresponding associated data streams. An associated data stream refers to an independent subset of data in a stateless data stream that matches the entity associated with the main event.
[0134] Step S402: Based on the time window constraint, extract the window slice data corresponding to the time window constraint from the associated data stream.
[0135] Window slice data refers to a subset of data in the associated data stream that satisfies the time window constraint.
[0136] In an exemplary embodiment, in a scenario where the time window constraint is '1d', if an event occurs on 2025-04-05 10:00:00, then the window slice data consists of all valid records generated in the past 24 hours (i.e., from 2025-04-04 10:00:00 to 2025-04-05 10:00:00).
[0137] Step S403: Perform time-series aggregation calculation on the target window slice data corresponding to the aggregation object in the window slice data to generate the corresponding time-series aggregation features.
[0138] It should be noted that since window slice data may contain multiple fields or various data records (such as transaction amount, operation type, device information, etc.), not all data participates in this aggregation calculation. Therefore, it is necessary to filter out the corresponding target window slice data based on the aggregation object (i.e., the numerical field to be aggregated) as the input dataset for the actual calculation.
[0139] In an exemplary embodiment, by executing an executable time-series aggregation statement, associated data streams matching the main event associated entity can be filtered from the stateless data stream based on the main event associated entity; then, according to the time column (such as event_time) and time window range (such as '1d' or '7d') defined in the time window constraint, window slice data corresponding to the time window constraint is extracted from the associated data stream; then, based on the time-series aggregation operation type (such as SUM or AVG), time-series aggregation calculation is performed on the target window slice data corresponding to the aggregation object in the window slice data to generate the corresponding time-series aggregation features.
[0140] In this embodiment, by executing executable time-series aggregation statements, automated and efficient computation from stateless data stream transformation to time-series aggregated features is achieved. First, data filtering is performed based on the entities associated with the main event, ensuring that only the historical behavior of these entities is processed. Then, dynamic slicing is performed according to the time column and window range in the time window constraint to accurately extract valid historical data. Finally, combined with the time-series aggregation operation type, time-series aggregation calculations are performed on the target window slice data corresponding to the aggregation object, generating time-series aggregated features with clear business meaning, ensuring the reliability of the time-series aggregation calculation. Furthermore, the entire calculation process is based on declarative configuration-driven architecture, lowering the development threshold and enhancing the maintainability and cross-task reusability of the feature calculation logic.
[0141] In one embodiment, based on the feature concatenation statement, the time-series aggregated features are concatenated using the main event time as the time-series alignment benchmark to generate the time-series feature result corresponding to the target time-series feature task, including the following steps:
[0142] Step 1: Based on the main event associated entity, the main event time, and the time sequence aggregation features, instantiate the feature concatenation statement with parameters to obtain an executable feature concatenation statement.
[0143] It should be noted that when implementing feature splicing, it is only necessary to specify the specific main event associated entity, the main event time, and the time-series aggregated features, instantiate the feature splicing statement with parameters, and obtain an executable feature splicing statement, so as to realize multi-source feature splicing with the main event time as the time-series alignment benchmark.
[0144] Among them, the feature concatenation statement includes the reference keyword, namely the USE keyword; the USE keyword is used to declaratively introduce one or more time-series aggregated features, and achieve dimensional alignment and time-series alignment between the main event and the time-series aggregated features based on the main event associated entity and the main event time.
[0145] Understandably, the USE keyword simplifies the final feature synthesis steps, making the script for the entire feature engineering process clearer and more concise in structure.
[0146] Step 2: By executing the executable feature concatenation statement, the time-series aggregated features are concatenated with the main event time as the time-series alignment benchmark to generate the time-series feature results corresponding to the target time-series feature task.
[0147] The time series feature results can be represented in a view format, but are not limited to it. For example, the time series feature results can be represented using a time series feature wide table.
[0148] In this embodiment, based on the main event associated entity, the main event time, and the time-series aggregation features, the feature concatenation statement is parameterized to generate an executable feature concatenation statement. Then, by executing the executable feature concatenation statement, the safe, efficient, and accurate concatenation of multiple time-series aggregation features is achieved with the main event time as the time-series alignment benchmark. This not only improves the automation level and computational performance of time-series feature engineering, but also effectively ensures the accuracy and time-series correctness of the feature data.
[0149] In one embodiment, such as Figure 5 As shown, Figure 5 This is a flowchart illustrating the steps for generating time-series feature results in one embodiment. By executing executable feature concatenation statements, time-series aggregated features are concatenated using the main event time as the time-series alignment benchmark to generate the time-series feature results corresponding to the target time-series feature task. The steps include:
[0150] Step S501: For each entity associated with the main event, based on the preset dimension matching rules, determine at least one candidate time-series aggregation feature that matches the entity associated with the main event from the time-series aggregation features.
[0151] It should be noted that the calculation logic for the corresponding time-series features of entities associated with different main events is the same.
[0152] Among them, the preset dimension matching rules are used to ensure that each time-series aggregated feature participating in the splicing shares the same main event associated entity (such as user, device, etc.), so as to avoid splicing errors or data misalignment due to inconsistent dimensions.
[0153] It should be noted that the time-series aggregated features are a global time-series feature stream, which may include time-series aggregated features corresponding to multiple different main event-related entities. During feature concatenation, for the current main event-related entity, the system will select a set of feature records that match the main event-related entity from the time-series aggregated features, as candidate time-series aggregated features. That is, candidate time-series aggregated features refer to a set of feature records that match the main event-related entity. Each candidate time-series aggregated feature corresponds to an event time.
[0154] The event time corresponding to the candidate time-series aggregated feature refers to the cutoff time of the historical behavior corresponding to the candidate time-series aggregated feature. For example, a feature "total transaction amount in the past day" updated at 09:59:30 on 2025-07-05 has an event time of 09:59:30 on 2025-07-05.
[0155] Step S502: Based on the preset time alignment rules, determine the target time aggregation feature that matches the time of the main event from the candidate time aggregation features.
[0156] Among them, the preset time alignment rules are used to determine the unified time benchmark on which multiple time-series aggregated features are based when splicing them together, so as to ensure the time consistency of feature splicing and prevent logical errors; for example, feature time alignment is performed with the time of the main event as the end point of the time axis.
[0157] It should be noted that not all candidate time-series aggregated features can be directly used for feature concatenation. Since the candidate feature set may include feature records generated after the main event (i.e., "future features"), direct use would lead to data corruption and other problems. Therefore, rigorous time filtering based on the main event time is necessary to determine the target time-series aggregated features that match the main event time.
[0158] In an exemplary embodiment, based on a preset time alignment rule, a target time-series aggregation feature matching the time of the main event is determined from candidate time-series aggregation features, including the following steps:
[0159] Step 1: Select the first candidate feature from the candidate time-series aggregated features whose event time is earlier than the main event time.
[0160] Step 2: The first candidate feature with the latest event time is identified as the target time-series aggregation feature aligned with the main event time.
[0161] For example, taking "the number of transfers made by the same account within the past 3 days at the time of login" as an example, based on the method described in any of the above instances, multiple candidate time-series aggregated features corresponding to a certain account are obtained. The event time corresponding to the candidate time-series aggregated features is the specific transfer occurrence time (transfer_time), while the main event time is the account's login time (login_time). At this time, the login time needs to be used as the time-series alignment benchmark. Records with event times earlier than the login time are filtered from the candidate time-series aggregated features, and the record with the latest transfer time is selected as the target time-series aggregated feature. This mechanism ensures that the referenced number of transfers is calculated only based on historical behavior before the login time, achieving accurate alignment between the main event and historical features in the time dimension, and ensuring the causal correctness and time-series consistency of the feature results.
[0162] Step S503: Perform feature concatenation on the main event associated entity, the main event time, and the target time series aggregated feature to generate the time series feature result corresponding to the target time series feature task.
[0163] It is important to note that when performing feature concatenation, both dimensional alignment and temporal alignment principles must be strictly followed to ensure the accuracy and business rationality of the concatenation results. Dimensional alignment refers to using the entity associated with the main event (such as user_id, acct_no) as the association key to ensure that the referenced features indeed belong to the same business entity, avoiding feature misalignment across users or accounts. Temporal alignment refers to using the main event time as the time base to ensure that the event time of the target temporal aggregated feature being concatenated is earlier than the main event time, and selecting the latest state to guarantee the correct causal logic of the features.
[0164] In this embodiment, by adhering to both dimensional alignment and temporal alignment principles during feature stitching, the accuracy, logical consistency, and business rationality of the stitching results can be effectively ensured. Dimensional alignment ensures that the main event and feature data belong to the same business entity, avoiding feature mismatch; temporal alignment uses the main event time as a benchmark, ensuring that the referenced feature values are generated only based on historical information, preventing future data leakage, and meeting the causal relationship requirements in real-world scenarios.
[0165] In one specific embodiment, the time-series feature calculation model includes the stateless transition statement `CREATE LOGICVIEW`, the time-series aggregation statement `CREATE TIME VIEW`, and the feature concatenation statement `CREATE TIME TABLE`. The user submits a complete script containing these three types of statements. For example: first, `CREATE LOGIC VIEW v1` is used to calculate the discount on the transaction amount; then, `CREATE TIME VIEW v2` is used to calculate the total transaction amount for each user over the past 7 days, with the aggregation logic being `SUM(...) OVER (PARTITION BY user_id TIME BY trans_time RANGE '7d')`; finally, `CREATE TIME TABLE final_result` is used to select basic information from the original transaction table, and `USE v2` is used to combine the calculated 7-day total transaction amount features to form the final wide table.
[0166] It should be noted that the aforementioned time-series feature calculation method, based on a time-series feature calculation model, decomposes the complex time-series feature calculation task into three structured stages, making the correspondence between business logic and code immediately clear. Compared to traditional lengthy and nested standard SQL, the readability and maintainability of the code in this application are effectively improved. Users (such as developers and data analysts) only need to focus on the business logic of "what features are needed," without having to write underlying process code such as data iteration and state management, thereby significantly lowering the development threshold and greatly improving the efficiency of feature development. Simultaneously, by introducing the TIME BY keyword into the time-series aggregation statement CREATE TIME VIEW, it is clarified that the core of time-series calculation is the time dimension, rather than ordinary sorting, making the code intent clearer and effectively avoiding logical confusion or calculation errors caused by the incorrect use of traditional ORDER BY. By introducing the USE keyword into the feature concatenation statement CREATE TIME TABLE, declarative, JOIN-free pre-calculated features are achieved, simplifying the final feature synthesis steps and making the entire feature engineering script structurally clearer and more concise.
[0167] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0168] In one embodiment, a time-series feature calculation system is also provided for executing the time-series feature calculation method described in any of the above embodiments.
[0169] It should be noted that the specific limitations of the time series feature calculation system in executing the time series feature calculation method can be found in the limitations of any time series feature calculation method mentioned above, and will not be repeated here.
[0170] In one specific embodiment, the time-series feature computation system includes a parser, a logic planner, and an execution engine. The parser is responsible for recognizing stateless transition statements, time-series aggregation statements, and feature concatenation statements (including recognizing keywords such as TIME BY and USE) as described in any of the above embodiments. The logic planner generates a directed acyclic graph as an execution plan based on the target time-series feature task, combining the stateless transition statements, time-series aggregation statements, and feature concatenation statements. The execution engine then efficiently executes data transformation and aggregation tasks in a distributed computing environment according to the execution plan, manages the states required for window computation, and produces the final result.
[0171] Based on the same inventive concept, this application also provides a timing feature calculation device for implementing the timing feature calculation method described above. The solution provided by this device is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more timing feature calculation device embodiments provided below can be found in the limitations of the timing feature calculation method described above, and will not be repeated here.
[0172] In one exemplary embodiment, such as Figure 6 As shown, a time-series feature calculation device is provided, including: a first acquisition module 601, a second acquisition module 602, a stateless transition module 603, a time-series aggregation module 604, and a feature splicing module 605;
[0173] The first acquisition module 601 is used to acquire task information and source data stream corresponding to the target time-series feature task; the task information includes the main event associated entity, main event time, aggregation object and time window constraint corresponding to the target time-series feature task;
[0174] The second acquisition module 602 is used to acquire the time series feature calculation model; the time series feature calculation model includes stateless transition statements, time series aggregation statements, and feature concatenation statements.
[0175] The stateless transition module 603 is used to perform stateless transition on the source data stream based on the stateless transition statement to obtain the corresponding stateless transition data stream;
[0176] The time-series aggregation module 604 is used to filter out the associated data streams that match the entities associated with the main event from the stateless transition data streams based on the time-series aggregation statement, and to perform time-series aggregation calculations on the associated data streams under the constraints of the time window to obtain the corresponding time-series aggregation features.
[0177] The feature splicing module 605 is used to splice the time-series aggregated features based on the feature splicing statement and with the main event time as the time-series alignment benchmark, to generate the time-series feature results corresponding to the target time-series feature task.
[0178] The aforementioned time-series feature calculation device acquires task information and source data streams corresponding to the target time-series feature task, performs stateless transformation on the source data streams based on stateless transformation statements, and generates stateless transformed data streams, improving the flexibility and reusability of data preprocessing. Based on time-series aggregation statements, it filters out associated data streams that match entities associated with the main event from the stateless transformed data streams, and completes aggregation calculations under time window constraints to generate corresponding time-series aggregated features. Furthermore, based on feature concatenation statements, it concatenates the time-series aggregated features with the main event using the main event time as the time-series alignment benchmark, effectively avoiding time travel issues and ensuring the time-series correctness of the features. By implementing time-series feature calculation based on the time-series feature calculation model, it can effectively reduce the complexity of the overall calculation logic and improve the readability and accuracy of the time-series feature calculation process.
[0179] In one embodiment, the task information further includes the stateless transition operation type corresponding to the target temporal feature task; the stateless transition module 603 is also used for:
[0180] Based on the stateless transition operation type and the source data stream, the stateless transition statement is instantiated with parameters to obtain an executable stateless transition statement.
[0181] By executing executable stateless transition statements, the source data stream is statelessly transitioned to obtain the corresponding stateless transitioned data stream.
[0182] In one embodiment, the task information further includes the time series aggregation operation type corresponding to the target time series feature task; the time series aggregation module 604 is also used for:
[0183] Based on the main event associated entity, the time-series aggregation operation type, the aggregation object, the time window constraint, and the stateless transition data stream, the time-series aggregation statement is parameterized to obtain an executable time-series aggregation statement.
[0184] By executing executable time-series aggregation statements, associated data streams that match the entities associated with the main event are filtered out from the stateless transition data streams. Time-series aggregation calculations are then performed on the associated data streams under time window constraints to obtain the corresponding time-series aggregation features.
[0185] In one embodiment, the time-series aggregation module 604 is further configured to:
[0186] By executing executable time-series aggregation statements, the associated data stream that matches the entity associated with the main event is filtered out from the stateless transition data stream;
[0187] Based on time window constraints, extract window slice data corresponding to the time window constraints from the associated data stream;
[0188] Perform time-series aggregation calculations on the target window slice data corresponding to the aggregation object in the window slice data to generate the corresponding time-series aggregation features.
[0189] In one embodiment, the feature splicing module 605 is further configured to:
[0190] Based on the main event associated entity, the main event time, and the time sequence aggregation features, the feature concatenation statement is parameterized to obtain an executable feature concatenation statement;
[0191] By executing executable feature concatenation statements, the time-series aggregated features are concatenated with the main event time as the time-series alignment benchmark to generate the time-series feature results corresponding to the target time-series feature task.
[0192] In one embodiment, the feature splicing module 605 is further configured to:
[0193] For each entity associated with the main event, at least one candidate time-series aggregation feature that matches the entity associated with the main event is determined from the time-series aggregation features based on the preset dimension matching rules.
[0194] Based on preset time alignment rules, target time aggregation features that match the time of the main event are determined from candidate time aggregation features;
[0195] The main event associated entities, the main event time, and the target time series aggregate features are concatenated to generate the time series feature results corresponding to the target time series feature task.
[0196] In one embodiment, each candidate temporal aggregation feature has a corresponding event time; the feature concatenation module 605 is further used for:
[0197] From the candidate time-series aggregated features, the first candidate feature whose event time is earlier than the main event time is selected;
[0198] The first candidate feature with the latest event time is identified as the target time-series aggregation feature aligned with the main event time.
[0199] In one embodiment, the time-series feature calculation device further includes a model building module; the model building module is configured to:
[0200] The system acquires stateless transition logic, stateful temporal aggregation calculation logic, and feature association logic. The stateless transition logic is used to perform stateless transition operations based on preset scalar functions and preset basic operators. The stateful temporal aggregation calculation logic is used to perform temporal aggregation calculations based on preset event-related entities, preset time window constraints, preset aggregation functions, and preset aggregation objects. The feature association logic is used to perform association alignment between temporal aggregation features and main events based on preset dimension matching rules and preset temporal alignment rules.
[0201] The stateless transition logic is encapsulated to obtain stateless transition statements represented by a declarative syntax structure;
[0202] The stateful temporal aggregation calculation logic is encapsulated to obtain temporal aggregation statements represented by a declarative syntax structure;
[0203] The feature association logic is encapsulated to obtain feature concatenation statements represented by a declarative syntax structure.
[0204] Each module in the aforementioned timing characteristic calculation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0205] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data related to timing feature calculations. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a timing feature calculation method.
[0206] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0207] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0208] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0209] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0210] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0211] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0212] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0213] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method of timing feature calculation, characterized by, The method comprises: obtaining task information corresponding to a target time sequence feature task and a source data stream; the task information comprises a main event associated entity, a main event time, an aggregation object and a time window constraint corresponding to the target time sequence feature task; the task information further comprises a time sequence aggregation operation type corresponding to the target time sequence feature task; obtaining a time sequence feature calculation model; the time sequence feature calculation model comprises a stateless conversion statement, a time sequence aggregation statement and a feature splicing statement; based on the stateless conversion statement, performing stateless conversion on the source data stream to obtain a corresponding stateless conversion data stream; based on the main event associated entity, the time sequence aggregation operation type, the aggregation object, the time window constraint and the stateless conversion data stream, performing parameter instantiation on the time sequence aggregation statement to obtain an executable time sequence aggregation statement; by executing the executable time sequence aggregation statement, filtering out an associated data stream matching the main event associated entity from the stateless conversion data stream, and performing time sequence aggregation calculation on the associated data stream under the time window constraint to obtain a corresponding time sequence aggregation feature; based on the main event associated entity, the main event time and the time sequence aggregation feature, performing parameter instantiation on the feature splicing statement to obtain an executable feature splicing statement; by executing the executable feature splicing statement, performing feature splicing on the time sequence aggregation feature with the main event time as a time sequence alignment reference to generate a time sequence feature result corresponding to the target time sequence feature task.
2. The method of claim 1, wherein, The task information further comprises a stateless conversion operation type corresponding to the target time sequence feature task; the stateless conversion data stream obtained by performing stateless conversion on the source data stream based on the stateless conversion statement comprises: based on the stateless conversion operation type and the source data stream, performing parameter instantiation on the stateless conversion statement to obtain an executable stateless conversion statement; by executing the executable stateless conversion statement, performing stateless conversion on the source data stream to obtain a corresponding stateless conversion data stream.
3. The method of claim 1, wherein, The executable time sequence aggregation statement is obtained by performing parameter instantiation on the time sequence aggregation statement based on the main event associated entity, the time sequence aggregation operation type, the aggregation object, the time window constraint and the stateless conversion data stream; by executing the executable time sequence aggregation statement, filtering out an associated data stream matching the main event associated entity from the stateless conversion data stream, and performing time sequence aggregation calculation on the associated data stream under the time window constraint to obtain a corresponding time sequence aggregation feature, comprises: by executing the executable time sequence aggregation statement, filtering out an associated data stream matching the main event associated entity from the stateless conversion data stream; based on the time window constraint, intercepting a window slice data corresponding to the time window constraint from the associated data stream; performing time sequence aggregation calculation on target window slice data corresponding to the aggregation object in the window slice data to generate a corresponding time sequence aggregation feature.
4. The method of claim 1, wherein, The executable feature splicing statement is obtained by performing parameter instantiation on the feature splicing statement based on the main event associated entity, the main event time and the time sequence aggregation feature; by executing the executable feature splicing statement, performing feature splicing on the time sequence aggregation feature with the main event time as a time sequence alignment reference to generate a time sequence feature result corresponding to the target time sequence feature task, comprises: For each of the main event associated entity, based on a preset dimension matching rule, at least one candidate time sequence aggregation feature matching the main event associated entity is determined from the time sequence aggregation feature; Based on a preset time sequence alignment rule, a target time sequence aggregation feature matching the main event time is determined from the candidate time sequence aggregation feature; The main event associated entity, the main event time and the target time sequence aggregation feature are spliced to generate a time sequence feature result corresponding to the target time sequence feature task.
5. The method of claim 4, wherein, Each of the candidate time sequence aggregation features has a corresponding event time; based on a preset time sequence alignment rule, a target time sequence aggregation feature matching the main event time is determined from the candidate time sequence aggregation feature, which includes: The first candidate feature with an event time earlier than the main event time is screened from the candidate time sequence aggregation feature; The first candidate feature with the latest event time is determined as the target time sequence aggregation feature aligned with the main event time.
6. The method of any one of claims 1 to 5, wherein, The construction method of the time sequence feature calculation model includes: Obtaining stateless conversion logic, stateful time sequence aggregation calculation logic and feature association logic; The stateless conversion logic is encapsulated to obtain a stateless conversion statement represented by a declarative syntax structure; The stateful time sequence aggregation calculation logic is encapsulated to obtain a time sequence aggregation statement represented by a declarative syntax structure; The feature association logic is encapsulated to obtain a feature splicing statement represented by a declarative syntax structure.
7. A timing feature calculation system characterized by, The time sequence feature calculation system is used to execute the time sequence feature calculation method in any one of claims 1 to 6. 8.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-7. The processor executes the computer program to realize the steps of the method in any one of claims 1 to 6.
Citation Information
Patent Citations
Streaming computing engine running method and system for skew data
CN110990059A
Data storage method and device, server and storage medium
CN112800061A