Time series-based user clustering method and apparatus, electronic device, and medium
By employing a time-series-based user clustering method, utilizing bidirectional long short-term memory networks and multi-head attention mechanisms for feature extraction and clustering, the problem of low clustering accuracy in existing technologies is solved, achieving higher-precision user group identification and classification.
Patent Information
- Application Number
- CN202310585699.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-22
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2043-05-22
AI Technical Summary
Existing data clustering methods in the financial field cannot effectively take into account the patterns and changes in data, resulting in low clustering accuracy.
A time-series-based user clustering method is adopted. By acquiring user behavior data, a multi-dimensional matrix space is constructed. Global feature extraction is performed using bidirectional long short-term memory networks and fully connected networks. Partial feature extraction is performed by combining multi-head attention mechanism. User clustering is performed using preset data dimensionality reduction and clustering algorithms. A multi-classification model is trained to improve clustering accuracy.
It improves the accuracy of user clustering in the fintech field, enabling better identification and classification of user groups and enhancing the precision of data clustering.
Smart Images

Figure CN116610965B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of financial technology and artificial intelligence, and in particular to a time-series-based user clustering method, apparatus, electronic device, and storage medium. Background Technology
[0002] In many different marketing scenarios within the financial sector, there is a need to segment financial customers. For example, in electronic transactions, similar customers can be identified to design corresponding marketing campaigns or products. This requires clustering customers based on relevant data and then making recommendations based on the clustering results. However, existing data clustering methods typically group similar customers or customer data together by calculating the Euclidean distance of features across various dimensions. This method fails to account for data patterns and variations, resulting in insufficient accuracy in the final clustering. Therefore, there is an urgent need to propose a more accurate data clustering method. Summary of the Invention
[0003] This invention provides a time-series-based user clustering method, apparatus, electronic device, and storage medium, the main purpose of which is to improve the accuracy of data clustering in the fintech field.
[0004] To achieve the above objectives, the present invention provides a user clustering method based on time series, comprising:
[0005] Obtain user behavior data corresponding to the user cluster, take the data whose data duration meets the preset target time period as standard behavior data, extract the category feature data in the standard behavior data, and encode the category feature data to obtain the category feature vector.
[0006] Identify the dimensionality of the category feature vector, convert the remaining data in the user behavior data after removing the category feature data into a remaining data vector with the same dimensionality as the category feature vector, and construct a multidimensional matrix space based on the remaining data vector and the category feature vector;
[0007] A global feature extraction model is constructed based on a bidirectional long short-term memory network and a fully connected network. The global feature extraction model is then used to extract global features from the multidimensional matrix space to obtain multiple global feature data. The multiple global feature data are then concatenated to obtain a global concatenated vector.
[0008] A partial feature extraction model is constructed based on the multi-head attention mechanism and the fully connected network. The partial feature extraction model is then used to extract partial features from the multi-dimensional matrix space to obtain multiple partial feature data. Data connection processing is then performed on the multiple partial feature data to obtain a partial connection vector.
[0009] The global concatenation vector and the partial connection vector are concatenated to obtain the final feature vector. The final feature vector is then reduced in dimensionality using a preset data dimensionality reduction algorithm to obtain dimensionality-reduced feature data. Based on the user's basic attribute features, the dimensionality-reduced feature data, and a preset clustering algorithm, the user cluster is subjected to user clustering to obtain the first user clustering result.
[0010] A preset multi-classification model is trained using the first user clustering result to obtain a standard multi-classification model. Data in the user behavior data whose data duration does not conform to the preset target time period is input into the standard multi-classification model to obtain a second user clustering result. The first user clustering result and the second user clustering result are then summarized and processed to obtain the final user clustering result.
[0011] Optionally, the step of encoding the category feature data to obtain a category feature vector includes:
[0012] The category feature data is aggregated to obtain the total number of category features;
[0013] An initial matrix vector is constructed using the category feature data as the number of rows in a preset matrix and the total number of category features as the number of columns in the preset matrix.
[0014] The column number corresponding to the category feature data in the initial matrix vector is set as the first value, and the remaining column numbers are set as the second value to obtain the category feature vector.
[0015] Optionally, the global feature extraction model is used to perform global feature extraction on the multidimensional matrix space to obtain multiple global feature data, including:
[0016] The adjusted global feature extraction model is obtained by sequentially using one of the preset reference settings as the dimension of the hidden layer in the global feature extraction model.
[0017] The multidimensional matrix space is input into the adjusted global feature extraction model to obtain the global feature data corresponding to the multidimensional matrix space;
[0018] Multiple global feature data are obtained by summarizing the global feature data corresponding to each of the reference settings.
[0019] Optionally, the step of inputting the multidimensional matrix space into the adjusted global feature extraction model to obtain the global feature data corresponding to the multidimensional matrix space includes:
[0020] The state values of the multidimensional matrix space are calculated through the input gate of the bidirectional long short-term memory network in the adjusted global feature extraction model.
[0021] The activation value of the multidimensional matrix space is calculated through the forgetting gate of the bidirectional long short-term memory network in the adjusted global feature extraction model.
[0022] Calculate the state update value of the multidimensional matrix space based on the state value and the activation value;
[0023] The global feature data corresponding to the state update value is calculated using the output gate of the bidirectional long short-term memory network in the adjusted global feature extraction model.
[0024] Optionally, the step of using a preset data dimensionality reduction algorithm to reduce the dimensionality of the final feature vector to obtain dimensionality-reduced feature data includes:
[0025] Obtain the number and dimension of the final feature vector;
[0026] The final feature vectors are arranged column-wise to form a final matrix with the number of columns being the number of features and the dimension being the number of rows.
[0027] Each row of the final matrix is zero-mean normalized to obtain the first matrix;
[0028] The covariance matrix is obtained based on the first matrix, and the eigenvalues and corresponding eigenvectors of the covariance matrix are calculated.
[0029] The feature vectors are arranged in rows from top to bottom according to the magnitude of the feature values to form a feature matrix, and the first preset number of rows in the feature matrix are taken to form a second matrix;
[0030] Multiply the first matrix and the second matrix to obtain dimensionality-reduced feature data.
[0031] Optionally, the step of training a preset multi-classification model using the clustering results of the first user to obtain a standard multi-classification model includes:
[0032] Different clustered users in the first user clustering result are labeled to obtain multiple labeled clustered users;
[0033] The preset multi-classification model is trained by using multiple labeled clustered users as training data to obtain a standard multi-classification model.
[0034] Optionally, the step of performing user clustering processing on the user cluster based on the user's basic attribute features, the dimensionality reduction feature data, and a preset clustering algorithm to obtain a first user clustering result includes:
[0035] The user's basic attribute features are concatenated with the dimensionality-reduced feature data to obtain the final concatenated data.
[0036] The clustering algorithm is used to cluster the final spliced data to obtain the first user clustering result.
[0037] To address the above problems, the present invention also provides a time-series-based user clustering device, the device comprising:
[0038] The data processing module is used to acquire user behavior data corresponding to the user cluster, take data whose data duration conforms to a preset target time period as standard behavior data, extract category feature data from the standard behavior data, encode the category feature data to obtain a category feature vector, identify the dimension of the category feature vector, convert the remaining data in the user behavior data after removing the category feature data into a remaining data vector with the same dimension as the category feature vector, and construct a multidimensional matrix space based on the remaining data vector and the category feature vector.
[0039] The global feature extraction module is used to construct a global feature extraction model based on a bidirectional long short-term memory network and a fully connected network, and to use the global feature extraction model to extract global features from the multidimensional matrix space to obtain multiple global feature data. The multiple global feature data are then concatenated to obtain a global concatenated vector.
[0040] A partial feature extraction module is used to construct a partial feature extraction model based on the multi-head attention mechanism and the fully connected network, and to use the partial feature extraction model to extract partial features from the multi-dimensional matrix space to obtain multiple partial feature data. The multiple partial feature data are then processed by data connection to obtain a partial connection vector.
[0041] The user clustering module is used to concatenate the global splicing vector and the partial connection vector to obtain a final feature vector. A preset data dimensionality reduction algorithm is then used to reduce the dimensionality of the final feature vector to obtain dimensionality-reduced feature data. Based on the user's basic attribute features, the dimensionality-reduced feature data, and the preset clustering algorithm, user clustering is performed on the user cluster to obtain a first user clustering result. A preset multi-classification model is trained using the first user clustering result to obtain a standard multi-classification model. Data from the user behavior data whose duration does not conform to the preset target time period is input into the standard multi-classification model to obtain a second user clustering result. Finally, the first user clustering result and the second user clustering result are summarized to obtain the final user clustering result.
[0042] To address the above problems, the present invention also provides an electronic device, the electronic device comprising:
[0043] At least one processor; and,
[0044] A memory communicatively connected to the at least one processor; wherein,
[0045] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the time-series-based user clustering method described above.
[0046] To address the aforementioned problems, the present invention also provides a storage medium storing at least one computer program, which is executed by a processor in an electronic device to implement the time-series-based user clustering method described above.
[0047] In this embodiment of the invention, based on the fact that user behavior data in electronic transactions involves multiple dimensions, such as the type and quantity of traded products, the amount involved, the transaction time, buying, selling, and exchanging, a multi-dimensional matrix space of user behavior data in electronic transactions is constructed to cover the diversity of user behavior data. The global concatenation vector and partial connection vectors corresponding to the multi-dimensional matrix space are further extracted to obtain the final feature vector. Then, a clustering algorithm is used to perform user clustering processing to obtain the first user clustering result. A multi-classification model is trained to obtain a standard multi-classification model, which allows the model to cluster data whose data duration does not conform to a preset target time period, resulting in a second user clustering result. The first and second user clustering results are then combined to obtain the final user clustering result. The final user clustering result is more accurate. Therefore, the time-series-based user clustering method, device, electronic device, and storage medium proposed in this invention can solve the problem of low accuracy in time-series-based user clustering in the financial technology field. Attached Figure Description
[0048] Figure 1 This is a flowchart illustrating a time-series-based user clustering method according to an embodiment of the present invention.
[0049] Figure 2 for Figure 1 A detailed implementation flowchart of one of the steps;
[0050] Figure 3 This is a functional block diagram of a time-series-based user clustering device provided in an embodiment of the present invention;
[0051] Figure 4This is a schematic diagram of the structure of an electronic device that implements the time-series-based user clustering method according to an embodiment of the present invention.
[0052] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0053] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0054] This application provides a time-series-based user clustering method. The execution entity of the time-series-based user clustering method includes, but is not limited to, at least one of the following: a server, a terminal, or an electronic device that can be configured to execute the method provided in this application. In other words, the time-series-based user clustering method can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cloud server cluster. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0055] Reference Figure 1 The diagram shown illustrates a flowchart of a time-series-based user clustering method according to an embodiment of the present invention. In this embodiment, the time-series-based user clustering method includes the following steps S1-S6:
[0056] S1. Obtain user behavior data corresponding to the user cluster, take the data whose data duration conforms to the preset target time period as standard behavior data, extract the category feature data in the standard behavior data, and encode the category feature data to obtain the category feature vector.
[0057] In this embodiment of the invention, the multiple users in the user cluster can be customers in marketing scenarios in the financial field or users participating in electronic transactions in the fintech field. The user behavior data refers to all purchase data of each customer from the time of registration to the present, such as what products were purchased, the quantity, the amount, and the time. Each data has its own data duration, that is, the time from the customer's registration to the expiration date. For new customers, the purchase behavior data is too small, which will increase the noise of subsequent models. Therefore, it is necessary to use the data in the user behavior data whose data duration meets the preset target time period as standard behavior data, wherein the preset target time period is six months.
[0058] In detail, since the user behavior data contains different data, such as financial product category data or financial product quantity data, category feature data is extracted from the standard behavior data and the category feature data is discretized.
[0059] Preferably, to better understand the role of the category feature data, it can be encoded. Encoding the category feature data can employ methods such as one-hot encoding, target encoding, and Bayesian target encoding; however, this invention utilizes one-hot encoding.
[0060] Specifically, refer to Figure 1 As shown, the process of encoding the category feature data to obtain the category feature vector includes the following steps S21-S23:
[0061] S21. Summarize the category feature data to obtain the total number of category features;
[0062] S22. Construct an initial matrix vector using the category feature data as the number of rows in a preset matrix and the total number of category features as the number of columns in the preset matrix;
[0063] S23. Set the column number corresponding to the category feature data in the initial matrix vector to the first value, and the remaining column numbers to the second value to obtain the category feature vector.
[0064] Wherein, the first value is 1, and the second value is 0.
[0065] For example, suppose there are only 10 types of financial products, with each dimension corresponding to one type of financial product. The type of financial product purchased is transformed into a 10-dimensional vector. If a certain type of financial product is purchased, it is marked as 1 in the corresponding dimension, otherwise it is marked as 0.
[0066] S2. Identify the dimension of the category feature vector, convert the remaining data in the user behavior data after removing the category feature data into a remaining data vector with the same dimension as the category feature vector, and construct a multidimensional matrix space based on the remaining data vector and the category feature vector.
[0067] In this embodiment of the invention, it is necessary to record the data features of the user behavior data after removing the category feature data using a vector of the same size and dimension. Therefore, it is necessary to first identify the dimension of the category feature vector and convert the remaining data in the user behavior data after removing the category feature data into a remaining data vector with the same dimension as the category feature vector.
[0068] For example, the category feature vector has a dimension of 10, so the remaining data in the user behavior data, such as product purchase data or product transaction amount, are transformed according to the dimension of the 10-dimensional vector.
[0069] Specifically, a multidimensional matrix space is constructed based on the remaining data vector and the category feature vector. For example, for a 100*20*12 multidimensional matrix space, 100 in the multidimensional matrix space represents 100 users, 20 represents the aforementioned product purchase information, which can be product purchase data or product transaction amount, and 12 represents data recorded for 12 months.
[0070] S3. Construct a global feature extraction model based on a bidirectional long short-term memory network and a fully connected network, and use the global feature extraction model to extract global features from the multidimensional matrix space to obtain multiple global feature data. Perform data concatenation on the multiple global feature data to obtain a global concatenation vector.
[0071] In this embodiment of the invention, the bidirectional long short-term memory network is a type of recurrent neural network. The bidirectional long short-term memory network consists of two independent long short-term memory networks. The input sequence is fed into the two independent long short-term memory networks in both forward and reverse order for feature extraction. The extracted feature vectors are concatenated to form word vectors, which are then used as the final feature representation. The fully connected network maps the extracted features to the sample label space.
[0072] In detail, a global feature extraction model is constructed based on a bidirectional long short-term memory network and a fully connected network. The global feature extraction model contains two layers of bidirectional long short-term memory network and one layer of fully connected network. The bidirectional long short-term memory network is suitable for processing and predicting important events with relatively long intervals and delays in time series, and will comprehensively consider the overall trends in the short and long term.
[0073] Specifically, the global feature extraction model is used to extract global features from the multidimensional matrix space to obtain multiple global feature data, including:
[0074] The adjusted global feature extraction model is obtained by sequentially using one of the preset reference settings as the dimension of the hidden layer in the global feature extraction model.
[0075] The multidimensional matrix space is input into the adjusted global feature extraction model to obtain the global feature data corresponding to the multidimensional matrix space;
[0076] Multiple global feature data are obtained by summarizing the global feature data corresponding to each of the reference settings.
[0077] In detail, the multiple reference settings are 10, 20, and 30. The model is trained once for each setting to predict the user's future purchase probability. Then, the output of the global feature extraction model is used as the embedding vector for each customer. For example, when the hidden layer dimension is set to 10, the model outputs a 100*10 matrix, representing 100 customers. Each customer is represented by a 10-dimensional embedding vector to characterize the features of the entire sequence. The same applies to other hidden layer dimensions.
[0078] Further, the step of inputting the multidimensional matrix space into the adjusted global feature extraction model to obtain the global feature data corresponding to the multidimensional matrix space includes:
[0079] The state values of the multidimensional matrix space are calculated through the input gate of the bidirectional long short-term memory network in the adjusted global feature extraction model.
[0080] The activation value of the multidimensional matrix space is calculated through the forgetting gate of the bidirectional long short-term memory network in the adjusted global feature extraction model.
[0081] Calculate the state update value of the multidimensional matrix space based on the state value and the activation value;
[0082] The global feature data corresponding to the state update value is calculated using the output gate of the bidirectional long short-term memory network in the adjusted global feature extraction model.
[0083] In one optional embodiment, the method for calculating the state value includes:
[0084]
[0085] Among them, i t Indicates the state value. w represents the bias of the cell unit in the input gate. i h represents the activation factor of the input gate.t-1 x represents the peak value of the input sequence at time t-1 of the input gate. t Let b represent the multidimensional matrix space at time t. i This represents the weight of the cell unit in the input gate.
[0086] In one optional embodiment, the method for calculating the activation value includes:
[0087]
[0088] Among them, f t Indicates the activation value. w represents the bias of cell units in the forgetting gate. f The activator of the forgetting gate, Let x represent the peak value of the multidimensional matrix space at time t-1 of the forgetting gate. t Let b represent the multidimensional matrix space of the input at time t. f This represents the weight of the cell unit in the forgetting gate.
[0089] In one optional embodiment, the method for calculating the state update value includes:
[0090]
[0091] Among them, c t h represents the state update value. t-1 This represents the peak value of the multidimensional matrix space at time t-1 of the input gate. This represents the peak value of the multidimensional matrix space at time t-1 of the forget gate.
[0092] In one optional embodiment, calculating the global feature data corresponding to the state update value using the output gate of the bidirectional long short-term memory network in the adjusted global feature extraction model includes:
[0093] Calculate global feature data using the following formula:
[0094] o t =tanh(c t )
[0095] Among them, o t Let tanh represent the global feature data, and c represent the activation function of the output gate. t This indicates the status update value.
[0096] Specifically, multiple global feature data are concatenated to obtain a global concatenation vector, which integrates embedding vectors of multiple dimensions, resulting in a more stable overall effect.
[0097] S4. Construct a partial feature extraction model based on the multi-head attention mechanism and the fully connected network, and use the partial feature extraction model to extract partial features from the multi-dimensional matrix space to obtain multiple partial feature data. Perform data connection processing on the multiple partial feature data to obtain a partial connection vector.
[0098] In this embodiment of the invention, the core of the multi-head attention mechanism is a self-attention mechanism. Its advantage is that it can perform attention calculations on information from the current position and all other positions simultaneously, thereby obtaining the dependencies within the entire input sequence. A partial feature extraction model is constructed based on the multi-head attention mechanism and the fully connected network.
[0099] Specifically, the partial feature extraction model is used to extract partial features from the multidimensional matrix space to obtain multiple partial feature data, including:
[0100] The data output from the vector layer of the multi-head attention mechanism in the partial feature extraction model are used as multiple partial feature data.
[0101] Specifically, the vector layer is an embedding layer.
[0102] Furthermore, data concatenation processing is performed on multiple of the aforementioned partial feature data to obtain partial concatenation vectors.
[0103] For example, the multi-head attention embedding layer uses the embedding vector of each client as a matrix of 100*10*12. The 12 vectors in the time dimension are averaged to obtain a 100*10 matrix. Finally, the embedding vectors of different dimensions are concatenated to form a 100*60 matrix. This can integrate the importance features of each time point in the entire sequence.
[0104] S5. Connect the global concatenation vector and the partial connection vector to obtain the final feature vector. Use a preset data dimensionality reduction algorithm to reduce the dimensionality of the final feature vector to obtain dimensionality-reduced feature data. Based on the user's basic attribute features, the dimensionality-reduced feature data, and the preset clustering algorithm, perform user clustering processing on the user cluster to obtain the first user clustering result.
[0105] In this embodiment of the invention, the global concatenation vector and the partial connection vector are concatenated to obtain the final feature vector, which integrates vector features of global and local information. Since the feature dimension of the obtained final feature vector is too large, dimensionality reduction techniques are needed to reduce the feature dimension and avoid the original data being too sparse. The preset data dimensionality reduction algorithm used in this solution is PCA (Principal Component Analysis) to reduce the dimensionality of the indicator reference factor. PCA is a common data analysis method, often used for dimensionality reduction of high-dimensional data, and can be used to extract the main feature components of the data.
[0106] Specifically, the step of using a preset data dimensionality reduction algorithm to reduce the dimensionality of the final feature vector to obtain dimensionality-reduced feature data includes:
[0107] Obtain the number and dimension of the final feature vector;
[0108] The final feature vectors are arranged column-wise to form a final matrix with the number of columns being the number of features and the dimension being the number of rows.
[0109] Each row of the final matrix is zero-mean normalized to obtain the first matrix;
[0110] The covariance matrix is obtained based on the first matrix, and the eigenvalues and corresponding eigenvectors of the covariance matrix are calculated.
[0111] The feature vectors are arranged in rows from top to bottom according to the magnitude of the feature values to form a feature matrix, and the first preset number of rows in the feature matrix are taken to form a second matrix;
[0112] Multiply the first matrix and the second matrix to obtain dimensionality-reduced feature data.
[0113] For example, assuming the number of final feature vectors is m and the dimension is n, the final feature vectors are arranged into a final matrix X with n rows and m columns, and each row of the final matrix is zero-meaned, that is, the mean of that row is subtracted.
[0114] Further, the step of obtaining the covariance matrix based on the first matrix includes:
[0115] The covariance matrix can be obtained using the following formula:
[0116]
[0117] Where C is the covariance matrix, m is the number of the final eigenvectors, and X is the final matrix. T This is the transpose of the final matrix.
[0118] Specifically, the calculation of the eigenvalues and corresponding eigenvectors of the covariance matrix includes:
[0119] Obtain a preset identity matrix, and construct a characteristic polynomial based on the identity matrix and the covariance matrix;
[0120] The eigenvalues are obtained by solving the matrix of the characteristic polynomial.
[0121] Substituting the eigenvalues into the characteristic polynomial yields the eigenvectors corresponding to the eigenvalues.
[0122] In detail, the preset identity matrix is E, and a characteristic polynomial |C-λE| is constructed based on the identity matrix E and the covariance matrix C, where λ is the eigenvalue to be calculated. The eigenvalue is substituted into the characteristic polynomial to obtain the eigenvector corresponding to the eigenvalue.
[0123] Further, the step of performing user clustering processing on the user cluster based on the user's basic attribute features, the dimensionality reduction feature data, and a preset clustering algorithm to obtain a first user clustering result includes:
[0124] The user's basic attribute features are concatenated with the dimensionality-reduced feature data to obtain the final concatenated data.
[0125] The clustering algorithm is used to cluster the final spliced data to obtain the first user clustering result.
[0126] In detail, the basic attribute features include the user's age, gender, education level, marital status, and wealth. Since the basic attribute features are used as supplementary input, they are concatenated with the dimensionality reduction feature data to obtain the final concatenated data. The clustering algorithm is then used to cluster the final concatenated data to obtain the first user clustering result.
[0127] The clustering algorithm can be a partition-based clustering algorithm, such as the K-means algorithm; a hierarchical clustering algorithm, such as the CURE (Clustering Using Representative) algorithm; or a density-based clustering algorithm, such as the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) algorithm.
[0128] S6. Train a preset multi-classification model using the first user clustering result to obtain a standard multi-classification model. Input the data in the user behavior data whose data duration does not conform to the preset target time period into the standard multi-classification model to obtain a second user clustering result. Then, summarize and process the first user clustering result and the second user clustering result to obtain the final user clustering result.
[0129] In this embodiment of the invention, the preset multi-classification model can be an XGBoost (eXtreme GradientBoosting) model or a LightGBM (Light Gradient Boosting Machine) model.
[0130] Specifically, the step of training a preset multi-classification model using the clustering results of the first user to obtain a standard multi-classification model includes:
[0131] Different clustered users in the first user clustering result are labeled to obtain multiple labeled clustered users;
[0132] The preset multi-classification model is trained by using multiple labeled clustered users as training data to obtain a standard multi-classification model.
[0133] In detail, the tags are labeled according to different application scenarios. In this solution, clustered users can be labeled as wealth-oriented users or users prone to churn.
[0134] Furthermore, the data in the user behavior data whose data duration does not meet the preset target time period is input into the standard multi-classification model to obtain the second user clustering result. That is, the data in the user behavior data that does not meet the conditions are clustered and analyzed. The trained multi-classification model is used to predict the appropriate type label to obtain the second user clustering result. The first user clustering result and the second user clustering result are summarized and processed to obtain the final user clustering result.
[0135] In this embodiment of the invention, user behavior data is extracted, encoded, and a matrix space is constructed to obtain a multidimensional matrix space. This multidimensional matrix space visually represents the diversity of the data. Global and partial feature extraction models are used to extract the corresponding global concatenation vector and partial connection vector from the multidimensional matrix space, respectively, providing a more comprehensive feature extraction from both global and partial dimensions. The global concatenation vector and the partial connection vector are concatenated to obtain the final feature vector. A preset data dimensionality reduction algorithm is used to reduce the dimensionality of the final feature vector, resulting in dimensionality-reduced feature data. A clustering algorithm is then used to cluster users, yielding a first user clustering result. A multi-classification model is then trained to obtain a standard multi-classification model, which allows the model to cluster user behavior data whose duration does not conform to a preset target time period, resulting in a second user clustering result. The first and second user clustering results are then combined to obtain the final user clustering result. The final user clustering result is more accurate. Therefore, the time-series-based user clustering method proposed in this invention can solve the problem of low accuracy in improving time-series-based user clustering.
[0136] like Figure 3 The diagram shown is a functional block diagram of a time-series-based user clustering device provided in an embodiment of the present invention.
[0137] The time-series-based user clustering device 100 of this invention can be installed in an electronic device. Depending on the functions implemented, the time-series-based user clustering device 100 may include a data processing module 101, a global feature extraction module 102, a partial feature extraction module 103, and a user clustering module 104. The module described in this invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and which are stored in the memory of the electronic device.
[0138] In this embodiment, the functions of each module / unit are as follows:
[0139] The data processing module 101 is used to acquire user behavior data corresponding to the user cluster, take data whose data duration conforms to a preset target time period as standard behavior data, extract category feature data from the standard behavior data, encode the category feature data to obtain a category feature vector, identify the dimension of the category feature vector, convert the remaining data in the user behavior data after removing the category feature data into a remaining data vector with the same dimension as the category feature vector, and construct a multidimensional matrix space based on the remaining data vector and the category feature vector.
[0140] The global feature extraction module 102 is used to construct a global feature extraction model based on a bidirectional long short-term memory network and a fully connected network, and to use the global feature extraction model to extract global features from the multidimensional matrix space to obtain multiple global feature data. The multiple global feature data are then concatenated to obtain a global concatenated vector.
[0141] The partial feature extraction module 103 is used to construct a partial feature extraction model based on the multi-head attention mechanism and the fully connected network, and to use the partial feature extraction model to extract partial features from the multi-dimensional matrix space to obtain multiple partial feature data. The multiple partial feature data are then processed by data connection to obtain a partial connection vector.
[0142] The user clustering module 104 is used to perform vector concatenation of the global concatenation vector and the partial connection vector to obtain a final feature vector, perform dimensionality reduction processing on the final feature vector using a preset data dimensionality reduction algorithm to obtain dimensionality-reduced feature data, perform user clustering processing on the user cluster based on the user's basic attribute features, the dimensionality-reduced feature data and the preset clustering algorithm to obtain a first user clustering result, train a preset multi-classification model using the first user clustering result to obtain a standard multi-classification model, input data from the user behavior data whose data duration does not conform to the preset target time period into the standard multi-classification model to obtain a second user clustering result, and summarize the first user clustering result and the second user clustering result to obtain a final user clustering result.
[0143] In detail, the specific implementation methods of each module of the time-series-based user clustering device 100 are as follows:
[0144] Step 1: Obtain user behavior data corresponding to the user cluster. Data whose duration conforms to a preset target time period in the user behavior data is taken as standard behavior data. Extract category feature data from the standard behavior data and encode the category feature data to obtain a category feature vector.
[0145] In this embodiment of the invention, the multiple users in the user cluster can be customers in marketing scenarios in the financial field or users participating in electronic transactions in the fintech field. The user behavior data refers to all purchase data of each customer from the time of registration to the present, such as what products were purchased, the quantity, the amount, and the time. Each data has its own data duration, that is, the time from the customer's registration to the expiration date. For new customers, the purchase behavior data is too small, which will increase the noise of subsequent models. Therefore, it is necessary to use the data in the user behavior data whose data duration meets the preset target time period as standard behavior data, wherein the preset target time period is six months.
[0146] In detail, since the user behavior data contains different data, such as financial product category data or financial product quantity data, category feature data is extracted from the standard behavior data and the category feature data is discretized.
[0147] Preferably, to better understand the role of the category feature data, it can be encoded. Encoding the category feature data can employ methods such as one-hot encoding, target encoding, and Bayesian target encoding; however, this invention utilizes one-hot encoding.
[0148] Specifically, the step of encoding the category feature data to obtain the category feature vector includes:
[0149] The category feature data is aggregated to obtain the total number of category features;
[0150] An initial matrix vector is constructed using the category feature data as the number of rows in a preset matrix and the total number of category features as the number of columns in the preset matrix.
[0151] The column number corresponding to the category feature data in the initial matrix vector is set as the first value, and the remaining column numbers are set as the second value to obtain the category feature vector.
[0152] Wherein, the first value is 1, and the second value is 0.
[0153] For example, suppose there are only 10 types of financial products, with each dimension corresponding to one type of financial product. The type of financial product purchased is transformed into a 10-dimensional vector. If a certain type of financial product is purchased, it is marked as 1 in the corresponding dimension, otherwise it is marked as 0.
[0154] Step 2: Identify the dimensionality of the category feature vector, convert the remaining data in the user behavior data after removing the category feature data into a remaining data vector with the same dimensionality as the category feature vector, and construct a multidimensional matrix space based on the remaining data vector and the category feature vector.
[0155] In this embodiment of the invention, it is necessary to record the data features of the user behavior data after removing the category feature data using a vector of the same size and dimension. Therefore, it is necessary to first identify the dimension of the category feature vector and convert the remaining data in the user behavior data after removing the category feature data into a remaining data vector with the same dimension as the category feature vector.
[0156] For example, the category feature vector has a dimension of 10, so the remaining data in the user behavior data, such as product purchase data or product transaction amount, are transformed according to the dimension of the 10-dimensional vector.
[0157] Specifically, a multidimensional matrix space is constructed based on the remaining data vector and the category feature vector. For example, for a 100*20*12 multidimensional matrix space, 100 in the multidimensional matrix space represents 100 users, 20 represents the aforementioned product purchase information, which can be product purchase data or product transaction amount, and 12 represents data recorded for 12 months.
[0158] Step 3: Construct a global feature extraction model based on a bidirectional long short-term memory network and a fully connected network, and use the global feature extraction model to extract global features from the multidimensional matrix space to obtain multiple global feature data. Then, perform data concatenation on the multiple global feature data to obtain a global concatenation vector.
[0159] In this embodiment of the invention, the bidirectional long short-term memory network is a type of recurrent neural network. The bidirectional long short-term memory network consists of two independent long short-term memory networks. The input sequence is fed into the two independent long short-term memory networks in both forward and reverse order for feature extraction. The extracted feature vectors are concatenated to form word vectors, which are then used as the final feature representation. The fully connected network maps the extracted features to the sample label space.
[0160] In detail, a global feature extraction model is constructed based on a bidirectional long short-term memory network and a fully connected network. The global feature extraction model contains two layers of bidirectional long short-term memory network and one layer of fully connected network. The bidirectional long short-term memory network is suitable for processing and predicting important events with relatively long intervals and delays in time series, and will comprehensively consider the overall trends in the short and long term.
[0161] Specifically, the global feature extraction model is used to extract global features from the multidimensional matrix space to obtain multiple global feature data, including:
[0162] The adjusted global feature extraction model is obtained by sequentially using one of the preset reference settings as the dimension of the hidden layer in the global feature extraction model.
[0163] The multidimensional matrix space is input into the adjusted global feature extraction model to obtain the global feature data corresponding to the multidimensional matrix space;
[0164] Multiple global feature data are obtained by summarizing the global feature data corresponding to each of the reference settings.
[0165] In detail, the multiple reference settings are 10, 20, and 30. The model is trained once for each setting to predict the user's future purchase probability. Then, the output of the global feature extraction model is used as the embedding vector for each customer. For example, when the hidden layer dimension is set to 10, the model outputs a 100*10 matrix, representing 100 customers. Each customer is represented by a 10-dimensional embedding vector to characterize the features of the entire sequence. The same applies to other hidden layer dimensions.
[0166] Further, the step of inputting the multidimensional matrix space into the adjusted global feature extraction model to obtain the global feature data corresponding to the multidimensional matrix space includes:
[0167] The state values of the multidimensional matrix space are calculated through the input gate of the bidirectional long short-term memory network in the adjusted global feature extraction model.
[0168] The activation value of the multidimensional matrix space is calculated through the forgetting gate of the bidirectional long short-term memory network in the adjusted global feature extraction model.
[0169] Calculate the state update value of the multidimensional matrix space based on the state value and the activation value;
[0170] The global feature data corresponding to the state update value is calculated using the output gate of the bidirectional long short-term memory network in the adjusted global feature extraction model.
[0171] In one optional embodiment, the method for calculating the state value includes:
[0172]
[0173] Among them, i t Indicates the state value. w represents the bias of the cell unit in the input gate. i h represents the activation factor of the input gate.t-1 x represents the peak value of the input sequence at time t-1 of the input gate. t Let b represent the multidimensional matrix space at time t. i This represents the weight of the cell unit in the input gate.
[0174] In one optional embodiment, the method for calculating the activation value includes:
[0175]
[0176] Among them, f t Indicates the activation value. w represents the bias of cell units in the forgetting gate. f The activator of the forgetting gate, Let x represent the peak value of the multidimensional matrix space at time t-1 of the forgetting gate. t Let b represent the multidimensional matrix space of the input at time t. f This represents the weight of the cell unit in the forgetting gate.
[0177] In one optional embodiment, the method for calculating the state update value includes:
[0178]
[0179] Among them, c t h represents the state update value. t-1 This represents the peak value of the multidimensional matrix space at time t-1 of the input gate. This represents the peak value of the multidimensional matrix space at time t-1 of the forget gate.
[0180] In one optional embodiment, calculating the global feature data corresponding to the state update value using the output gate of the bidirectional long short-term memory network in the adjusted global feature extraction model includes:
[0181] Calculate global feature data using the following formula:
[0182] o t =tanh(c t )
[0183] Among them, o t Let tanh represent the global feature data, and c represent the activation function of the output gate. t This indicates the status update value.
[0184] Specifically, multiple global feature data are concatenated to obtain a global concatenation vector, which integrates embedding vectors of multiple dimensions, resulting in a more stable overall effect.
[0185] Step 4: Construct a partial feature extraction model based on the multi-head attention mechanism and the fully connected network, and use the partial feature extraction model to extract partial features from the multi-dimensional matrix space to obtain multiple partial feature data. Perform data connection processing on the multiple partial feature data to obtain partial connection vectors.
[0186] In this embodiment of the invention, the core of the multi-head attention mechanism is a self-attention mechanism. Its advantage is that it can perform attention calculations on information from the current position and all other positions simultaneously, thereby obtaining the dependencies within the entire input sequence. A partial feature extraction model is constructed based on the multi-head attention mechanism and the fully connected network.
[0187] Specifically, the partial feature extraction model is used to extract partial features from the multidimensional matrix space to obtain multiple partial feature data, including:
[0188] The data output from the vector layer of the multi-head attention mechanism in the partial feature extraction model are used as multiple partial feature data.
[0189] Specifically, the vector layer is an embedding layer.
[0190] Furthermore, data concatenation processing is performed on multiple of the aforementioned partial feature data to obtain partial concatenation vectors.
[0191] For example, the multi-head attention embedding layer uses the embedding vector of each client as a matrix of 100*10*12. The 12 vectors in the time dimension are averaged to obtain a 100*10 matrix. Finally, the embedding vectors of different dimensions are concatenated to form a 100*60 matrix. This can integrate the importance features of each time point in the entire sequence.
[0192] Step 5: Connect the global concatenation vector and the partial connection vector to obtain the final feature vector. Use a preset data dimensionality reduction algorithm to reduce the dimensionality of the final feature vector to obtain dimensionality-reduced feature data. Based on the user's basic attribute features, the dimensionality-reduced feature data, and the preset clustering algorithm, perform user clustering on the user cluster to obtain the first user clustering result.
[0193] In this embodiment of the invention, the global concatenation vector and the partial connection vector are concatenated to obtain the final feature vector, which integrates vector features of global and local information. Since the feature dimension of the obtained final feature vector is too large, dimensionality reduction techniques are needed to reduce the feature dimension and avoid the original data being too sparse. The preset data dimensionality reduction algorithm used in this solution is PCA (Principal Component Analysis) to reduce the dimensionality of the indicator reference factor. PCA is a common data analysis method, often used for dimensionality reduction of high-dimensional data, and can be used to extract the main feature components of the data.
[0194] Specifically, the step of using a preset data dimensionality reduction algorithm to reduce the dimensionality of the final feature vector to obtain dimensionality-reduced feature data includes:
[0195] Obtain the number and dimension of the final feature vector;
[0196] The final feature vectors are arranged column-wise to form a final matrix with the number of columns being the number of features and the dimension being the number of rows.
[0197] Each row of the final matrix is zero-mean normalized to obtain the first matrix;
[0198] The covariance matrix is obtained based on the first matrix, and the eigenvalues and corresponding eigenvectors of the covariance matrix are calculated.
[0199] The feature vectors are arranged in rows from top to bottom according to the magnitude of the feature values to form a feature matrix, and the first preset number of rows in the feature matrix are taken to form a second matrix;
[0200] Multiply the first matrix and the second matrix to obtain dimensionality-reduced feature data.
[0201] For example, assuming the number of final feature vectors is m and the dimension is n, the final feature vectors are arranged into a final matrix X with n rows and m columns, and each row of the final matrix is zero-meaned, that is, the mean of that row is subtracted.
[0202] Further, the step of obtaining the covariance matrix based on the first matrix includes:
[0203] The covariance matrix can be obtained using the following formula:
[0204]
[0205] Where C is the covariance matrix, m is the number of the final eigenvectors, and X is the final matrix. T This is the transpose of the final matrix.
[0206] Specifically, the calculation of the eigenvalues and corresponding eigenvectors of the covariance matrix includes:
[0207] Obtain a preset identity matrix, and construct a characteristic polynomial based on the identity matrix and the covariance matrix;
[0208] The eigenvalues are obtained by solving the matrix of the characteristic polynomial.
[0209] Substituting the eigenvalues into the characteristic polynomial yields the eigenvectors corresponding to the eigenvalues.
[0210] In detail, the preset identity matrix is E, and a characteristic polynomial |C-λE| is constructed based on the identity matrix E and the covariance matrix C, where λ is the eigenvalue to be calculated. The eigenvalue is substituted into the characteristic polynomial to obtain the eigenvector corresponding to the eigenvalue.
[0211] Further, the step of performing user clustering processing on the user cluster based on the user's basic attribute features, the dimensionality reduction feature data, and a preset clustering algorithm to obtain a first user clustering result includes:
[0212] The user's basic attribute features are concatenated with the dimensionality-reduced feature data to obtain the final concatenated data.
[0213] The clustering algorithm is used to cluster the final spliced data to obtain the first user clustering result.
[0214] In detail, the basic attribute features include the user's age, gender, education level, marital status, and wealth. Since the basic attribute features are used as supplementary input, they are concatenated with the dimensionality reduction feature data to obtain the final concatenated data. The clustering algorithm is then used to cluster the final concatenated data to obtain the first user clustering result.
[0215] The clustering algorithm can be a partition-based clustering algorithm, such as the K-means algorithm; a hierarchical clustering algorithm, such as the CURE (Clustering Using Representative) algorithm; or a density-based clustering algorithm, such as the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) algorithm.
[0216] Step 6: Train a preset multi-classification model using the first user clustering result to obtain a standard multi-classification model. Input the data in the user behavior data whose data duration does not conform to the preset target time period into the standard multi-classification model to obtain a second user clustering result. Then, summarize and process the first user clustering result and the second user clustering result to obtain the final user clustering result.
[0217] In this embodiment of the invention, the preset multi-classification model can be an XGBoost (eXtreme GradientBoosting) model or a LightGBM (Light Gradient Boosting Machine) model.
[0218] Specifically, the step of training a preset multi-classification model using the clustering results of the first user to obtain a standard multi-classification model includes:
[0219] Different clustered users in the first user clustering result are labeled to obtain multiple labeled clustered users;
[0220] The preset multi-classification model is trained by using multiple labeled clustered users as training data to obtain a standard multi-classification model.
[0221] In detail, the tags are labeled according to different application scenarios. In this solution, clustered users can be labeled as wealth-oriented users or users prone to churn.
[0222] Furthermore, the data in the user behavior data whose data duration does not meet the preset target time period is input into the standard multi-classification model to obtain the second user clustering result. That is, the data in the user behavior data that does not meet the conditions are clustered and analyzed. The trained multi-classification model is used to predict the appropriate type label to obtain the second user clustering result. The first user clustering result and the second user clustering result are summarized and processed to obtain the final user clustering result.
[0223] In this embodiment of the invention, user behavior data is extracted, encoded, and a matrix space is constructed to obtain a multidimensional matrix space. This multidimensional matrix space visually represents the diversity of the data. A global feature extraction model and a partial feature extraction model are used to extract the global concatenation vector and the partial connection vector corresponding to the multidimensional matrix space, respectively. Feature extraction is performed from both global and partial dimensions, resulting in a more comprehensive approach. The global concatenation vector and the partial connection vector are concatenated to obtain the final feature vector. A preset data dimensionality reduction algorithm is used to reduce the dimensionality of the final feature vector, resulting in dimensionality-reduced feature data. A clustering algorithm is then used to cluster users, obtaining a first user clustering result. A multi-classification model is trained to obtain a standard multi-classification model, which allows the model to cluster user behavior data whose data duration does not conform to a preset target time period, resulting in a second user clustering result. The first and second user clustering results are then combined to obtain the final user clustering result. The final user clustering result is more accurate. Therefore, the time-series-based user clustering device proposed in this invention can solve the problem of low accuracy in time-series-based user clustering in the fintech field.
[0224] like Figure 4 The diagram shown is a structural schematic of an electronic device that implements a time-series-based user clustering method according to an embodiment of the present invention.
[0225] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13. It may also include a computer program stored in the memory 11 and capable of running on the processor 10, such as a time-series-based user clustering program.
[0226] In some embodiments, the processor 10 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules stored in the memory 11 (e.g., executing time-series-based user clustering programs) and calls data stored in the memory 11 to perform various functions of the electronic device and process data.
[0227] The memory 11 includes at least one type of readable storage medium, including flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of an electronic device, such as a portable hard drive. In other embodiments, the memory 11 can be an external storage device of the electronic device, such as a plug-in portable hard drive, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc. Furthermore, the memory 11 can include both internal and external storage units of the electronic device. The memory 11 can be used not only to store application software and various types of data installed on the electronic device, such as the code of a time-series-based user clustering program, but also to temporarily store data that has been output or will be output.
[0228] The communication bus 12 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable communication between the memory 11 and at least one processor 10, etc.
[0229] The communication interface 13 is used for communication between the aforementioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, Bluetooth interface, etc.), typically used to establish communication connections between the electronic device and other electronic devices. The user interface may be a display, an input unit (such as a keyboard), or, optionally, a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device and to display a visual user interface.
[0230] Figure 4 Only electronic devices with components are shown; it will be understood by those skilled in the art that... Figure 4The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0231] For example, although not shown, the electronic device may also include a power supply (such as a battery) to power the various components. Preferably, the power supply can be logically connected to the at least one processor 10 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0232] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.
[0233] The time-series-based user clustering program stored in the memory 11 of the electronic device 1 is a combination of multiple instructions, which, when run in the processor 10, can achieve the following:
[0234] Obtain user behavior data corresponding to the user cluster, take the data whose data duration meets the preset target time period as standard behavior data, extract the category feature data in the standard behavior data, and encode the category feature data to obtain the category feature vector.
[0235] Identify the dimensionality of the category feature vector, convert the remaining data in the user behavior data after removing the category feature data into a remaining data vector with the same dimensionality as the category feature vector, and construct a multidimensional matrix space based on the remaining data vector and the category feature vector;
[0236] A global feature extraction model is constructed based on a bidirectional long short-term memory network and a fully connected network. The global feature extraction model is then used to extract global features from the multidimensional matrix space to obtain multiple global feature data. The multiple global feature data are then concatenated to obtain a global concatenated vector.
[0237] A partial feature extraction model is constructed based on the multi-head attention mechanism and the fully connected network. The partial feature extraction model is then used to extract partial features from the multi-dimensional matrix space to obtain multiple partial feature data. Data connection processing is then performed on the multiple partial feature data to obtain a partial connection vector.
[0238] The global concatenation vector and the partial connection vector are concatenated to obtain the final feature vector. The final feature vector is then reduced in dimensionality using a preset data dimensionality reduction algorithm to obtain dimensionality-reduced feature data. Based on the user's basic attribute features, the dimensionality-reduced feature data, and a preset clustering algorithm, the user cluster is subjected to user clustering to obtain the first user clustering result.
[0239] A preset multi-classification model is trained using the first user clustering result to obtain a standard multi-classification model. Data in the user behavior data whose data duration does not conform to the preset target time period is input into the standard multi-classification model to obtain a second user clustering result. The first user clustering result and the second user clustering result are then summarized and processed to obtain the final user clustering result.
[0240] Specifically, the specific implementation method of the processor 10 for the above instructions can be referred to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, and will not be repeated here.
[0241] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a storage medium. The storage medium can be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0242] The present invention also provides a storage medium storing a computer program, which, when executed by a processor of an electronic device, can perform the following:
[0243] Obtain user behavior data corresponding to the user cluster, take the data whose data duration meets the preset target time period as standard behavior data, extract the category feature data in the standard behavior data, and encode the category feature data to obtain the category feature vector.
[0244] Identify the dimensionality of the category feature vector, convert the remaining data in the user behavior data after removing the category feature data into a remaining data vector with the same dimensionality as the category feature vector, and construct a multidimensional matrix space based on the remaining data vector and the category feature vector;
[0245] A global feature extraction model is constructed based on a bidirectional long short-term memory network and a fully connected network. The global feature extraction model is then used to extract global features from the multidimensional matrix space to obtain multiple global feature data. The multiple global feature data are then concatenated to obtain a global concatenated vector.
[0246] A partial feature extraction model is constructed based on the multi-head attention mechanism and the fully connected network. The partial feature extraction model is then used to extract partial features from the multi-dimensional matrix space to obtain multiple partial feature data. Data connection processing is then performed on the multiple partial feature data to obtain a partial connection vector.
[0247] The global concatenation vector and the partial connection vector are concatenated to obtain the final feature vector. The final feature vector is then reduced in dimensionality using a preset data dimensionality reduction algorithm to obtain dimensionality-reduced feature data. Based on the user's basic attribute features, the dimensionality-reduced feature data, and a preset clustering algorithm, the user cluster is subjected to user clustering to obtain the first user clustering result.
[0248] A preset multi-classification model is trained using the first user clustering result to obtain a standard multi-classification model. Data in the user behavior data whose data duration does not conform to the preset target time period is input into the standard multi-classification model to obtain a second user clustering result. The first user clustering result and the second user clustering result are then summarized and processed to obtain the final user clustering result.
[0249] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0250] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0251] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0252] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0253] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0254] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0255] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0256] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any specific order.
[0257] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A time series based user clustering method, characterized in that, The method comprises: acquiring user behavior data corresponding to a user cluster, taking data in the user behavior data with a data survival time conforming to a preset target time period as standard behavior data, extracting category feature data in the standard behavior data, and performing data encoding on the category feature data to obtain a category feature vector; identifying the dimension size of the category feature vector, converting remaining data in the user behavior data excluding the category feature data into a remaining data vector consistent with the dimension size of the category feature vector, and constructing a multi-dimensional matrix space according to the remaining data vector and the category feature vector; constructing a global feature extraction model according to a bidirectional long short-term memory network and a fully connected network, and performing global feature extraction on the multi-dimensional matrix space by using the global feature extraction model to obtain a plurality of global feature data, and performing data splicing processing on the plurality of global feature data to obtain a global splicing vector; constructing a partial feature extraction model according to a multi-head attention mechanism and the fully connected network, and performing partial feature extraction on the multi-dimensional matrix space by using the partial feature extraction model to obtain a plurality of partial feature data, and performing data connection processing on the plurality of partial feature data to obtain a partial connection vector; vector connecting the global splicing vector and the partial connection vector to obtain a final feature vector, performing dimension reduction processing on the final feature vector by using a preset data dimension reduction algorithm to obtain dimension reduction feature data, performing user clustering processing on the user cluster based on the basic attribute features of the user, the dimension reduction feature data, and a preset clustering algorithm to obtain a first user clustering result; training a preset multi-classification model by using the first user clustering result to obtain a standard multi-classification model, inputting data in the user behavior data with a data survival time not conforming to the preset target time period into the standard multi-classification model to obtain a second user clustering result, and performing summary processing on the first user clustering result and the second user clustering result to obtain a final user clustering result; the data encoding on the category feature data to obtain a category feature vector comprises: performing data summary on the category feature data to obtain a total number of category features; constructing an initial matrix vector by taking the category feature data as the number of rows of a preset matrix and taking the total number of category features as the number of columns of the preset matrix; setting the position of the column number corresponding to the category feature data in the initial matrix vector to a first value and the rest of the column numbers to a second value to obtain a category feature vector.
2. The time-series based user clustering method of claim 1, wherein, the global feature extraction on the multi-dimensional matrix space by using the global feature extraction model to obtain a plurality of global feature data comprises: taking one of a plurality of preset reference settings as the dimension of the hidden layer in the global feature extraction model in sequence to obtain an adjusted global feature extraction model; inputting the multi-dimensional matrix space into the adjusted global feature extraction model to obtain global feature data corresponding to the multi-dimensional matrix space; performing summary on the global feature data corresponding to each reference setting to obtain a plurality of global feature data.
3. The time-series based user clustering method of claim 2, wherein, The multi-dimensional matrix space is input into the adjusted global feature extraction model to obtain global feature data corresponding to the multi-dimensional matrix space, including: The state value of the multi-dimensional matrix space is calculated through the input gate of the bidirectional long short-term memory network in the adjusted global feature extraction model; The activation value of the multi-dimensional matrix space is calculated through the forget gate of the bidirectional long short-term memory network in the adjusted global feature extraction model; The state update value of the multi-dimensional matrix space is calculated according to the state value and the activation value; The global feature data corresponding to the state update value is calculated through the output gate of the bidirectional long short-term memory network in the adjusted global feature extraction model.
4. The time-series based user clustering method of claim 1, wherein, The final feature vector is dimensionally reduced by using a preset data dimension reduction algorithm to obtain dimensionally reduced feature data, including: The number and dimension of the final feature vector are obtained; The final feature vector is grouped by column to form a final matrix with the number as the column number and the dimension as the row number; Each row of the final matrix is zero-meaned to obtain a first matrix; The covariance matrix is obtained based on the first matrix, and the eigenvalue and the corresponding eigenvector of the covariance matrix are calculated; The eigenvectors are arranged in a feature matrix in row from top to bottom according to the size of the eigenvalues, and the first preset row of the feature matrix is taken as a second matrix; The first matrix and the second matrix are multiplied to obtain dimensionally reduced feature data.
5. The time-series based user clustering method of claim 1, wherein, The first user clustering result is used to train a preset multi-classification model to obtain a standard multi-classification model, including: The different clustering users in the first user clustering result are labeled to obtain a plurality of labeled clustering users; The plurality of labeled clustering users are used as training data to train the preset multi-classification model to obtain a standard multi-classification model.
6. The time-series based user clustering method of claim 1, wherein, The user set is clustered based on the user's basic attribute feature, the dimensionally reduced feature data, and a preset clustering algorithm to obtain a first user clustering result, including: The user's basic attribute feature and the dimensionally reduced feature data are spliced to obtain final spliced data; The final spliced data is clustered by using the clustering algorithm to obtain a first user clustering result.
7. A time series based user clustering apparatus, characterized by, The device includes: A data processing module is configured to obtain user behavior data corresponding to a user set, take data with a data survival time conforming to a preset target time period in the user behavior data as standard behavior data, extract category feature data in the standard behavior data, and perform data encoding on the category feature data to obtain a category feature vector, identify the dimension size of the category feature vector, convert remaining data in the user behavior data excluding the category feature data into a remaining data vector consistent with the dimension size of the category feature vector, and construct a multi-dimensional matrix space according to the remaining data vector and the category feature vector; The global feature extraction module is configured to construct a global feature extraction model according to a bidirectional long short-term memory network and a full connection network, perform global feature extraction on the multi-dimensional matrix space by using the global feature extraction model, obtain a plurality of global feature data, and perform data splicing processing on the plurality of global feature data to obtain a global splicing vector. The partial feature extraction module is configured to construct a partial feature extraction model according to a multi-head attention mechanism and the full connection network, perform partial feature extraction on the multi-dimensional matrix space by using the partial feature extraction model, obtain a plurality of partial feature data, and perform data connection processing on the plurality of partial feature data to obtain a partial connection vector. The user clustering module is configured to perform vector connection on the global splicing vector and the partial connection vector to obtain a final feature vector, perform dimension reduction processing on the final feature vector by using a preset dimension reduction algorithm to obtain dimension reduction feature data, perform user clustering processing on the user cluster based on the basic attribute feature of the user, the dimension reduction feature data, and a preset clustering algorithm to obtain a first user clustering result, train a preset multi-classification model by using the first user clustering result to obtain a standard multi-classification model, input data in the user behavior data that does not conform to the preset target time period into the standard multi-classification model to obtain a second user clustering result, and perform summary processing on the first user clustering result and the second user clustering result to obtain a final user clustering result. The data encoding of the category feature data to obtain a category feature vector includes: performing data summary on the category feature data to obtain a category feature total number; constructing an initial matrix vector by taking the category feature data as a row number of a preset matrix and taking the category feature total number as a column number of the preset matrix; setting a position of a column number corresponding to the category feature data in the initial matrix vector as a first value and other column numbers as a second value to obtain a category feature vector.
8. An electronic device, comprising: The electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the time series-based user clustering method according to any one of claims 1 to 6.
9. A storage medium storing a computer program, characterized in that, The computer program is executed by the processor to implement the time series-based user clustering method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Clustering method and device, electronic equipment and computer readable storage medium
CN114494753A