Method and device for determining user behavior cycle, electronic device and storage medium
By obtaining user behavior data and preset period sequences, and using preset period models to calculate the confidence of user behavior cycles, the problem of inaccurate mining of user behavior cycles in the prior art is solved, and more accurate application function recommendations and higher user satisfaction are achieved.
Patent Information
- Application Number
- CN202111631056.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2041-12-28
AI Technical Summary
The existing technology cannot accurately unearth the user's behavior cycle, which leads to the recommended application functions not meeting the actual usage needs of users. The main reason is that the user's operation behavior is diverse and the time series is sparse.
By obtaining the target user's behavior data and a preset period sequence, the confidence of the time series about each behavior period is calculated using the preset period model, and the behavior period is determined when the confidence is greater than the preset threshold.
It realizes accurate determination of user behavior cycles, improves the accuracy of recommended application functions, meets users' actual operational needs, and improves user satisfaction.
Smart Images

Figure CN114219540B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology, and in particular to a method for determining a user behavior cycle, a device thereof, an electronic device and a storage medium. Background Art
[0002] At present, the application operation functions in user terminals are gradually enriched. For most financial services, users only need to use the terminal to handle them. In order to meet the personalized needs of users, financial institutions have also launched a variety of functions, such as the "appointment transfer" function, which can provide great convenience for users with periodic transfer needs. However, some functions (for example, functions that perform certain operations regularly) have major problems in the promotion process. If these functions are fully promoted, users who do not have these function needs will be disgusted, and even cause user loss. How to dig out customers with periodic operation needs from the user's historical records is the key to solving this problem.
[0003] In the related technology, there are many mature algorithms for time series prediction, such as recurrent neural network (RNN), long short-term memory (LSTM), linear regression, ARMA model, xgboost, Fourier transform, etc. However, these existing algorithms cannot accurately mine the user's behavior cycle, resulting in the recommended application functions not meeting the actual needs of users. There are two main reasons: (1) The operations performed by users through financial platforms are very diverse (for example, paying electricity bills, paying water bills, withdrawing cash, etc.), and because each user has different habits, in order to accurately predict the cycle of user behavior, it is necessary to model each user. However, it is impractical to train a neural network model for each operation of each user, and using an overly complex method for prediction cannot meet the timeliness requirements; (2) From the data level analysis, the operations performed by users through financial platforms are usually not continuous, and the generated time series are usually sparse. Taking electricity bills as an example, the cycle is generally about 20-40 days, and general machine learning methods are not applicable to this problem.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a method for determining a user behavior cycle and its device, electronic device and storage medium, so as to at least solve the technical problem in the related art that the user's behavior cycle cannot be accurately mined, resulting in the recommended application functions not meeting the user's actual usage needs.
[0006] According to one aspect of an embodiment of the present invention, a method for determining a user behavior cycle is provided, comprising: obtaining behavior data of a target user within a preset time period and a preset cycle sequence, wherein the behavior data at least includes: a time series and an operation behavior corresponding to each time point in the time series, and the cycle sequence includes multiple behavior cycles; inputting the time series into a preset cycle model to obtain a time regularization distance value, a time series length, and the behavior cycle; based on the time regularization distance value, the time series length, and the behavior cycle, calculating the confidence of the time series with respect to each of the behavior cycles; and when the confidence of the target behavior cycle is greater than a preset parameter threshold, determining the target behavior cycle as the behavior cycle of the time series.
[0007] Optionally, after obtaining the behavior data of the target user within a preset time period, the determination method further includes: deduplicating the behavior data; sorting the deduplicated behavior data according to time points to obtain the behavior data sorted in time series.
[0008] Optionally, after obtaining the behavior data of the target user within a preset time period, the determination method also includes: obtaining a start time node and an end time node in the time series; based on the start time node and the end time node, constructing an initial sequence associating time nodes with node values, wherein, in the initial sequence, all the node values are assigned to preset values; when the operation behavior occurs at the target time node, calculating the ratio between the time series length of the initial sequence and the total number of times the operation behavior occurs, and replacing the node value corresponding to the target time node with the ratio.
[0009] Optionally, before inputting the time series into the preset periodic model, the determination method includes: obtaining user data of multiple users within a historical time period, wherein the user data includes at least: a user ID, a date on which the behavior occurred, and a transaction party account, the user ID is used to count the first number of times the user performs the operation behavior, the date on which the behavior occurs is used to count the second number of times the operation behavior occurs on each historical date, and the transaction party account is used to count the third number of times each user performs the operation behavior using the same transaction party account; dividing the historical time period according to preset segmentation parameters to obtain multiple historical sub-time periods, and counting the fourth number of times the operation behavior occurs in each of the historical sub-time periods; determining user statistical data based on the first number, the second number, the third number, and the fourth number; and training the preset periodic model based on the user statistical data.
[0010] Optionally, the time series is input into a preset periodic model to obtain a time regularization distance value, a time series length and the behavior period, including: using the preset periodic model to divide the time series according to the preset periodic interval length to obtain a plurality of subsequences; expanding each of the subsequences according to the time progress so that the time length of the subsequence is the same as the time length of the time series; calculating the dynamic time regularization integer value between each of the subsequences and the time series; and representing the minimum dynamic time regularization integer value as the time regularization distance value.
[0011] Optionally, the step of calculating the dynamic time gauge integer value between each of the subsequences and the time series includes: obtaining the node value corresponding to each time node in the subsequence; when the node value is a preset value, accumulating the node value and a preset alignment penalty value to obtain an accumulated node value; when the node value is not the preset value, calculating the difference between the alignment penalty value and the node value, and accumulating the node value and the difference to obtain an accumulated node value; based on the accumulated node value, calculating the dynamic time gauge integer value between each of the subsequences and the time series.
[0012] Optionally, after calculating the confidence of the time series with respect to each of the behavior cycles, the determination method further includes: when the confidence of all the behavior cycles is less than or equal to a preset parameter threshold, sorting all the confidences to obtain a confidence sorting result; determining the behavior cycle corresponding to the highest confidence in the confidence sorting result; based on a preset expansion strategy, expanding the behavior cycle corresponding to the highest confidence to a reference behavior cycle; and searching for the behavior data of the target user within a preset time period according to the reference behavior cycle to calculate the confidence of the time series with respect to the reference behavior cycle.
[0013] Optionally, the behavior data includes at least one of the following: user identification, transaction type, transaction identification, transaction amount, transaction time, and transaction party account.
[0014] According to another aspect of an embodiment of the present invention, a device for determining a user behavior cycle is also provided, comprising: an acquisition unit, used to acquire the behavior data of a target user within a preset time period and a preset cycle sequence, wherein the behavior data at least includes: a time series and an operation behavior corresponding to each time point in the time series, and the cycle sequence includes multiple behavior cycles; an input unit, used to input the time series into a preset cycle model to obtain a time regularization distance value, a time series length, and the behavior cycle; a calculation unit, used to calculate the confidence of the time series with respect to each behavior cycle based on the time regularization distance value, the time series length, and the behavior cycle; a determination unit, used to determine that the target behavior cycle is the behavior cycle of the time series when the confidence of the target behavior cycle is greater than a preset parameter threshold.
[0015] Optionally, the determination device also includes: a first deduplication module, used to deduplicate the behavior data after obtaining the behavior data of the target user within a preset time period; a first sorting module, used to sort the behavior data after deduplication according to time points to obtain the behavior data sorted in time series.
[0016] Optionally, the determination device also includes: a first acquisition module, used to obtain the start time node and the end time node in the time series after obtaining the behavior data of the target user within a preset time period; a first construction module, used to construct an initial sequence of time nodes and node values based on the start time node and the end time node, wherein, in the initial sequence, all the node values are assigned to preset values; a first calculation module, used to calculate the ratio between the time series length of the initial sequence and the total number of times the operation behavior occurs when the operation behavior occurs at the target time node, and replace the node value corresponding to the target time node with the ratio.
[0017] Optionally, the determination device includes: a second acquisition module, used to obtain user data of multiple users in a historical time period before inputting the time series into a preset periodic model, wherein the user data includes at least: a user identifier, a date on which the behavior occurred, and a transaction party account, wherein the user identifier is used to count the first number of times the user performs the operation behavior, the date on which the behavior occurs is used to count the second number of times the operation behavior occurs on each historical date, and the transaction party account is used to count the third number of times each user performs the operation behavior using the same transaction party account; a first statistics module, used to divide the historical time period according to preset segmentation parameters to obtain multiple historical sub-time periods, and count the fourth number of times the operation behavior occurs in each of the historical sub-time periods; a first determination module, used to determine user statistical data based on the first number, the second number, the third number, and the fourth number; a first training module, used to train the preset periodic model based on the user statistical data.
[0018] Optionally, the input unit includes: a first division module, used to adopt the preset period model to divide the time series according to the preset period interval length to obtain multiple subsequences; a first expansion module, used to expand each of the subsequences according to the time progress so that the time length of the subsequence is the same as the time length of the time series; a second calculation module, used to calculate the dynamic time regularization integer value between each of the subsequences and the time series; a first characterization module, used to characterize the minimum dynamic time regularization integer value as the time regularization distance value.
[0019] Optionally, the second calculation module includes: a first acquisition submodule, used to obtain the node value corresponding to each time node in the subsequence; a first accumulation submodule, used to accumulate the node value and a preset alignment penalty value to obtain an accumulated node value when the node value is a preset value; a second accumulation submodule, used to calculate the difference between the alignment penalty value and the node value when the node value is not the preset value, and accumulate the node value and the difference to obtain the accumulated node value; the first calculation submodule is used to calculate the dynamic time regularization integer value between each of the subsequences and the time series based on the accumulated node value.
[0020] Optionally, the determination device also includes: a second sorting module, which is used to sort all confidences after calculating the confidence of the time series with respect to each of the behavior cycles, when the confidences of all the behavior cycles are less than or equal to a preset parameter threshold, to obtain a confidence sorting result; a second determination module, which is used to determine the behavior cycle corresponding to the highest confidence in the confidence sorting result; a second expansion module, which is used to expand the behavior cycle corresponding to the highest confidence into a reference behavior cycle based on a preset expansion strategy; and a third calculation module, which is used to search for the behavior data of the target user within a preset time period according to the reference behavior cycle to calculate the confidence of the time series with respect to the reference behavior cycle.
[0021] Optionally, the behavior data includes at least one of the following: user identification, transaction type, transaction identification, transaction amount, transaction time, and transaction party account.
[0022] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned methods for determining a user behavior cycle.
[0023] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the above-described methods for determining a user behavior cycle.
[0024] In the present disclosure, the behavior data of the target user within a preset time period and a preset periodic sequence are obtained, and the time series is input into a preset periodic model to obtain a time-warping distance value, a time series length, and a behavior period. Based on the time-warping distance value, the time series length, and the behavior period, the confidence of the time series with respect to each behavior period is calculated. When the confidence of the target behavior period is greater than a preset parameter threshold, the target behavior period is determined to be the behavior period of the time series. In the present application, the confidence of the time series corresponding to the user's operation behavior can be calculated through a preset periodic model. When the confidence is greater than a preset threshold, the behavior period of the time series can be determined. For operation behaviors with behavior periods, functions that meet the user's actual operation needs can be recommended through terminal applications, thereby providing users with better services and improving user satisfaction, thereby solving the technical problem that the user's behavior period cannot be accurately mined in the related technology, resulting in the recommended application functions not meeting the user's actual usage needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0026] Figure 1 is a flow chart of an optional method for determining a user behavior period according to an embodiment of the present invention;
[0027] Figure 2 is a schematic diagram of an optional method of determining a user's periodic behavior according to an embodiment of the present invention;
[0028] Figure 3 is a schematic diagram of an optional device for determining a user behavior period according to an embodiment of the present invention;
[0029] Figure 4 It is a hardware structure block diagram of an electronic device (or mobile device) for determining a credit score value according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] To facilitate those skilled in the art to understand the present invention, some terms or nouns involved in the embodiments of the present invention are explained below:
[0033] Dynamic Time Warping (DTW) is a method to measure the similarity of two time series of different lengths. It is based on the idea of dynamic programming and solves the matching problem of two time series of different lengths. It is widely used in the field of isolated word recognition. It can automatically align two time series with similar trends and has strong noise resistance.
[0034] It should be noted that the method for determining the user behavior cycle and the device thereof in the present disclosure can be used in the field of financial technology when determining the user behavior cycle, and can also be used in any field other than the field of financial technology when determining the user behavior cycle. The present disclosure does not limit the application field of the method for determining the user behavior cycle and the device thereof.
[0035] 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 for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0036] The following embodiments of the present invention can be applied to various systems / applications / devices for determining user periodic behaviors. The present invention is used to mine the user's behavior cycle. The key problem of detecting the period of user behavior is the similarity measurement of time series. The character matching problem after symbolization of time series is generally measured by Hamming distance, but the Hamming distance requires that the two symbol sequences must be of equal length. Sequences of unequal lengths and inconsistent time intervals are not suitable for calculation using this method. In the problem of time series similarity measurement, it is almost impossible for two completely identical sequences to appear.
[0037] Therefore, the present invention adopts an improved dynamic time warping DTW method for measurement and adds constraints to user periodic mining. It can not only accurately mine the user's behavior cycles in these financial services (for example, the periodicity of transfer behavior), but also obtain the periodic patterns of behaviors with a small number of outliers and behaviors with multiple period intervals. It can well solve the problem of promoting financial functions and has high business value.
[0038] The present invention is described in detail below in conjunction with various embodiments.
[0039] Embodiment 1
[0040] According to an embodiment of the present invention, an embodiment of a method for determining a user behavior cycle is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0041] Figure 1 is a flow chart of an optional method for determining a user behavior cycle according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0042] Step S101, obtaining the behavior data of the target user within a preset time period and a preset period sequence, wherein the behavior data at least includes: a time series and an operation behavior corresponding to each time point in the time series, and the period sequence includes multiple behavior periods.
[0043] Step S102, input the time series into a preset period model to obtain a time regularization distance value, a time series length, and a behavior period.
[0044] Step S103, based on the time warping distance value, the time series length and the behavior period, calculate the confidence of the time series with respect to each behavior period.
[0045] Step S104: when the confidence of the target behavior cycle is greater than a preset parameter threshold, determine that the target behavior cycle is a behavior cycle of the time series.
[0046] Through the above steps, the behavior data of the target user within the preset time period and the preset periodic sequence can be obtained, and the time series can be input into the preset periodic model to obtain the time-warping distance value, the time series length and the behavior period. Based on the time-warping distance value, the time series length and the behavior period, the confidence of the time series with respect to each behavior period is calculated. When the confidence of the target behavior period is greater than the preset parameter threshold, the target behavior period is determined to be the behavior period of the time series. In an embodiment of the present invention, the confidence of the time series corresponding to the user's operation behavior can be calculated through a preset periodic model. When the confidence is greater than the preset threshold, the behavior period of the time series can be determined. For operation behaviors with behavior periods, functions that meet the actual operation needs of users can be recommended through terminal applications, so as to provide users with better services and improve user satisfaction, thereby solving the technical problem that the user's behavior period cannot be accurately mined in the related technology, resulting in the recommended application functions not meeting the actual usage needs of users.
[0047] The embodiment of the present invention is described in detail below in combination with the above steps.
[0048] Step S101, obtaining the behavior data of the target user within a preset time period and a preset period sequence, wherein the behavior data at least includes: a time series and an operation behavior corresponding to each time point in the time series, and the period sequence includes multiple behavior periods.
[0049] In an embodiment of the present invention, the behavior data of the target user within a preset time period (for example, the past year or the past six months) can be obtained. The behavior data includes a time series of user operation behaviors (for example, a time series consisting of dates of transfer behaviors), and each time point in the time series corresponds to an operation behavior. In addition, in this embodiment, the cycle sequence to be found can be pre-set (for example, Cycles[5,10,15,...,m / 2], where m represents the length of the time series). The cycle sequence contains multiple behavior cycles. In order to reduce the amount of calculation, the interval of the cycle sequence can be set to the initial cycle value (for example, the initial cycle value is set to 5). If no suitable cycle is found, the cycle is adjusted and the behavior cycle is further checked.
[0050] Optionally, the behavior data includes at least one of the following: user identification, transaction type, transaction identification, transaction amount, transaction time, and transaction party account.
[0051] Optionally, after obtaining the behavior data of the target user within a preset time period, the determination method further includes: deduplicating the behavior data; sorting the deduplicated behavior data according to time points to obtain behavior data sorted in time series.
[0052] In an embodiment of the present invention, after obtaining the behavior data of the target user within a preset time period, the obtained behavior data can be deduplicated (for example, removing duplicate transaction identifiers), and then the transaction time of the corresponding transaction of the user can be obtained based on the transaction identifier. After sorting the transaction time (that is, sorting the deduplicated behavior data according to time points), the behavior data sorted according to the time series can be obtained.
[0053] Optionally, after obtaining the behavior data of the target user within a preset time period, the determination method also includes: obtaining the start time node and the end time node in the time series; based on the start time node and the end time node, constructing an initial sequence that associates time nodes with node values, wherein in the initial sequence, all node values are assigned to preset values; when an operation occurs at the target time node, calculating the ratio between the time series length of the initial sequence (for the time series length of a certain sequence, the specific length value can be determined based on 1 minute (or 2 minutes, 10 minutes), such as for a time series of 2 hours, when the sequence scale is 2 minutes, the value of the time series length is 60) and the total number of times the operation occurs, and replacing the node value corresponding to the target time node with the ratio.
[0054] In an embodiment of the present invention, after sorting the time series, the first and last elements (i.e., the start time node and the end time node) in the time series can be obtained, which can be recorded as start_t ime and end_t ime. Based on the start time node and the end time node, an initial sequence from start_t ime to end_t ime is generated, all of which are preset values (for example, the preset value is set to 0 / 1) (that is, an initial sequence associating time nodes with node values is constructed, wherein, in the initial sequence, all node values are assigned to preset values). If an operation (for example, a transfer behavior) occurs in a node in the initial sequence (that is, when an operation occurs at a target time node), the ratio between the time series length of the initial sequence and the total number of times the operation occurs is calculated, and the node value corresponding to the target time node is replaced by the ratio, so as to obtain a time series that can be input into a preset period model.
[0055] Optionally, before inputting the time series into the preset period model, the determination method includes: obtaining user data of multiple users in a historical time period, wherein the user data includes at least: a user ID, a date on which the behavior occurred, and a transaction party account, the user ID is used to count the first number of times the user performs the operation, the date on which the behavior occurred is used to count the second number of times the operation occurred on each historical date, and the transaction party account is used to count the third number of times each user performs the operation using the same transaction party account; dividing the historical time period according to preset segmentation parameters to obtain multiple historical sub-time periods, and counting the fourth number of times the operation occurred in each historical sub-time period; determining user statistical data based on the first number, the second number, the third number, and the fourth number; and training the preset period model based on the user statistical data.
[0056] In an embodiment of the present invention, user data of multiple users in a historical period (e.g., in the past few years) may be obtained, and the user data may include: user identification, transaction type, transaction identification, transaction amount, date of occurrence of the behavior, transaction party account, etc. For example, taking the transfer type as an example, multiple users are randomly selected according to the user identification to obtain user data of the "transfer" type in the past year.
[0057] In this embodiment, based on the acquired user data, statistical methods can be used to try to analyze and mine some rules of user operation behaviors, and filter out data for training the cycle model. The following takes the transfer behavior as an example to count the data of this behavior.
[0058] In this embodiment, the number of times each user transfers money during a selected historical time period can be analyzed based on the user ID (i.e., the user ID is used to count the first number of times the user performs an operation), and it can be determined that users who transfer money very frequently are very active users of the financial institution.
[0059] In this embodiment, the number of transfers occurring on each date can be counted based on the date on which the behavior occurred, and whether the user's transfer behavior is related to the date can be analyzed (i.e., the date on which the behavior occurred is used to count the second number of times the operation behavior occurred on each historical date).
[0060] In this embodiment, the transaction party account can be used to count the number of times each user transfers money to the same person within the selected historical time period (that is, the transaction party account is used to count the third time each user uses the same transaction party account to perform operations).
[0061] In this embodiment, the historical time period can be divided according to preset segmentation parameters to obtain multiple historical sub-time periods (for example, the historical time period is divided into the beginning of the month, the middle of the month, and the end of the month, where if the transfer date is between the 1st and the 10th, the transaction is recorded as a transaction at the beginning of the month, similarly, between the 11th and the 20th are recorded as mid-month transactions, and between the 21st and the end of the month are recorded as end-of-month transactions), and the fourth number of operation behaviors occurring in each historical sub-time period is counted (for example, the number of transfers made by the user at the beginning of the month, the middle of the month, and the end of the month, respectively).
[0062] In this embodiment, user statistical data can be determined based on the obtained statistical times (including the first number, the second number, the third number, the fourth number, etc.), and then the preset period model can be trained based on the user statistical data.
[0063] In this embodiment, the total number of operations involving fixed-interval transaction durations can be counted. For example, for a transfer behavior that occurs at an interval of 2 days, the behavior is recorded once each time it occurs, and the number of all transfer behaviors that occur at an interval of 2 days is accumulated to obtain the total number of transfer behaviors that occur at an interval of 2 days.
[0064] Optionally, after obtaining these user statistical data, the obtained data can be deduplicated (for example, removing duplicate user IDs), and then the user's operation behavior data and corresponding transaction time can be obtained based on the user ID, and the transaction time can be sorted to obtain a time series for training the periodic model.
[0065] Step S102, input the time series into a preset period model to obtain a time regularization distance value, a time series length, and a behavior period.
[0066] Optionally, the time series is input into a preset period model to obtain a time warping distance value, a time series length, and a behavior period, including: using a preset period model to divide the time series according to a preset period interval to obtain multiple subsequences; expanding each subsequence according to the time progress so that the time length of the subsequence is the same as the time length of the time series; calculating the dynamic time warping integer value between each subsequence and the time series; and representing the minimum dynamic time warping integer value as a time warping distance value.
[0067] In the embodiment of the present invention, after determining the cycle sequence to be found (Cycles[5,10,15,...,m / 2], where m represents the length of the time sequence), the user's time sequence S (s1,s2,...,s m ), and the number of times the operation occurs is recorded as n. Optionally, in this embodiment, the preset cycle sequence Cycles can be traversed to obtain one of the values cycle i (i.e., the duration of a certain period interval), the time series is divided according to the duration of the period interval to obtain multiple subsequences S, (s1,...,s cycle ), lengthen the subsequence to make it the same length as the time series S, and obtain the sequence R(s1,...,s cycle ,s1,...,s cycle ...) (i.e., each subsequence is extended in time so that the time length of the subsequence is the same as the time length of the time series).
[0068] This embodiment can use the improved dynamic time warping algorithm DTW to calculate the dynamic time warping integer value between each subsequence R and the time series S, represent the minimum dynamic time warping integer value as the time warping distance value, and record the current period interval length (ie, the behavior period).
[0069] Optionally, the step of calculating the dynamic time gauge integer value between each subsequence and the time series includes: obtaining the node value corresponding to each time node in the subsequence; when the node value is a preset value, accumulating the node value and a preset alignment penalty value to obtain an accumulated node value; when the node value is not a preset value, calculating the difference between the alignment penalty value and the node value, and accumulating the node value and the difference to obtain the accumulated node value; based on the accumulated node value, calculating the dynamic time gauge integer value between each subsequence and the time series.
[0070] In the embodiment of the present invention, the calculation process of the original DTW algorithm is:
[0071] Given two time series r and s of length n and m respectively, first create an m×n matrix D, where the element cell(i,j) in D is r i With sj The calculation formula (1) of the original DTW algorithm is as follows:
[0072]
[0073] Among them, cell(i-1,j), cell(i-1,j-1), and cell(i,j-1) represent the previous element of cell l(i,j), and d(i,j) is r i With s j distance.
[0074] The path from the element cell (1, 1) to the element cell (n, n) is W = w1, w2, ..., w K , K is the number of paths, called curved paths. From the DTW distance matrix D, we can see that there are many curved paths. The goal of DTW calculation is to find the path with the smallest total length among the curved paths, as shown in the following formula (2):
[0075]
[0076] The DTW algorithm can automatically align sequences and, by filling in, calculate a smaller distance for sequences with similar trends. However, for actual problem scenarios, the original DTW algorithm's automatic alignment method may result in larger errors in calculating the period. For example, if there is no periodic user operation behavior, the original DTW algorithm's automatic alignment feature will calculate the distance to be 0, leading to the conclusion that the user's operation behavior is periodic, which is obviously incorrect.
[0077] Therefore, this embodiment adopts an improved DTW algorithm to calculate the dynamic time warping integer value between each subsequence and the time series, specifically:
[0078] The DTW algorithm is improved. When performing padding alignment, the previous time node is not filled in, but a fixed constant L is filled in. From the calculation results, a penalty term is added to the distance during alignment. Specifically, after obtaining the node value corresponding to each time node in the subsequence, if the node value is a preset value (for example, 0), the node value and the preset alignment penalty value L are accumulated to obtain the accumulated node value; if the node value is not a preset value (assuming that the node value is Q), the difference between the alignment penalty value and the node value (|LQ|) is calculated, and the node value and the difference are accumulated to obtain the accumulated node value. Then, based on the accumulated node value, the dynamic time regularization integer value between each subsequence and the time series is calculated. The use of the improved DTW algorithm can make the calculated distance more consistent with the actual situation, so as to more accurately find users with periodicity. The modified distance calculation formula (3) is as follows:
[0079]
[0080] Among them, cell(i-1,j), cell(i-1,j-1), and cell(i,j-1) represent the previous element of cell l(i,j), and d(i,L) represents the previous element of r i The distance from L, d(i,j) is r i With s j d(L,j) represents the distance between L and s j distance, L is a fixed constant, r i With s j are the values of an element in the two sequences respectively.
[0081] Step S103, based on the time warping distance value, the time series length and the behavior period, calculate the confidence of the time series with respect to each behavior period.
[0082] In the embodiment of the present invention, after obtaining the time warping distance value DTW(R, S), the confidence of the time series with respect to each behavior cycle can be calculated by combining the time series length and the behavior cycle using the following formula (4), wherein the confidence of the cycle indicates that a periodic pattern must appear continuously for a certain number of times before the time series is considered to be periodic. When a certain periodic pattern appears frequently, DTW(R, S) tends to 0 and the confidence tends to 1, indicating that this cycle is the most reliable. Due to noise or other influences, DTW(R, S) will increase and the confidence tends to 0. The confidence conf calculation formula (4) is as follows:
[0083]
[0084] Where n represents the length of the time series, p represents the current behavior period, and DTW(R,S) represents the time warping distance value.
[0085] Step S104: when the confidence of the target behavior cycle is greater than a preset parameter threshold, determine that the target behavior cycle is a behavior cycle of the time series.
[0086] In the embodiment of the present invention, when the confidence of the target behavior cycle is greater than a preset parameter threshold (eg, 0.8), the target behavior cycle can be determined to be a behavior cycle of the time series, and the traversal of the cycle sequence is terminated.
[0087] Optionally, after calculating the confidence of the time series with respect to each behavior cycle, the determination method also includes: when the confidence of all behavior cycles is less than or equal to a preset parameter threshold, sorting all confidences to obtain a confidence sorting result; determining the behavior cycle corresponding to the highest confidence in the confidence sorting result; based on a preset expansion strategy, expanding the behavior cycle corresponding to the highest confidence to a reference behavior cycle; searching for the behavior data of the target user within a preset time period according to the reference behavior cycle to calculate the confidence of the time series with respect to the reference behavior cycle.
[0088] In the embodiment of the present invention, when the confidences of all behavior cycles are less than or equal to the preset parameter threshold, it means that the cycle sequence does not contain a suitable cycle and needs to be checked in detail, specifically: sorting all confidences to obtain a confidence sorting result; determining the behavior cycle corresponding to the highest confidence in the confidence sorting result (that is, determining the behavior cycle as the current optimal cycle cycle); best ), based on the preset expansion strategy, the behavior cycle corresponding to the highest confidence is expanded to the reference behavior cycle (for example, the current optimal cycle cycle best , expand the search range and obtain the reference behavior cycle (cycle best-4 ,...,cycle best-4 ,...,cycle best+4 )), search for the target user's behavior data within a preset time period according to the reference behavior cycle to calculate the confidence of the time series with respect to the reference behavior cycle. When the highest confidence is greater than a certain threshold (for example, 0.7, which can be lower than the previously set confidence threshold), it is determined that the time series has a period, otherwise it is considered that the series does not have periodicity.
[0089] Figure 2 is a schematic diagram of an optional method for determining a user's periodic behavior according to an embodiment of the present invention. Figure 2 As shown, for a certain transfer scenario, the user can transfer money through the transfer system on the terminal (for example, a mobile phone). When the user transfers money, it can be determined whether the user's historical behavior is periodic and timeliness is high. Therefore, the label of each user can be generated before the transfer system is called and stored in the server. When the transfer system is called, it is equivalent to a table lookup process. The specific process is as follows:
[0090] Obtain user historical data (including user ID, transaction party account, transaction time, consumption behavior, etc.), and calculate the historical behavior sequence of each user (the obtained user historical data can be input into the improved DTW algorithm for calculation), store the obtained results in the user periodic behavior table (the table includes user ID and transaction party account, and whether it is periodic), and label the user (for example, 1: periodic; 0: no periodicity); when the user uses the transfer system to transfer money, obtain the user ID and transaction party account, and search the user periodic behavior table based on these two indexes to obtain the user label, and determine whether it is periodic based on the label. If the result is that it is periodic, push the "book transfer" function to the customer to meet user needs and improve user stickiness.
[0091] The embodiment of the present invention proposes a method for mining user behavior cycles based on an improved DTW algorithm. By improving the distance formula of the DTW algorithm and adding constraints to the periodic mining of user behavior, it is not only possible to accurately find the strong periodic patterns of user behavior, but also has a good effect on periodic sequences and multi-periodic sequences containing noise, thereby better serving users and having high business value.
[0092] Embodiment 2
[0093] The device for determining a user behavior cycle provided in this embodiment includes multiple implementation units, each of which corresponds to each implementation step in the above-mentioned embodiment 1.
[0094] Figure 3 is a schematic diagram of an optional device for determining a user behavior cycle according to an embodiment of the present invention, such as Figure 3 As shown, the determination device may include: an acquisition unit 30, an input unit 31, a calculation unit 32, and a determination unit 33, wherein:
[0095] The acquisition unit 30 is used to acquire the behavior data of the target user within a preset time period and a preset period sequence, wherein the behavior data at least includes: a time series and an operation behavior corresponding to each time point in the time series, and the period sequence includes multiple behavior periods;
[0096] An input unit 31, used to input the time series into a preset period model to obtain a time-warping distance value, a time series length, and a behavior period;
[0097] A calculation unit 32, for calculating the confidence of the time series with respect to each behavior period based on the time warping distance value, the time series length and the behavior period;
[0098] The determination unit 33 is configured to determine that the target behavior cycle is a behavior cycle of the time series when the confidence level of the target behavior cycle is greater than a preset parameter threshold.
[0099] The above-mentioned determination device can obtain the behavior data of the target user within a preset time period and a preset period sequence through the acquisition unit 30, input the time sequence into the preset period model through the input unit 31, obtain the time-warping distance value, the time series length and the behavior cycle, calculate the confidence of the time series with respect to each behavior cycle based on the time-warping distance value, the time series length and the behavior cycle through the calculation unit 32, and determine the target behavior cycle as the behavior cycle of the time series when the confidence of the target behavior cycle is greater than the preset parameter threshold through the determination unit 33. In an embodiment of the present invention, the confidence of the time series corresponding to the user's operation behavior can be calculated through a preset period model, and when the confidence is greater than the preset threshold, the behavior cycle of the time series can be determined. For operation behaviors with behavior cycles, functions that meet the actual operation needs of users can be recommended through terminal applications, so as to provide users with better services and improve user satisfaction, thereby solving the technical problem that the user's behavior cycle cannot be accurately excavated in the related technology, resulting in the recommended application functions not meeting the actual use needs of users.
[0100] Optionally, the determination device also includes: a first deduplication module, used to deduplicate the behavior data after obtaining the behavior data of the target user within a preset time period; a first sorting module, used to sort the deduplicated behavior data according to time points to obtain behavior data sorted in time series.
[0101] Optionally, the determination device also includes: a first acquisition module, used to obtain the start time node and the end time node in the time series after obtaining the behavior data of the target user within a preset time period; a first construction module, used to construct an initial sequence of time nodes and node values based on the start time node and the end time node, wherein, in the initial sequence, all node values are assigned to preset values; a first calculation module, used to calculate the ratio between the time series length of the initial sequence and the total number of times the operation behavior occurs when an operation behavior occurs at the target time node, and replace the node value corresponding to the target time node with the ratio.
[0102] Optionally, the determination device includes: a second acquisition module, used to obtain user data of multiple users in a historical time period before inputting the time series into a preset periodic model, wherein the user data includes at least: a user ID, a date on which the behavior occurs, and a transaction party account, the user ID is used to count the first number of times the user performs the operation, the date on which the behavior occurs is used to count the second number of times the operation occurs on each historical date, and the transaction party account is used to count the third number of times each user performs the operation using the same transaction party account; a first statistical module, used to divide the historical time period according to preset segmentation parameters to obtain multiple historical sub-time periods, and count the fourth number of times the operation occurs in each historical sub-time period; a first determination module, used to determine user statistical data based on the first number, the second number, the third number and the fourth number; and a first training module, used to train the preset periodic model based on the user statistical data.
[0103] Optionally, the input unit includes: a first division module, used to adopt a preset period model to divide the time series according to preset period intervals to obtain multiple subsequences; a first expansion module, used to expand each subsequence according to the time progress so that the time length of the subsequence is the same as the time length of the time series; a second calculation module, used to calculate the dynamic time regularization integer value between each subsequence and the time series; a first characterization module, used to characterize the minimum dynamic time regularization integer value as a time regularization distance value.
[0104] Optionally, the second calculation module includes: a first acquisition submodule, used to obtain the node value corresponding to each time node in the subsequence; a first accumulation submodule, used to accumulate the node value and a preset alignment penalty value to obtain the accumulated node value when the node value is a preset value; a second accumulation submodule, used to calculate the difference between the alignment penalty value and the node value when the node value is not a preset value, and accumulate the node value and the difference to obtain the accumulated node value; the first calculation submodule is used to calculate the dynamic time regularization integer value between each subsequence and the time series based on the accumulated node value.
[0105] Optionally, the determination device also includes: a second sorting module, which is used to sort all confidences after calculating the confidence of the time series with respect to each behavior period, when the confidences of all behavior periods are less than or equal to a preset parameter threshold, to obtain a confidence sorting result; a second determination module, which is used to determine the behavior period corresponding to the highest confidence in the confidence sorting result; a second expansion module, which is used to expand the behavior period corresponding to the highest confidence to a reference behavior period based on a preset expansion strategy; and a third calculation module, which is used to search for the behavior data of the target user within a preset time period according to the reference behavior period to calculate the confidence of the time series with respect to the reference behavior period.
[0106] Optionally, the behavior data includes at least one of the following: user identification, transaction type, transaction identification, transaction amount, transaction time, and transaction party account.
[0107] The above-mentioned determination device may also include a processor and a memory. The above-mentioned acquisition unit 30, input unit 31, calculation unit 32, determination unit 33, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0108] The processor includes a kernel, and the kernel retrieves the corresponding program unit from the memory. One or more kernels can be set, and the target behavior cycle is determined to be the behavior cycle of the time series by adjusting the kernel parameters.
[0109] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one storage chip.
[0110] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes the following method steps: obtaining the behavior data of the target user within a preset time period and a preset period sequence, inputting the time series into a preset period model, obtaining a time-warping distance value, a time series length, and a behavior period, and calculating the confidence of the time series with respect to each behavior period based on the time-warping distance value, the time series length, and the behavior period, and when the confidence of the target behavior period is greater than a preset parameter threshold, determining that the target behavior period is the behavior period of the time series.
[0111] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any of the above-mentioned methods for determining a user behavior cycle.
[0112] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors implement any of the above-mentioned methods for determining a user behavior cycle.
[0113] Figure 4 is a hardware structure block diagram of an electronic device (or mobile device) for determining a user behavior cycle according to an embodiment of the present invention. Figure 4As shown, the electronic device may include one or more (102a, 102b, ..., 102n are used to illustrate) processors (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 4 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 4 More or fewer components as shown, or with Figure 4 Different configurations are shown.
[0114] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0115] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0116] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0117] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0118] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0119] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0120] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for determining a user behavior cycle, characterized in that: include: Obtaining the target user's behavior data within a preset time period and a preset period sequence, wherein the behavior data at least includes: a time series and an operation behavior corresponding to each time point in the time series, and the period sequence includes multiple behavior periods; Input the time series into a preset period model to obtain a time-warping distance value, a time series length, and the behavior period, including: using the preset period model to divide the time series according to the preset period interval to obtain multiple subsequences; expanding each subsequence according to the time progress so that the time length of the subsequence is the same as the time length of the time series; calculating the dynamic time-warping integer value between each subsequence and the time series; representing the minimum dynamic time-warping integer value as the time-warping distance value; wherein the step of calculating the dynamic time-warping integer value between each subsequence and the time series includes: obtaining the node value corresponding to each time node in the subsequence; when the node value is a preset value, accumulating the node value and a preset alignment penalty value to obtain an accumulated node value; when the node value is not the preset value, calculating the difference between the alignment penalty value and the node value, and accumulating the node value and the difference to obtain an accumulated node value; based on the accumulated node value, calculating the dynamic time-warping integer value between each subsequence and the time series; Based on the time warping distance value, the length of the time series and the behavior period, calculating the confidence of the time series with respect to each of the behavior periods; In the case where the confidence of the target behavior cycle is greater than a preset parameter threshold, determining the target behavior cycle as the behavior cycle of the time series; Before inputting the time series into the preset period model, the determination method includes: obtaining user data of multiple users in a historical time period, wherein the user data includes at least: user identification, behavior occurrence date, and transaction party account, the user identification is used to count the first number of times the user performs the operation behavior, the behavior occurrence date is used to count the second number of times the operation behavior occurs on each historical date, and the transaction party account is used to count the third number of times each user uses the same transaction party account to perform the operation behavior; dividing the historical time period according to preset segmentation parameters to obtain multiple historical sub-time periods, and counting the fourth number of times the operation behavior occurs in each of the historical sub-time periods; determining user statistical data based on the first number, the second number, the third number, and the fourth number; and training the preset period model based on the user statistical data.
2. The determination method according to claim 1, characterized in that: After obtaining the behavior data of the target user within a preset time period, the determination method further includes: Deduplication processing is performed on the behavior data; The behavior data after deduplication processing is sorted according to time points to obtain the behavior data sorted according to time series.
3. The determination method according to claim 1, characterized in that: After obtaining the behavior data of the target user within a preset time period, the determination method further includes: Obtaining a start time node and an end time node in the time series; Based on the start time node and the end time node, construct an initial sequence of time nodes and node values, wherein in the initial sequence, all the node values are assigned to preset values; When the operation behavior occurs at the target time node, the ratio between the time series length of the initial sequence and the total number of times the operation behavior occurs is calculated, and the node value corresponding to the target time node is replaced by the ratio.
4. The determination method according to claim 1, characterized in that: After calculating the confidence of the time series with respect to each of the behavior cycles, the determination method further comprises: When the confidences of all the behavior cycles are less than or equal to a preset parameter threshold, all confidences are sorted to obtain a confidence sorting result; Determining the behavior period corresponding to the highest confidence in the confidence ranking results; Based on the preset expansion strategy, the behavior cycle corresponding to the highest confidence level is expanded to the reference behavior cycle; The behavior data of the target user within a preset time period is searched according to the reference behavior cycle to calculate the confidence of the time series with respect to the reference behavior cycle.
5. The determination method according to any one of claims 1 to 4, characterized in that: The behavior data includes at least one of the following: user identification, transaction type, transaction identification, transaction amount, transaction time, and transaction party account.
6. A device for determining a user behavior cycle, characterized in that: include: An acquisition unit is used to acquire the behavior data of the target user within a preset time period and a preset period sequence, wherein the behavior data at least includes: a time sequence and an operation behavior corresponding to each time point in the time sequence, and the period sequence includes multiple behavior cycles; An input unit, used to input the time series into a preset period model to obtain a time-warping distance value, a time series length, and the behavior period; A calculation unit, configured to calculate the confidence of the time series with respect to each behavior period based on the time warping distance value, the time series length and the behavior period; a determination unit, configured to determine, when the confidence level of the target behavior period is greater than a preset parameter threshold, that the target behavior period is the behavior period of the time series; The determination device comprises: a second acquisition module, used for obtaining user data of multiple users in a historical time period before inputting the time series into a preset periodic model, wherein the user data comprises at least: a user identifier, a date of occurrence of the behavior, and a transaction party account, wherein the user identifier is used for counting the first number of times the user performs the operation behavior, the date of occurrence of the behavior is used for counting the second number of times the operation behavior occurs on each historical date, and the transaction party account is used for counting the third number of times each user uses the same transaction party account to perform the operation behavior; a first statistics module, used for dividing the historical time period according to preset segmentation parameters to obtain multiple historical sub-time periods, and counting the fourth number of times the operation behavior occurs in each of the historical sub-time periods; a first determination module, used for determining user statistical data based on the first number, the second number, the third number, and the fourth number; a first training module, used for training the preset periodic model based on the user statistical data; The input unit includes: a first division module, used to adopt the preset period model to divide the time series according to the preset period interval length to obtain multiple subsequences; a first expansion module, used to expand each of the subsequences according to the time progress so that the time length of the subsequence is the same as the time length of the time series; a second calculation module, used to calculate the dynamic time regularization integer value between each of the subsequences and the time series; a first characterization module, used to characterize the minimum dynamic time regularization integer value as the time regularization distance value; The second calculation module includes: a first acquisition submodule, used to obtain the node value corresponding to each time node in the subsequence; a first accumulation submodule, used to accumulate the node value and a preset alignment penalty value to obtain an accumulated node value when the node value is a preset value; a second accumulation submodule, used to calculate the difference between the alignment penalty value and the node value when the node value is not the preset value, and accumulate the node value and the difference to obtain the accumulated node value; the first calculation submodule is used to calculate the dynamic time regularization integer value between each of the subsequences and the time series based on the accumulated node value.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for determining the user behavior cycle according to any one of claims 1 to 5.
8. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for determining the user behavior cycle as described in any one of claims 1 to 5.