User consumption behavior multi-dimensional portrait analysis method and system based on neural network

Through neural network technology, combined with feature engineering and multi-task feature extraction networks, the stability and real-time update issues of user consumption behavior portraits in different scenarios are solved, and efficient multi-dimensional user portrait analysis is achieved.

CN120744523AActive Publication Date: 2025-10-03SMIC WANYE TECHNOLOGY CO LTD

Patent Information

Application Number
CN202510920694.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-04
Publication Date
2025-10-03
Estimated Expiration
2045-07-04

AI Technical Summary

Technical Problem

Existing user consumption behavior profiling technology has low computational efficiency when processing long-sequence data, has difficulty identifying key behavioral features, cannot adapt to the needs of large-scale user data analysis, and inaccurately maps behavioral patterns in different consumption scenarios, affecting the consistency and stability of the profiling and lacking real-time update capabilities.

Method used

A neural network-based method is adopted to identify key time series features through feature engineering and subsequence dynamic pruning algorithm, and the bidirectional long short-term memory network and multi-task adversarial feature extraction network are combined to eliminate scene bias. The multi-layer perceptron is used for feature fusion, and a discrete coding index tree and hierarchical clustering algorithm are constructed to perform user grouping.

Benefits of technology

It improves the accuracy of user consumption behavior feature extraction and the stability of the model, supports real-time analysis and dynamic updating of large-scale user data, and meets the needs of modern e-commerce and precision marketing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120744523A_ABST
    Figure CN120744523A_ABST
Patent Text Reader

Abstract

The invention provides a user consumption behavior multi-dimensional portrait analysis method and system based on a neural network, and relates to the technical field of data analysis, and the method comprises the steps: obtaining user historical consumption behavior data, and constructing a basic feature vector; key time sequence features are determined through a sub-sequence dynamic pruning algorithm and entropy value weighted mapping; extracting sequence features by adopting a bidirectional long-short-term memory network; constructing a multi-task adversarial feature extraction network to obtain scene invariant features; performing feature fusion to obtain multi-dimensional combined features; constructing a feature index tree to calculate user similarity; and hierarchical clustering is carried out to obtain a consumption behavior portrait. According to the invention, high-precision user portraits are realized, and scene adaptability and calculation efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data analysis technology, and in particular to a method and system for analyzing multi-dimensional portraits of user consumption behavior based on a neural network. Background Art

[0002] With the rapid development of e-commerce and mobile payments, user consumption behavior data has exploded. Analyzing user consumption behavior and building accurate user profiles has become a key technology for precision marketing and personalized recommendations. Traditional user profiling techniques, primarily based on static attribute features and simple statistical models, are unable to fully tap into the complex temporal patterns and scenario-dependent characteristics inherent in user consumption behavior.

[0003] In recent years, machine learning-based user profiling technology has gradually emerged, primarily through the construction of user tagging systems through feature engineering and classification algorithms. Common methods include rule-based tag extraction, clustering-based user segmentation, and classification-based user attribute prediction. With the development of deep learning technology, neural network models have demonstrated significant advantages in modeling user behavior sequences. Techniques such as long short-term memory networks and attention mechanisms can effectively capture long-term dependencies in user behavior.

[0004] However, the existing user consumption behavior profiling technology still has shortcomings. The existing technology has low computational efficiency when processing long-sequence consumption behavior data, and it is difficult to effectively identify and extract key behavioral features, resulting in high model complexity and limited generalization ability, which cannot adapt to the needs of large-scale user data analysis; the existing methods do not adequately consider the behavioral differences in different consumption scenarios, and fail to effectively eliminate the impact of scenario deviations, resulting in the inability to accurately map users' behavior patterns in different consumption environments, affecting the consistency and stability of the portrait; the existing technology has bottlenecks in multi-dimensional feature fusion and real-time updating, lacks efficient feature indexing and similarity calculation mechanisms, cannot support the real-time calculation and updating of large-scale user portraits, and is difficult to meet the real-time decision-making needs in dynamic business scenarios. Summary of the Invention

[0005] The embodiments of the present invention provide a method and system for multi-dimensional portrait analysis of user consumption behavior based on a neural network, which can solve the problems in the prior art.

[0006] A first aspect of an embodiment of the present invention provides a method for analyzing a multi-dimensional profile of user consumption behavior based on a neural network, comprising: Obtain user historical consumption behavior data, construct an initial feature vector through feature engineering, and obtain a basic feature vector; Based on the basic feature vector, a subsequence dynamic pruning algorithm is used to perform feature decomposition, and sequence similarity is calculated based on the entropy-weighted local sensitive mapping. The minimum feature unit is identified through an iterative compression and reconstruction process to determine the key time series features. Based on key temporal features, a pre-trained bidirectional long short-term memory neural network is used to extract temporal dependencies and obtain the sequential features of consumer behavior. Based on the characteristics of consumer behavior sequences, a multi-task adversarial feature extraction network is constructed. The scene bias is eliminated through joint optimization and contrast loss function to obtain scene-invariant features. Based on key temporal features, consumer behavior sequence features, and scene-invariant features, a multi-layer perceptron is used to perform nonlinear feature fusion to obtain multi-dimensional combined features. Based on the multi-dimensional combined features, discrete coding is used to construct a feature index tree, combined with bitmap filtering and asynchronous update mechanism to obtain the similarity relationship between users; Based on the multi-dimensional combination characteristics and similarity relationships, a hierarchical clustering algorithm is used to group users and obtain the user consumption behavior portrait results.

[0007] In an optional embodiment, based on the basic feature vector, a subsequence dynamic pruning algorithm is used to perform feature decomposition, sequence similarity is calculated based on entropy-weighted local sensitivity mapping, and the minimum feature unit is identified through an iterative compression and reconstruction process. Determining key time series features includes: The basic feature vector is segmented according to the preset window size to obtain multiple feature subsequences; The difference between the overall entropy and the conditional entropy of the feature subsequence is calculated to obtain the information gain of the feature subsequence. Based on the information gain of the feature subsequence, the historical pruning results are updated by exponential moving average to obtain the dynamic threshold for feature retention; Comparing the information gain of the feature subsequence with the dynamic threshold, eliminating the feature subsequence that does not meet the threshold requirement according to the comparison result to obtain a retained sequence; calculating the feature entropy value of the retained sequence, and obtaining the feature weight through normalization; Based on the feature weights, performing local sensitive mapping on the retained sequence by constructing a random projection vector group, and calculating the weighted Hamming distance in the mapping space to obtain a sequence similarity matrix; According to the sequence similarity matrix, the retained sequence is compressed and encoded by an autoencoder to obtain a compressed feature; the compressed feature is reconstructed, and an error value between the reconstructed sequence and the retained sequence is calculated to obtain a reconstruction deviation; Based on the comparison result of the reconstructed deviation and the preset deviation threshold, iterative optimization is performed by adjusting the compression coefficient to determine the target compression coefficient, and the minimum feature unit is extracted from the compression feature according to the target compression coefficient to obtain the key timing feature.

[0008] In an optional embodiment, based on the feature weights, a local sensitive mapping is performed on the retained sequence by constructing a random projection vector group, and a weighted Hamming distance in the mapping space is calculated to obtain a sequence similarity matrix including: Constructing a weight matrix according to the feature weight of each feature in the retained sequence, wherein the diagonal elements of the weight matrix are normalized feature weights; Constructing a random projection vector group, wherein the dimension of each random projection vector in the random projection vector group is the same as the characteristic dimension of the retained sequence, and the elements obey the standard normal distribution; Representing the retained sequence as a sequence matrix, and performing a weighted transformation on the sequence matrix using the weight matrix to obtain a weighted sequence matrix; Performing a product operation on the weighted sequence matrix and each random projection vector in the random projection vector group, and performing a sign function transformation to obtain a binary hash code; Calculating, according to the projection weight coefficients corresponding to the random projection vector group, a weighted Hamming distance between binary hash codes corresponding to any two sequences in the retained sequence; Substituting the weighted Hamming distance into an exponential function for distance conversion, wherein the exponential function includes a smoothing factor for adjusting similarity sensitivity, to obtain a similarity value between sequences; The similarity values ​​between any two sequences in the retained sequence are calculated to construct a sequence similarity matrix.

[0009] In an optional embodiment, a multi-task adversarial feature extraction network is constructed based on the characteristics of the consumer behavior sequence. The scene deviation is eliminated through joint optimization and contrast loss function. The scene invariant features obtained include: Construct a dual-branch feature extraction network, perform multi-layer nonlinear transformation on the consumer behavior sequence features to obtain the first feature representation, and perform attention encoding on the scene information to obtain the second feature representation; Inputting the first feature representation and the second feature representation into a feature fusion layer to obtain a fused feature representation, and inputting the fused feature representation into a scene discriminator to perform scene classification; Calculating an adversarial loss value based on the classification result of the scene discriminator, selecting a behavior sequence pair of the same user from the consumption behavior sequence features, and calculating a cosine similarity value between the fusion feature representations corresponding to the behavior sequence pair; Calculating a contrast loss value based on the cosine similarity value, and performing a weighted combination of the adversarial loss value and the contrast loss value to obtain a total loss value; Back propagation is performed according to the total loss value to update the parameters of the dual-branch feature extraction network to obtain a feature extraction model, and scene invariant features are extracted through the feature extraction model.

[0010] In an optional embodiment, based on multi-dimensional combined features, discrete coding is used to construct a feature index tree, combined with bitmap filtering and asynchronous update mechanism, to obtain the similarity relationship between users including: Dividing the multi-dimensional combined features into discrete intervals according to quantiles, mapping the discrete intervals into discrete coded values, and converting the multi-dimensional combined features into discrete coded features; Constructing a feature index tree based on the discrete coding features, wherein each node layer of the feature index tree corresponds to a feature dimension, each node stores a discrete coding value of the corresponding dimension, and a bitmap storage structure is set at each node of the feature index tree; Obtaining discrete coding features of a target user, locating a feature path of the target user in the feature index tree, and performing filtering through the bitmap storage structure to obtain a set of candidate users; Performing a Euclidean distance calculation on the feature vector of each user in the candidate user set to obtain a first similarity component, performing a normalized mutual information calculation to obtain a second similarity component, and performing a weighted combination of the first similarity component and the second similarity component to obtain a comprehensive similarity; Writing the change information of the user characteristics into a cache queue, periodically detecting the amount of change information in the cache queue, and performing asynchronous update on the characteristic index tree when the amount of change information reaches a preset threshold; Recalculate the comprehensive similarity of each user in the candidate user set corresponding to the changed user to obtain the similarity relationship between users.

[0011] In an optional embodiment, a hierarchical clustering algorithm is used to group users based on multi-dimensional combined features and similarity relationships, and the user consumption behavior portrait results obtained include: Construct a user similarity matrix based on the user's multi-dimensional combined features and similarity relationships; Taking each user in the user similarity matrix as a user node, performing clustering calculation on the user similarity matrix using a hierarchical clustering algorithm, and initializing each user node as an independent clustering unit; Calculating the distance between cluster units based on the user similarity matrix, where the distance corresponds to the degree of similarity of users in different cluster units; selecting two cluster units with the smallest distance to merge and generate a new cluster unit; Recalculate the distance between the merged cluster unit and other cluster units based on the average link criterion, where the average link criterion is the average of the distances between all user pairs between cluster units; Repeat the process until the preset number of cluster units is reached, and the user grouping result is obtained; Calculate the importance score of each feature in each user group, where the importance score is the product of feature information gain and feature contrast; The importance scores are sorted in descending order, and corresponding features are selected as a feature set for user clustering according to a preset number of preferences, and a consumption behavior portrait result of the user is generated based on the feature set.

[0012] In an optional embodiment, performing clustering calculation on the user similarity matrix using a hierarchical clustering algorithm includes: Based on the user similarity matrix, according to a preset most similar number threshold, a corresponding number of most similar user nodes are selected for a user node to establish connection relationships and construct a neighbor relationship graph; Calculate the similarity distance between each user node and adjacent nodes in the neighbor relationship graph to obtain the local density value, and calculate the distance from each user node to all nodes with a local density value greater than itself, and select the minimum value as the relative distance value of the user node; Multiply the local density value of each user node by the relative distance value to obtain a core metric sequence. Perform a differential operation on the core metric sequence to obtain a differential sequence. Calculate the core set threshold through the mutation point of the differential sequence, and filter to obtain the core set. Calculate the connection paths between non-core user nodes and each core user node, select the maximum local density value of all user nodes on the connection path, and divide the corresponding non-core user node into the cluster unit where the corresponding core user node is located; Calculate the ratio of the number of edges and the product of the scale between adjacent cluster units as the connectivity, and construct a cluster unit hierarchical tree; The product of the density accessibility and average connectivity of the cluster unit boundary nodes is calculated as the stability value, and the boundary nodes below the preset stability threshold are re-divided into the cluster unit with the highest stability, and finally the optimized user grouping results are output.

[0013] A second aspect of an embodiment of the present invention provides a neural network-based multi-dimensional user consumption behavior portrait analysis system, comprising: The first unit is used to obtain the user's historical consumption behavior data, construct the initial feature vector through feature engineering, and obtain the basic feature vector; The second unit is used to perform feature decomposition based on the basic feature vector using a subsequence dynamic pruning algorithm, calculate sequence similarity based on entropy-weighted local sensitive mapping, identify the minimum feature unit through an iterative compression and reconstruction process, and determine the key time series features; The third unit is used to extract temporal dependencies based on key temporal features using a pre-trained bidirectional long short-term memory neural network to obtain consumer behavior sequence features; The fourth unit is used to build a multi-task adversarial feature extraction network based on the characteristics of consumer behavior sequences. It eliminates scene bias through joint optimization and contrast loss function to obtain scene-invariant features. The fifth unit is used to perform nonlinear feature fusion through a multi-layer perceptron based on key temporal features, consumer behavior sequence features, and scene-invariant features to obtain multi-dimensional combined features; The sixth unit is used to construct a feature index tree based on multi-dimensional combined features using discrete coding, combined with bitmap filtering and asynchronous update mechanism to obtain the similarity relationship between users; The seventh unit is used to group users based on multi-dimensional combination features and similarity relationships using a hierarchical clustering algorithm to obtain user consumption behavior portraits.

[0014] According to a third aspect of an embodiment of the present invention, an electronic device is provided, including: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the aforementioned method.

[0015] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described above is implemented.

[0016] In an embodiment of the present invention, user consumption behavior data is processed through feature engineering and subsequence dynamic pruning algorithm, and sequence similarity is calculated by combining entropy-weighted local sensitive mapping, which can accurately identify the minimum feature unit and key time series features, effectively capture the time evolution law and key turning points in user consumption behavior, and improve the accuracy and representativeness of feature extraction; a pre-trained bidirectional long short-term memory neural network and a multi-task adversarial feature extraction network are combined to effectively eliminate data deviations in different consumption scenarios through joint optimization and contrast loss function, extract user consumption features with scene invariance, enhance the stability and generalization ability of the model in cross-scenario applications, and avoid the performance degradation problem of traditional methods in complex environments; nonlinear feature fusion is performed through multi-layer perceptron, combined with the feature index tree constructed by discrete coding and the bitmap filtering mechanism, which significantly improves the multi-dimensional analysis efficiency of user portraits, realizes accurate portraits of user consumption behavior, can support real-time analysis and dynamic update of large-scale user data, meets the high requirements of modern e-commerce and precision marketing for user portraits, and has high engineering application value. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 Schematic diagram of the process of a multi-dimensional profiling method for user consumption behavior based on a neural network according to an embodiment of the present invention; Figure 2 Schematic diagram showing the performance comparison between the user profiling method based on hierarchical clustering and the traditional clustering algorithm. DETAILED DESCRIPTION

[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying 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 making creative efforts shall fall within the scope of protection of the present invention.

[0019] The following specific embodiments are used to describe the technical solution of the present invention in detail. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0020] Figure 1 FIG. 1 is a flow chart of a method for multi-dimensional profiling of user consumption behavior based on a neural network according to an embodiment of the present invention. Figure 1 As shown, the method includes: Obtain user historical consumption behavior data, construct an initial feature vector through feature engineering, and obtain a basic feature vector; Based on the basic feature vector, a subsequence dynamic pruning algorithm is used to perform feature decomposition, and sequence similarity is calculated based on the entropy-weighted local sensitive mapping. The minimum feature unit is identified through an iterative compression and reconstruction process to determine the key time series features. Based on key temporal features, a pre-trained bidirectional long short-term memory neural network is used to extract temporal dependencies and obtain the sequential features of consumer behavior. Based on the characteristics of consumer behavior sequences, a multi-task adversarial feature extraction network is constructed. The scene bias is eliminated through joint optimization and contrast loss function to obtain scene-invariant features. Based on key temporal features, consumer behavior sequence features, and scene-invariant features, a multi-layer perceptron is used to perform nonlinear feature fusion to obtain multi-dimensional combined features. Based on the multi-dimensional combined features, discrete coding is used to construct a feature index tree, combined with bitmap filtering and asynchronous update mechanism to obtain the similarity relationship between users; Based on the multi-dimensional combination characteristics and similarity relationships, a hierarchical clustering algorithm is used to group users and obtain the user consumption behavior portrait results.

[0021] In an optional embodiment, based on the basic feature vector, a subsequence dynamic pruning algorithm is used to perform feature decomposition, sequence similarity is calculated based on entropy-weighted local sensitive mapping, and the minimum feature unit is identified through an iterative compression and reconstruction process. Determining the key time series features includes: The basic feature vector is segmented according to the preset window size to obtain multiple feature subsequences; The difference between the overall entropy and the conditional entropy of the feature subsequence is calculated to obtain the information gain of the feature subsequence. Based on the information gain of the feature subsequence, the historical pruning results are updated by exponential moving average to obtain the dynamic threshold for feature retention; Comparing the information gain of the feature subsequence with the dynamic threshold, eliminating the feature subsequence that does not meet the threshold requirement according to the comparison result to obtain a retained sequence; calculating the feature entropy value of the retained sequence, and obtaining the feature weight through normalization; Based on the feature weights, performing local sensitive mapping on the retained sequence by constructing a random projection vector group, and calculating the weighted Hamming distance in the mapping space to obtain a sequence similarity matrix; According to the sequence similarity matrix, the retained sequence is compressed and encoded by an autoencoder to obtain a compressed feature; the compressed feature is reconstructed, and an error value between the reconstructed sequence and the retained sequence is calculated to obtain a reconstruction deviation; Based on the comparison result of the reconstructed deviation and the preset deviation threshold, iterative optimization is performed by adjusting the compression coefficient to determine the target compression coefficient, and the minimum feature unit is extracted from the compression feature according to the target compression coefficient to obtain the key timing feature.

[0022] In one specific implementation, after obtaining a basic feature vector of a user's consumption behavior, it is segmented according to a preset window size to generate multiple feature subsequences. The preset window size can be adjusted based on the actual application scenario. For example, in user consumption behavior analysis, a 30-day window can be set to divide three months of a user's consumption data into three feature subsequences. The basic feature vector contains multi-dimensional features such as the user's consumption amount, consumption frequency, and consumption categories at different time points.

[0023] For each feature subsequence, the difference between the overall entropy and the conditional entropy is calculated to obtain the information gain of the feature subsequence. The overall entropy reflects the uncertainty of the feature subsequence, while the conditional entropy reflects the uncertainty about other features given some known features. By calculating the difference between the two, we can assess the amount of effective information contained in the feature subsequence. For example, for a feature subsequence of user spending, if its information gain is 0.75, it indicates that the sequence contains a high level of effective information.

[0024] Based on the information gain of the feature subsequences, the historical pruning results are updated using an exponential moving average to obtain a dynamic threshold for feature retention. The exponential moving average assigns higher weight to recent data and lower weight to more distant data, allowing the threshold to adapt to changes in the data distribution. The dynamic threshold is calculated using a decay factor of 0.9, with the initial threshold set at 0.5. This threshold is continuously updated based on the newly calculated information gain. For example, if the information gain of the first feature subsequence is 0.75, the updated dynamic threshold is 0.5 × 0.9 + 0.75 × 0.1 = 0.525.

[0025] The information gain of the feature subsequence is compared with the dynamic threshold. Based on the comparison results, feature subsequences that do not meet the threshold are eliminated to obtain the retained sequence. If the information gain of the feature subsequence is greater than or equal to the dynamic threshold, the subsequence is retained; otherwise, it is eliminated. The feature entropy value of the retained sequence is calculated and normalized to obtain the feature weight. The feature entropy value is calculated based on the distribution of features in each dimension of the retained sequence, and the normalization process ensures that the sum of all feature weights is 1. For example, the retained sequence contains three dimensions: consumption amount, consumption frequency, and consumption category. The calculated feature entropy values ​​are 2.1, 1.8, and 1.5, respectively, and the normalized feature weights are 0.39, 0.33, and 0.28, respectively.

[0026] Based on the feature weights, a set of random projection vectors is constructed to perform locality-sensitive mapping on the retained sequence. The weighted Hamming distance in the mapped space is then calculated to obtain a sequence similarity matrix. The dimension of the random projection vector set is twice that of the retained sequence and is generated using a random Gaussian distribution. Locality-sensitive mapping maps high-dimensional features to a low-dimensional space, preserving the relative distances between data points. The weighted Hamming distance considers the weight differences of features across different dimensions, improving the accuracy of distance calculation. For example, the Hamming distance between two feature vectors in the mapped space is 5, while the weighted Hamming distance after factoring in the feature weights is 4.2, indicating a high degree of similarity between the two.

[0027] Based on the sequence similarity matrix, the retained sequence is compressed and encoded using an autoencoder to generate compressed features. The autoencoder consists of two parts: an encoder and a decoder. The encoder compresses the input data into a low-dimensional latent space, while the decoder attempts to reconstruct the original data from the latent space. Both the encoder and decoder are three-layer neural network structures, using ReLU as the activation function. The number of nodes in the middle layer is 2 / 3 and 1 / 3 of the input dimension, respectively. The initial compression factor is set to 0.5, meaning that the dimension of the compressed features is half that of the retained sequence.

[0028] The compressed features are reconstructed and the error between the reconstructed sequence and the retained sequence is calculated to obtain the reconstruction deviation. The reconstruction deviation is calculated using mean square error and reflects the degree of information loss during the compression process. A reconstruction deviation of 0.15 indicates that the compressed features retain 85% of the original data's information.

[0029] Based on the comparison of the reconstruction deviation with a preset deviation threshold, the compression factor is adjusted and iteratively optimized to determine the target compression factor. The preset deviation threshold is set to 0.2. If the reconstruction deviation is less than the preset deviation threshold, the compression factor is reduced to further compress the features. If the reconstruction deviation is greater than the preset deviation threshold, the compression factor is increased to reduce the degree of compression. The compression factor adjustment step size is initially set to 0.1 and gradually decreases with increasing iterations. For example, if the current compression factor is 0.5 and the reconstruction deviation is 0.15, which is less than the preset deviation threshold of 0.2, the compression factor is updated to 0.5 - 0.1 = 0.4, further compressing the features.

[0030] After multiple rounds of iterative optimization, when the reconstruction deviation approaches but does not exceed the preset deviation threshold, or when the maximum number of iterations (set to 10) is reached, the target compression coefficient is determined. Based on the target compression coefficient, the minimum feature unit is extracted from the compressed features to obtain the key time series features. This minimum feature unit is determined using principal component analysis, retaining the feature components that contribute most to the reconstruction. For example, if the target compression coefficient is 0.3 and the original retained sequence dimension is 10, the key time series feature dimension is 3, which contains the most representative features of the original data.

[0031] For example, three months of consumption data for a user were analyzed. The original features included six dimensions: consumption amount, consumption frequency, consumption category, consumption time, payment method, and promotion response. The data was divided into three feature subsequences based on a 30-day window, with calculated information gains of 0.82, 0.65, and 0.71, respectively. The dynamic threshold was calculated to be 0.63, and all three subsequences were retained. The feature weights were calculated to be 0.25 for consumption amount, 0.2 for consumption frequency, 0.22 for consumption category, 0.15 for consumption time, 0.08 for payment method, and 0.1 for promotion response. After compression using the autoencoder, the target compression coefficient was determined to be 0.33, resulting in a key time series feature dimension of 2, which includes the combined features of consumption amount and consumption category. This feature can better reflect the user's consumption preferences and spending power, providing effective support for user profile analysis.

[0032] In an optional embodiment, based on the feature weights, a local sensitive mapping is performed on the retained sequence by constructing a random projection vector group, and a weighted Hamming distance in the mapping space is calculated to obtain a sequence similarity matrix including: Constructing a weight matrix according to the feature weight of each feature in the retained sequence, wherein the diagonal elements of the weight matrix are normalized feature weights; Constructing a random projection vector group, wherein the dimension of each random projection vector in the random projection vector group is the same as the characteristic dimension of the retained sequence, and the elements obey the standard normal distribution; Representing the retained sequence as a sequence matrix, and performing a weighted transformation on the sequence matrix using the weight matrix to obtain a weighted sequence matrix; Performing a product operation on the weighted sequence matrix and each random projection vector in the random projection vector group, and performing a sign function transformation to obtain a binary hash code; Calculating, according to the projection weight coefficients corresponding to the random projection vector group, a weighted Hamming distance between binary hash codes corresponding to any two sequences in the retained sequence; Substituting the weighted Hamming distance into an exponential function for distance conversion, wherein the exponential function includes a smoothing factor for adjusting similarity sensitivity, to obtain a similarity value between sequences; The similarity values ​​between any two sequences in the retained sequence are calculated to construct a sequence similarity matrix.

[0033] In a specific embodiment, a similarity matrix is ​​constructed based on the sequence feature weights, and this process is implemented by local sensitive mapping and weighted Hamming distance calculation. According to the feature weights of each feature in the retained sequence, a weight matrix W is constructed. The matrix is ​​a diagonal matrix, and the diagonal elements are the normalized feature weights. For example, for a user consumption behavior retention sequence containing 10 features, the feature weights may be [0.25, 0.15, 0.1, 0.1, 0.08, 0.08, 0.07, 0.07, 0.05, 0.05], which is normalized to form a diagonal matrix W, where W[1, 1] = 0.25 represents the consumption amount feature, W[2, 2] = 0.15 represents the consumption frequency feature, and so on.

[0034] Next, construct a set of random projection vectors R. Each random projection vector has the same dimension as the feature dimension of the retained sequence, and its elements follow a standard normal distribution. For example, for a 10-dimensional consumer behavior feature space, 128 random projection vectors can be constructed, each containing 10 random numbers following a standard normal distribution. In practice, a random number generator can be used to generate values ​​that follow a standard normal distribution, forming a matrix R with dimensions of 10 × 128, meaning each column is a random projection vector.

[0035] The retained sequence is represented as a sequence matrix X. Assuming there are 100 user consumption behavior sequences, each with 10 features, X is a 100×10 matrix. The sequence matrix X is weighted using the weight matrix W to obtain the weighted sequence matrix X'=X·W. For each row in the matrix X (representing a user's consumption behavior sequence), after multiplying it with the matrix W, each eigenvalue of the sequence is multiplied by the corresponding weight. For example, for the sequence X[1]=[3.2, 1.5, 4.7, 2.1, 3.5, 1.8, 2.2, 3.0, 2.5, 1.9], which represents 10 eigenvalues ​​such as a user's consumption amount and consumption frequency, the weighted value becomes X'[1]=[0.8, 0.225, 0.47, 0.21, 0.28, 0.144, 0.154, 0.21, 0.125, 0.095].

[0036] The weighted sequence matrix X' is multiplied by each random projection vector in the random projection vector group R, and a sign function transformation is performed to obtain a binary hash code. Specifically, X'·R is calculated to obtain the matrix H', and then the sign function is applied to each element in H': if the element is greater than 0, it is mapped to 1; otherwise, it is mapped to 0, and the binary hash code matrix H is obtained. For example, for the product of the user consumption sequence X'[1] and the first random vector R[1], if the result is 0.35, the corresponding hash code is 1; if the product with the second random vector R[2] is -0.12, the corresponding hash code is 0. In this way, each user consumption sequence will be mapped to a 128-bit binary hash code, effectively reducing the data dimension.

[0037] Based on the projection weight coefficients corresponding to the random projection vector groups, the weighted Hamming distance between the binary hash codes corresponding to any two sequences in the retained sequence is calculated. The projection weight coefficients can be set based on the importance of each random projection vector. For example, they can be set to equal weight, that is, each bit has a weight of 1 / 128. For the binary hash codes H[i] and H[j] of user i and user j's consumption sequences, their weighted Hamming distance is calculated: first, the XOR result of H[i] and H[j] is calculated to obtain a new binary sequence, where a bit with a value of 1 indicates that the two hash codes differ at that bit. Then, the number of bits with a value of 1 in this binary sequence is calculated and multiplied by the corresponding projection weight coefficient to obtain the weighted Hamming distance d(i, j).

[0038] Substituting the weighted Hamming distance into an exponential function for distance conversion, which includes a smoothing factor α to adjust the sensitivity of similarity, yields the similarity value between the sequences. The similarity calculation formula is: s(i, j) = exp(-d(i, j) / α), where α is the smoothing factor, which can be adjusted based on the application and is generally set to a value between 0.1 and 1. For example, if the weighted Hamming distance between the consumption sequences of user i and user j is 32 / 128 = 0.25, and the smoothing factor α is 0.5, then the similarity between their consumption behaviors is exp(-0.25 / 0.5) = exp(-0.5) ≈ 0.607, indicating that the consumption habits of these two users are somewhat similar.

[0039] Calculate the similarity between any two sequences in the retained sequence and construct a sequence similarity matrix S. For a dataset containing 100 user consumption sequences, the similarity matrix S is a 100×100 matrix, where S[i, j] represents the similarity between the consumption behaviors of user i and user j. Because similarity is symmetric (S[i, j] = S[j, i]), and the similarity between a sequence and itself is 1 (S[i, i] = 1), only the elements of the upper or lower triangular matrix need to be calculated.

[0040] Traditional methods for calculating similarity in user spending behavior are primarily based on Euclidean distance or cosine similarity. These methods are computationally complex when processing high-dimensional feature data and fail to account for differences in the importance of different features. While existing local sensitive hashing techniques can reduce dimensionality and accelerate computation, they typically treat all features equally, ignoring differences in feature importance and resulting in insufficient similarity calculation accuracy. For example, traditional local sensitive hashing methods assign equal weight to features such as user spending amount and promotion response. However, in reality, spending amount often better reflects a user's spending power and habits than promotion response.

[0041] The method of this embodiment introduces a weight calculation mechanism based on feature entropy, which adaptively assigns weights according to the amount of information in the feature, so that features containing more information (such as consumption amount and consumption frequency) are given higher weights; a weight matrix is ​​integrated into the local sensitive hashing process, and the feature weights are retained during the dimensionality reduction process by multiplying the weighted sequence matrix with the random projection vector; at the same time, a projection weight coefficient is introduced into the Hamming distance calculation, and an adjustable smoothing factor is used to adapt to the similarity sensitivity requirements of different application scenarios. The starting point of these improvements is to improve the accuracy and efficiency of the similarity calculation of user consumption behavior and to more accurately capture the key feature differences in user consumption patterns.

[0042] Compared to traditional equal-weighted local sensitive hashing methods, this method improves the accuracy of user consumption behavior clustering and the precision of similar user recommendations. In terms of computational efficiency, for consumption data of 100,000 users and 20-dimensional features, traditional methods take approximately 3 hours to complete the similarity matrix construction, while this method only takes about 25 minutes, a speedup of approximately 7 times. Furthermore, by properly setting the smoothing factor, this method can flexibly adjust the similarity distribution to better meet the needs of different business scenarios, such as precision marketing and personalized recommendations. Furthermore, this method is significantly more robust to sparse and noisy data, better adapting to the complexity and variability of actual user consumption data.

[0043] In an optional embodiment, a multi-task adversarial feature extraction network is constructed based on the characteristics of the consumer behavior sequence. The scene bias is eliminated through joint optimization and contrast loss function. The scene invariant features obtained include: Construct a dual-branch feature extraction network, perform multi-layer nonlinear transformation on the consumer behavior sequence features to obtain the first feature representation, and perform attention encoding on the scene information to obtain the second feature representation; Inputting the first feature representation and the second feature representation into a feature fusion layer to obtain a fused feature representation, and inputting the fused feature representation into a scene discriminator to perform scene classification; Calculating an adversarial loss value based on the classification result of the scene discriminator, selecting a behavior sequence pair of the same user from the consumption behavior sequence features, and calculating a cosine similarity value between the fusion feature representations corresponding to the behavior sequence pair; Calculating a contrast loss value based on the cosine similarity value, and performing a weighted combination of the adversarial loss value and the contrast loss value to obtain a total loss value; Back propagation is performed according to the total loss value to update the parameters of the dual-branch feature extraction network to obtain a feature extraction model, and scene invariant features are extracted through the feature extraction model.

[0044] In a specific embodiment, a two-branch feature extraction network is constructed, which includes a first branch for processing the sequence features of consumer behavior and a second branch for processing scene information. In the first branch, the sequence features of consumer behavior are input, which can be the consumption records of users at different time points, including purchase amount, purchase frequency, purchase category and other information. These sequence features are transformed into a first feature representation through multiple layers of nonlinear transformation. Specifically, a three-layer fully connected neural network is used, with the number of neurons in each layer being 256, 128, and 64 respectively. The activation function uses the ReLU function, and a batch normalization layer is added after each layer to accelerate network convergence. For example, the sequence features of consumer behavior of user A are [100 yuan for food purchases, 200 yuan for clothing purchases, and 50 yuan for daily necessities purchases]. After processing by the first branch, a 64-dimensional first feature representation is obtained.

[0045] In the second branch, scene information is input, such as online shopping malls, physical stores, and holiday promotions. Attention encoding is performed on this scene information to obtain a second feature representation. Specifically, the scene information is converted into a 32-dimensional embedding vector, and then the self-attention mechanism is used to calculate the correlation between different scenes. The implementation of the self-attention mechanism includes calculating the query vector, key vector, and value vector, calculating the attention weight by taking the dot product of the query vector and the key vector, and then weighted summing it with the value vector to obtain the attention output. Finally, a fully connected layer is used to convert the attention output into a 32-dimensional second feature representation. For example, for the scene information of "online shopping mall", after processing by the second branch, a 32-dimensional second feature representation is obtained.

[0046] The first and second feature representations are input into the feature fusion layer to obtain a fused feature representation. The feature fusion layer uses a gating mechanism to control the fusion ratio of the two features through trainable parameters. Specifically, a fully connected layer is used to generate a gating signal with a value range of 0 to 1, which is used to control the degree of retention of the first feature representation. Subsequently, the gated first feature representation and the second feature representation are concatenated and mapped to a 64-dimensional space through a fully connected layer to obtain a fused feature representation. In the above example, the 64-dimensional first feature representation and the 32-dimensional second feature representation of user A are fused to obtain a 64-dimensional fused feature representation.

[0047] The fused feature representation is input into the scene discriminator for scene classification. The scene discriminator consists of a two-layer fully connected network. The first layer contains 32 neurons and uses the ReLU activation function. The second layer has the same number of neurons as the number of scene categories and uses the Softmax activation function to output the probability distribution of each scene. For example, if there are three scenarios: online shopping, physical stores, and holiday sales, the output of the scene discriminator is a 3D vector, representing the probability of the sample belonging to each scenario.

[0048] The adversarial loss is calculated based on the classification results of the scene discriminator. This adversarial loss uses the cross-entropy loss function to calculate the difference between the predicted scene probability distribution and the true scene label. To achieve adversarial learning, the goal of the feature extraction network is to maximize the adversarial loss, while the goal of the scene discriminator is to minimize it. Through this adversarial training, the feature extraction network gradually learns to extract features that are independent of the scene. In the above example, if the true scene is "online shopping mall" and the predicted probabilities are [0.2, 0.7, 0.1], the cross-entropy loss value is large, indicating that the features still contain scene-related information.

[0049] Select behavior sequence pairs of the same user from the consumption behavior sequence features and calculate the cosine similarity between the corresponding fused feature representations of the behavior sequence pairs. Specifically, randomly select two consumption behavior sequences from different scenarios for each user, obtain fused feature representations through the feature extraction network, and calculate the cosine similarity of these two fused feature representations. For example, the consumption behavior sequences of user A in the online mall and in the physical store are represented by the fused feature vectors v1 and v2 respectively after the feature extraction network. Calculate the dot product of v1 and v2 divided by the product of their norms to obtain the cosine similarity value.

[0050] The contrast metric loss value is calculated based on the cosine similarity value. The contrast metric loss aims to make the feature representations of the same user in different scenarios similar, while the feature representations of different users are far apart. Specifically, for the behavior sequence pairs of the same user, the contrast metric loss is 1 minus the cosine similarity value; for the behavior sequence pairs of different users, the contrast metric loss is the maximum value between the cosine similarity value and the boundary value of 0.3. In actual implementation, a similarity matrix can be constructed for each batch of data. The diagonal elements in the matrix correspond to different scenarios of the same user, and the off-diagonal elements correspond to different users.

[0051] The total loss is calculated by weighting the adversarial loss and contrast loss. The weighting coefficients can be adjusted based on actual needs. For example, a weight of 0.7 for the adversarial loss and 0.3 for the contrast loss can be used. By adjusting these weights, the feature extraction network can be adjusted to prioritize scene invariance and user consistency. The total loss is calculated as the adversarial loss multiplied by 0.7 plus the contrast loss multiplied by 0.3.

[0052] Backpropagation is performed based on the total loss to update the parameters of the two-branch feature extraction network, resulting in a feature extraction model. The Adam optimizer is used, with a learning rate of 0.001, a batch size of 128, and 100 training rounds. In each training round, the feature extraction network and the scene discriminator alternately update their parameters. The feature extraction network learns to extract scene-invariant features by maximizing the adversarial loss and minimizing the contrast loss. After training, the two-branch feature extraction network can be used to extract scene-invariant features from consumer behavior sequences. These features can be used in downstream tasks such as user preference prediction and consumer behavior analysis.

[0053] In an optional embodiment, based on multi-dimensional combined features, discrete coding is used to construct a feature index tree, combined with bitmap filtering and asynchronous update mechanism, to obtain the similarity relationship between users, including: Dividing the multi-dimensional combined features into discrete intervals according to quantiles, mapping the discrete intervals into discrete coded values, and converting the multi-dimensional combined features into discrete coded features; Constructing a feature index tree based on the discrete coding features, wherein each node layer of the feature index tree corresponds to a feature dimension, each node stores a discrete coding value of the corresponding dimension, and a bitmap storage structure is set at each node of the feature index tree; Obtaining discrete coding features of a target user, locating a feature path of the target user in the feature index tree, and performing filtering through the bitmap storage structure to obtain a set of candidate users; Performing a Euclidean distance calculation on the feature vector of each user in the candidate user set to obtain a first similarity component, performing a normalized mutual information calculation to obtain a second similarity component, and performing a weighted combination of the first similarity component and the second similarity component to obtain a comprehensive similarity; Writing the change information of the user characteristics into a cache queue, periodically detecting the amount of change information in the cache queue, and performing asynchronous update on the characteristic index tree when the amount of change information reaches a preset threshold; Recalculate the comprehensive similarity of each user in the candidate user set corresponding to the changed user to obtain the similarity relationship between users.

[0054] In one specific embodiment, a user's multi-dimensional features are preprocessed. User features include continuous features such as consumption frequency, browsing time, and click-through conversion rate, as well as categorical features such as gender, occupation, and hobby preferences. Continuous features are discretized using the quantile method. For example, the user's spending amount is divided into five intervals: 0-20%, 20%-40%, 40%-60%, 60%-80%, and 80%-100%, and mapped to discrete coded values ​​1, 2, 3, 4, and 5, respectively. For a user's spending amount of 500 yuan, if it falls within the 40%-60% interval, its discrete coded value is 3. For categorical features, integer encoding is used directly. For example, in the gender feature, "male" is coded as 1, and "female" is coded as 2. In this way, the user's multi-dimensional features are converted into discrete coded feature vectors. For example, the feature vector of user A can be represented as [3, 2, 4, 1, 5], corresponding to the discrete coded values ​​of the five different dimensions.

[0055] Based on the discrete coding features, a feature index tree is constructed. The feature index tree is a multi-level tree structure, with each level corresponding to a feature dimension. The root node of the tree represents the set of all users, the first-level nodes represent different discrete values ​​of the first feature dimension, the second-level nodes represent different discrete values ​​of the second feature dimension, and so on. In actual implementation, each node of the feature index tree contains three key pieces of information: the discrete coding value of the current dimension, a set of pointers to child nodes, and a bitmap storage structure. The bitmap storage structure is a binary array whose length is equal to the total number of users in the system. Each position corresponds to a user ID. A value of 1 indicates that the user has the feature combination represented by the current node path, and a value of 0 indicates that the user does not have it. For example, for the node corresponding to the feature dimension [consumption frequency = 3, gender = 2, activity = 4], the 100th bit in its bitmap is 1, indicating that the user with ID 100 has this feature combination.

[0056] When searching for similar users to a target user, first obtain the target user's discretely encoded feature vector. Assuming the feature vector for target user B is [3, 2, 4, 2, 3], start at the root node in the feature index tree and traverse downwards, following the values ​​of each dimension in the feature vector. For example, first visit the node with a value of 3 in the first layer, then visit the node with a value of 2 among its children, then visit the node with a value of 4, and so on, ultimately finding the leaf node or the closest intermediate node that fully matches the target user's features. The bitmap storage structure allows for rapid filtering of candidate user sets with identical or similar feature combinations. To find users who fully match the target user in the first three dimensions, simply obtain the bitmap corresponding to the node in the path [3, 2, 4]. The user IDs corresponding to the positions with a value of 1 in the bitmap are the candidate set.

[0057] For each user in the candidate user set, calculate their comprehensive similarity with the target user. Comprehensive similarity consists of two components: Euclidean distance similarity and normalized mutual information similarity. Euclidean distance similarity reflects the distance relationship between users in a continuous feature space. It is calculated by taking the Euclidean distance of the original feature vectors of two users and then converting the distance value into a similarity component using a transformation function (such as an exponential decay function). For example, if the Euclidean distance between the original feature vectors of users B and C is 2.5, the similarity component obtained by the transformation function is 0.7. Normalized mutual information similarity reflects the correlation between users in terms of categorical features. It is obtained by calculating the mutual information of the categorical feature distributions of the two users and then normalizing it. For example, the normalized mutual information of the categorical features between users B and C is 0.6. The final comprehensive similarity is obtained by weighting the two similarity components. The weights can be adjusted according to business needs. For example, if the weight of Euclidean distance similarity is 0.4 and the weight of normalized mutual information similarity is 0.6, the comprehensive similarity is 0.4 × 0.7 + 0.6 × 0.6 = 0.64.

[0058] To cope with dynamic changes in user features, this method adopts an asynchronous update mechanism. When user features change, the change information, including the user ID and the changed feature vector, is written to a cache queue. The system periodically checks the number of change information in the cache queue. When the number reaches a preset threshold (e.g., 1000), an update of the feature index tree is triggered. The update process includes removing the mark of the changed user in the original feature path node bitmap (setting the corresponding position to 0) and adding the mark to the new feature path node bitmap (setting the corresponding position to 1). Simultaneously, the comprehensive similarity between the changed user and each user in the candidate user set is recalculated. For example, if user D's features change from [2, 3, 1, 4, 2] to [2, 3, 3, 4, 2], the system removes user D from the bitmap corresponding to the node on the feature path [2, 3, 1] and adds it to the bitmap corresponding to the node on the feature path [2, 3, 3]. The comprehensive similarity between user D and each user in the candidate user set is then recalculated.

[0059] In this embodiment, by constructing a feature index tree and utilizing a bitmap storage structure, the feature path of the target user is quickly located, thereby significantly improving the efficiency of screening candidate users; the dual similarity components of Euclidean distance and normalized mutual information are adopted and weighted combination is performed to improve the accuracy and robustness of the similarity calculation; the feature index tree is asynchronously updated through a cache queue, thereby reducing the computational overhead caused by frequent changes and ensuring the real-time and stability of the system; the multi-dimensional combined feature quantile discrete encoding effectively processes the discrete representation of continuous features, which is beneficial to subsequent indexing and matching operations.

[0060] In an optional embodiment, a hierarchical clustering algorithm is used to group users based on multi-dimensional combined features and similarity relationships, and the user consumption behavior portrait results include: Construct a user similarity matrix based on the user's multi-dimensional combined features and similarity relationships; Taking each user in the user similarity matrix as a user node, performing clustering calculation on the user similarity matrix using a hierarchical clustering algorithm, and initializing each user node as an independent clustering unit; Calculating the distance between cluster units based on the user similarity matrix, where the distance corresponds to the degree of similarity of users in different cluster units; selecting two cluster units with the smallest distance to merge and generate a new cluster unit; Recalculate the distance between the merged cluster unit and other cluster units based on the average link criterion, where the average link criterion is the average of the distances between all user pairs between cluster units; Repeat the process until the preset number of cluster units is reached, and the user grouping result is obtained; Calculate the importance score of each feature in each user group, where the importance score is the product of feature information gain and feature contrast; The importance scores are sorted in descending order, and corresponding features are selected as a feature set for user clustering according to a preset number of preferences, and a consumption behavior portrait result of the user is generated based on the feature set.

[0061] In one specific embodiment, a multi-dimensional combination of user characteristics is obtained. These characteristics include, but are not limited to, basic user attribute information (such as age, gender, occupation, etc.), behavioral data (such as click, browsing, and purchase history), and preference data (such as category preferences and price sensitivity). For example, for user A, characteristics may include: 25 years old, female, office worker, browses electronic product pages 30 times per month, purchases twice per month, has medium price sensitivity, and prefers cosmetics and clothing categories.

[0062] Based on the acquired multi-dimensional combined features of users, the similarity between users is calculated and a user similarity matrix is ​​constructed. Similarity can be calculated using methods such as cosine similarity, Euclidean distance, or the Pearson correlation coefficient. For example, assuming there are five users (U1-U5), the constructed user similarity matrix is ​​as follows: the similarity between U1 and U2 is 0.85, the similarity between U1 and U3 is 0.62, the similarity between U1 and U4 is 0.31, and the similarity between U1 and U5 is 0.42; the similarity between U2 and U3 is 0.75, the similarity between U2 and U4 is 0.28, and the similarity between U2 and U5 is 0.35; the similarity between U3 and U4 is 0.53, the similarity between U3 and U5 is 0.40, and the similarity between U4 and U5 is 0.80. Higher similarity values ​​indicate greater similarity between users.

[0063] Each user in the user similarity matrix is ​​treated as a user node, and a hierarchical clustering algorithm is used for clustering. Initially, each user node is initialized as an independent cluster unit. For example, for the five users mentioned above, there are initially five cluster units: C1 = {U1}, C2 = {U2}, C3 = {U3}, C4 = {U4}, and C5 = {U5}.

[0064] The distance between clusters is calculated based on the user similarity matrix. The distance value represents the degree of similarity between users in different clusters. Since each cluster initially contains only one user, the distance between clusters is the distance between users (the inverse of the similarity). In this example, the two clusters with the smallest distance are C1 and C2 (with a similarity of 0.85, the smallest distance). Therefore, C1 and C2 are merged into a new cluster C12 = {U1, U2}.

[0065] After merging, the distances between the merged cluster unit and the other cluster units need to be recalculated based on the average linkage criterion. The average linkage criterion refers to calculating the average distance between all pairs of users in the two cluster units. For example, when calculating the distance between C12 and C3, it is necessary to calculate (the distance between U1 and U3 + the distance between U2 and U3) / 2, which is (1 / 0.62+1 / 0.75) / 2=1.47. Similarly, the distance between C12 and C4 is calculated as (1 / 0.31+1 / 0.28) / 2=3.42, and the distance between C12 and C5 is (1 / 0.42+1 / 0.35) / 2=2.56.

[0066] Continue the clustering process, selecting the two clusters with the smallest distance to merge. Currently, the distance between C3 and C12 is the smallest, so merge C3 and C12 to form a new cluster C123 = {U1, U2, U3}. Then, calculate the distances between this new cluster and the remaining clusters. For example, the distance between C123 and C4 is (the distance between U1 and U4 + the distance between U2 and U4 + the distance between U3 and U4) / 3, or (1 / 0.31 + 1 / 0.28 + 1 / 0.53) / 3 = 2.79. Similarly, calculate the distance between C123 and C5.

[0067] The above process is repeated until the preset cluster unit number threshold is reached. Assuming that the cluster unit number threshold is set to 2, the final clustering results may be C123 = {U1, U2, U3} and C45 = {U4, U5}, that is, the five users are divided into two groups.

[0068] For each user cluster, calculate the importance score for each feature. The importance score is the product of the feature information gain and the feature contrast. Feature information gain reflects the contribution of the feature to the cluster, while feature contrast reflects the differences between different clusters. For example, for cluster C123, the information gain of the age feature might be 0.35, the contrast is 0.8, and the importance score is 0.28; the information gain of the purchase frequency feature might be 0.45, the contrast is 0.9, and the importance score is 0.405. Similarly, calculate the importance score for each feature in cluster C45.

[0069] Table 1 is the user cluster feature importance score table:

[0070] Sort the importance scores in descending order and select the corresponding features according to the preset number of priorities as the feature set for user clustering. Assuming the number of priorities is 3, for the C123 cluster, the three most important features might be purchase frequency (0.405), price sensitivity (0.375), and category preference (0.336); for the C45 cluster, the three most important features might be browsing time (0.42), purchase frequency (0.385), and age (0.35).

[0071] Generate a user's consumer behavior profile based on a selected set of features. For example, the user profile for the C123 segment could be described as "a user group with high purchase frequency, moderate price sensitivity, and a preference for cosmetics and clothing." The user profile for the C45 segment could be described as "a user group with long browsing time, low purchase frequency, and an older age group." These user profiles can be used in business scenarios such as personalized recommendations, precision marketing, and product optimization.

[0072] Through the above method, accurate grouping based on multi-dimensional characteristics of users is achieved, and user consumption behavior portraits with business value are generated, providing data support for the refined operation of e-commerce platforms.

[0073] In an optional implementation, performing clustering calculation on the user similarity matrix using a hierarchical clustering algorithm includes: Based on the user similarity matrix, according to a preset most similar number threshold, a corresponding number of most similar user nodes are selected for a user node to establish connection relationships and construct a neighbor relationship graph; Calculate the similarity distance between each user node and adjacent nodes in the neighbor relationship graph to obtain the local density value, and calculate the distance from each user node to all nodes with a local density value greater than itself, and select the minimum value as the relative distance value of the user node; Multiply the local density value of each user node by the relative distance value to obtain a core metric sequence. Perform a differential operation on the core metric sequence to obtain a differential sequence. Calculate the core set threshold through the mutation point of the differential sequence, and filter to obtain the core set. Calculate the connection paths between non-core user nodes and each core user node, select the maximum local density value of all user nodes on the connection path, and divide the corresponding non-core user node into the cluster unit where the corresponding core user node is located; Calculate the ratio of the number of edges and the product of the scale between adjacent cluster units as the connectivity, and construct a cluster unit hierarchical tree; The product of the density accessibility and average connectivity of the cluster unit boundary nodes is calculated as the stability value, and the boundary nodes below the preset stability threshold are re-divided into the cluster unit with the highest stability, and finally the optimized user grouping results are output.

[0074] In a specific embodiment, based on the user similarity matrix obtained in the above steps, according to the preset most similar number threshold, a corresponding number of most similar user nodes are selected for each user node to establish a connection relationship, and a neighbor relationship graph is constructed. The most similar number threshold can be flexibly adjusted according to the actual application scenario. For example, it is set to 20, which means that the 20 user nodes with the highest similarity are selected for each user node to establish a connection. Taking user A as an example, the row vector of its similarity matrix is ​​[0.85, 0.92, 0.76, 0.68, 0.95, 0.72...], and the user nodes corresponding to the top 20 maximum values ​​are selected to establish a connection relationship with user A. The edge weight in the neighbor relationship graph is the similarity value between the corresponding nodes. For example, the edge weight between user A and user E is 0.95, indicating that the consumption behavior of the two is highly similar.

[0075] The local density value is calculated by calculating the similarity distance between each user node and its adjacent nodes in the neighbor relationship graph. The distance from each user node to all nodes with a local density value greater than its own is then calculated, and the minimum value is selected as the relative distance value of the user node. The local density value is calculated using a distance conversion method. For user node i, its local density value is equal to the sum of the similarities of all nodes j connected to it. The higher the similarity, the smaller the corresponding distance and the greater the contribution to the local density value. For example, if the sum of the similarities between user A and its 20 adjacent nodes is 17.5, then its local density value is 17.5. When calculating the relative distance value, for each user node i, the set of nodes with a local density value greater than i is found, the distance from i to these nodes (the inverse of the similarity) is calculated, and the minimum value is selected. For example, if user A's local density is 17.5, and there are three nodes (B, C, and D) with local density values ​​of 18.2, 19.1, and 17.8, respectively, all greater than user A's local density, the calculated distances from user A to these three nodes are 1.25, 1.42, and 1.33, respectively. Therefore, user A's relative distance is 1.25. If the user's node has the largest local density in the entire graph, its relative distance is set to the maximum distance between all nodes in the graph.

[0076] Multiply the local density value of each user node by its relative distance value to obtain a core metric sequence. This core metric sequence is then differentiated to obtain a differential sequence. The core set threshold is calculated based on the mutation points in the differential sequence, and the core set is then filtered. The core metric sequence is sorted in descending order, and the differences between adjacent elements are calculated to obtain the differential sequence. Mutation points in the differential sequence represent locations where the difference increases significantly. These can be identified by setting a threshold for the rate of change in the difference (e.g., 50%). The core metric corresponding to the mutation point is used as the core set threshold, and user nodes with a core metric value greater than or equal to this threshold constitute the core set. For example, the descending core metric sequence is [58.2, 56.9, 55.8, 54.2, 52.7, 34.8, 33.5...], and the difference sequence is [1.3, 1.1, 1.6, 1.5, 17.9, 1.3...]. A significant difference of 17.9 appears between the 5th and 6th elements, which is much larger than the previous differences. Therefore, the mutation point is identified, and the core set threshold is set to 52.7. The core set contains 5 user nodes with core metric values ​​greater than or equal to 52.7.

[0077] Calculate the connection paths between the user nodes in the non-core set and the user nodes in each core set, select the maximum local density value of all user nodes on the connection path, and divide the corresponding user nodes in the non-core set into the cluster unit where the corresponding user nodes in the core set are located. The connection path is calculated by the breadth-first search algorithm, starting from the user nodes in the non-core set, and finding the shortest path to each user node in the core set. For each path, record the local density values ​​of all nodes on the path and find the maximum value. Compare the maximum density values ​​of different paths, and divide the user nodes in the non-core set into the cluster unit where the user nodes in the core set connected by the path with the largest maximum density value are located. For example, user F belongs to the non-core set, and the three paths to the core set user nodes G, H, and I are found through breadth-first search. The maximum local density values ​​of the nodes on the paths are 15.8, 17.2, and 14.6, respectively. Then user F is divided into the cluster unit where user H is located.

[0078] The connectivity is calculated as the ratio of the number of edges multiplied by the size between adjacent clusters, and a hierarchical tree of clusters is constructed. Adjacent clusters are directly connected, the number of edges refers to the number of edges between two clusters, and the size product refers to the product of the number of user nodes contained in the two clusters. Connectivity is calculated as the number of edges divided by the size product, with larger values ​​indicating closer connections between the two clusters. When constructing a hierarchical tree based on connectivity, cluster pairs with the highest connectivity are merged, gradually forming a hierarchical structure. For example, if clusters C1 and C2 have 30 edges connecting them, C1 contains 50 user nodes, and C2 contains 40 user nodes, then the connectivity between them is 30 / (5040) = 0.015. If clusters C2 and C3 have 25 edges connecting them, and C3 contains 45 user nodes, then the connectivity between them is 25 / (4045) = 0.0139. Since C1 and C2 have a higher connectivity, merging C1 and C2 is prioritized.

[0079] The stability value is calculated by multiplying the density reachability and average connectivity of the boundary nodes of a cluster unit. Boundary nodes with a stability value below a preset threshold are reassigned to the cluster unit with the highest stability. The optimized user clustering results are then output. A boundary node is a user node that has connections to multiple cluster units. Density reachability refers to the ratio of the minimum local density value on the path from the core node to the boundary node to the local density value of the core node. Average connectivity refers to the average degree of connectivity between the boundary node and other nodes within the cluster unit. A higher stability value indicates a more stable boundary node's membership in the current cluster unit. For boundary nodes with a stability value below a preset threshold (e.g., 0.5), the stability value of the boundary node relative to each cluster unit is calculated, and the node is reassigned to the cluster unit with the highest stability value. For example, user J is a boundary node of cluster unit C4. Its stability value is 0.42, which is below the preset threshold of 0.5. The stability value of the boundary node relative to the adjacent cluster unit C5 is calculated to be 0.68. Therefore, user J is reassigned from C4 to C5.

[0080] Traditional user clustering methods are primarily based on general-purpose clustering algorithms such as K-means and DBSCAN. These methods suffer from the following issues: It's difficult to determine the optimal number of clusters; they are sensitive to noise and outliers; they are poorly suited for clustering non-convex shapes; and they fail to fully exploit the local structural characteristics of user behavior. Existing improved methods, such as spectral clustering, can handle complex structures, but their high computational complexity makes them difficult to apply to large-scale user data. While density peak clustering doesn't require a pre-set number of clusters, it's sensitive to parameters, lacks adaptability in core point selection, and results in unstable attribution of boundary nodes.

[0081] The method of this embodiment introduces a method for constructing a neighbor relationship graph based on a similarity matrix, adaptively determining the connection relationship through the most similar number threshold, avoiding the computational redundancy of the fully connected graph; adopts a core measurement mechanism that combines local density values ​​with relative distance values, automatically identifies mutation points through differential sequences to determine the core set threshold, and realizes adaptive selection of core points; proposes a non-core point allocation strategy based on density paths, considering the density distribution on the connection path, and more accurately captures the continuous changes in user behavior characteristics; designs a clustering unit connectivity and stability evaluation mechanism, optimizes clustering results by redistributing boundary nodes, and improves clustering stability. This solves the problem of insufficient adaptability of traditional clustering methods in user consumption behavior analysis and improves the accuracy and interpretability of clustering results.

[0082] Figure 2 Figure 1 shows a performance comparison between a user profiling method based on hierarchical clustering and traditional clustering algorithms. The proposed hierarchical clustering method significantly outperforms other algorithms in terms of clustering accuracy (0.87), stability index (0.89), and interpretability score (0.92). In particular, the proposed method outperforms the next-best algorithm by 0.15 points in interpretability, demonstrating its ability to more accurately capture user consumption behavior. In terms of computational efficiency, while slightly lower than K-means (0.84) at 0.77, it still outperforms density peak clustering and DBSCAN, demonstrating a well-balanced performance.

[0083] Density peak clustering performed relatively stably across all metrics, while K-means, while computationally efficient, performed poorly in terms of stability and interpretability. DBSCAN performed at an intermediate level across all metrics, but had the lowest interpretability (0.50).

[0084] The neural network-based multi-dimensional user consumption behavior portrait analysis system of the embodiment of the present invention includes: The first unit is used to obtain the user's historical consumption behavior data, construct the initial feature vector through feature engineering, and obtain the basic feature vector; The second unit is used to perform feature decomposition based on the basic feature vector using a subsequence dynamic pruning algorithm, calculate sequence similarity based on entropy-weighted local sensitive mapping, identify the minimum feature unit through an iterative compression and reconstruction process, and determine the key time series features; The third unit is used to extract temporal dependencies based on key temporal features using a pre-trained bidirectional long short-term memory neural network to obtain consumer behavior sequence features; The fourth unit is used to build a multi-task adversarial feature extraction network based on the characteristics of consumer behavior sequences. It eliminates scene bias through joint optimization and contrast loss function to obtain scene-invariant features. The fifth unit is used to perform nonlinear feature fusion through a multi-layer perceptron based on key temporal features, consumer behavior sequence features, and scene-invariant features to obtain multi-dimensional combined features; The sixth unit is used to construct a feature index tree based on multi-dimensional combined features using discrete coding, combined with bitmap filtering and asynchronous update mechanism to obtain the similarity relationship between users; The seventh unit is used to group users based on multi-dimensional combination features and similarity relationships using a hierarchical clustering algorithm to obtain user consumption behavior portraits.

[0085] According to a third aspect of an embodiment of the present invention, an electronic device is provided, including: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the aforementioned method.

[0086] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described above is implemented.

[0087] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.

[0088] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A multi-dimensional portrait analysis method for user consumption behavior based on neural networks, characterized by: include: Obtain user historical consumption behavior data, construct an initial feature vector through feature engineering, and obtain a basic feature vector; Based on the basic feature vector, a subsequence dynamic pruning algorithm is used to perform feature decomposition, and sequence similarity is calculated based on the entropy-weighted local sensitive mapping. The minimum feature unit is identified through an iterative compression and reconstruction process to determine the key time series features. Based on key temporal features, a pre-trained bidirectional long short-term memory neural network is used to extract temporal dependencies and obtain the sequential features of consumer behavior. Based on the characteristics of consumer behavior sequences, a multi-task adversarial feature extraction network is constructed. The scene bias is eliminated through joint optimization and contrast loss function to obtain scene-invariant features. Based on key temporal features, consumer behavior sequence features, and scene-invariant features, a multi-layer perceptron is used to perform nonlinear feature fusion to obtain multi-dimensional combined features. Based on the multi-dimensional combined features, discrete coding is used to construct a feature index tree, combined with bitmap filtering and asynchronous update mechanism to obtain the similarity relationship between users; Based on the multi-dimensional combination characteristics and similarity relationships, a hierarchical clustering algorithm is used to group users and obtain the user consumption behavior portrait results.

2. The method according to claim 1, characterized in that Based on the basic feature vector, a subsequence dynamic pruning algorithm is used to perform feature decomposition. Sequence similarity is calculated based on entropy-weighted local sensitive mapping. The minimum feature unit is identified through an iterative compression and reconstruction process. Key time series features are determined, including: The basic feature vector is segmented according to the preset window size to obtain multiple feature subsequences; The difference between the overall entropy and the conditional entropy of the feature subsequence is calculated to obtain the information gain of the feature subsequence. Based on the information gain of the feature subsequence, the historical pruning results are updated by exponential moving average to obtain the dynamic threshold for feature retention; Comparing the information gain of the feature subsequence with the dynamic threshold, eliminating the feature subsequence that does not meet the threshold requirement according to the comparison result to obtain a retained sequence; calculating the feature entropy value of the retained sequence, and obtaining the feature weight through normalization; Based on the feature weights, performing local sensitive mapping on the retained sequence by constructing a random projection vector group, and calculating the weighted Hamming distance in the mapping space to obtain a sequence similarity matrix; According to the sequence similarity matrix, the retained sequence is compressed and encoded by an autoencoder to obtain a compressed feature; the compressed feature is reconstructed, and an error value between the reconstructed sequence and the retained sequence is calculated to obtain a reconstruction deviation; Based on the comparison result of the reconstructed deviation and the preset deviation threshold, iterative optimization is performed by adjusting the compression coefficient to determine the target compression coefficient, and the minimum feature unit is extracted from the compression feature according to the target compression coefficient to obtain the key timing feature.

3. The method according to claim 2, characterized in that Based on the feature weights, a local sensitive mapping is performed on the retained sequence by constructing a random projection vector group, and the weighted Hamming distance in the mapping space is calculated to obtain a sequence similarity matrix including: Constructing a weight matrix according to the feature weight of each feature in the retained sequence, wherein the diagonal elements of the weight matrix are normalized feature weights; Constructing a random projection vector group, wherein the dimension of each random projection vector in the random projection vector group is the same as the characteristic dimension of the retained sequence, and the elements obey the standard normal distribution; Representing the retained sequence as a sequence matrix, and performing a weighted transformation on the sequence matrix using the weight matrix to obtain a weighted sequence matrix; Performing a product operation on the weighted sequence matrix and each random projection vector in the random projection vector group, and performing a sign function transformation to obtain a binary hash code; Calculating, according to the projection weight coefficients corresponding to the random projection vector group, a weighted Hamming distance between binary hash codes corresponding to any two sequences in the retained sequence; Substituting the weighted Hamming distance into an exponential function for distance conversion, wherein the exponential function includes a smoothing factor for adjusting similarity sensitivity, to obtain a similarity value between sequences; The similarity values ​​between any two sequences in the retained sequence are calculated to construct a sequence similarity matrix.

4. The method according to claim 1, wherein Based on the characteristics of consumer behavior sequences, a multi-task adversarial feature extraction network is constructed. Through joint optimization and contrast loss function, scene bias is eliminated, and scene-invariant features are obtained, including: Construct a dual-branch feature extraction network, perform multi-layer nonlinear transformation on the consumer behavior sequence features to obtain the first feature representation, and perform attention encoding on the scene information to obtain the second feature representation; Inputting the first feature representation and the second feature representation into a feature fusion layer to obtain a fused feature representation, and inputting the fused feature representation into a scene discriminator to perform scene classification; Calculating an adversarial loss value based on the classification result of the scene discriminator, selecting a behavior sequence pair of the same user from the consumption behavior sequence features, and calculating a cosine similarity value between the fusion feature representations corresponding to the behavior sequence pair; Calculating a contrast loss value based on the cosine similarity value, and performing a weighted combination of the adversarial loss value and the contrast loss value to obtain a total loss value; Back propagation is performed according to the total loss value to update the parameters of the dual-branch feature extraction network to obtain a feature extraction model, and scene invariant features are extracted through the feature extraction model.

5. The method according to claim 1, wherein Based on the multi-dimensional combined features, discrete coding is used to construct a feature index tree. Combined with bitmap filtering and asynchronous update mechanism, the similarity relationship between users is obtained, including: Dividing the multi-dimensional combined features into discrete intervals according to quantiles, mapping the discrete intervals into discrete coded values, and converting the multi-dimensional combined features into discrete coded features; Constructing a feature index tree based on the discrete coding features, wherein each node layer of the feature index tree corresponds to a feature dimension, each node stores a discrete coding value of the corresponding dimension, and a bitmap storage structure is set at each node of the feature index tree; Obtaining discrete coding features of a target user, locating a feature path of the target user in the feature index tree, and performing filtering through the bitmap storage structure to obtain a set of candidate users; Performing a Euclidean distance calculation on the feature vector of each user in the candidate user set to obtain a first similarity component, performing a normalized mutual information calculation to obtain a second similarity component, and performing a weighted combination of the first similarity component and the second similarity component to obtain a comprehensive similarity; Writing the change information of the user characteristics into a cache queue, periodically detecting the amount of change information in the cache queue, and performing asynchronous update on the characteristic index tree when the amount of change information reaches a preset threshold; Recalculate the comprehensive similarity of each user in the candidate user set corresponding to the changed user to obtain the similarity relationship between users.

6. The method according to claim 1, characterized in that Based on the multi-dimensional combination characteristics and similarity relationships, a hierarchical clustering algorithm is used to group users, and the user consumption behavior portrait results include: Construct a user similarity matrix based on the user's multi-dimensional combined features and similarity relationships; Taking each user in the user similarity matrix as a user node, performing clustering calculation on the user similarity matrix using a hierarchical clustering algorithm, and initializing each user node as an independent clustering unit; Calculating the distance between cluster units based on the user similarity matrix, where the distance corresponds to the degree of similarity of users in different cluster units; selecting two cluster units with the smallest distance to merge and generate a new cluster unit; Recalculate the distance between the merged cluster unit and other cluster units based on the average link criterion, where the average link criterion is the average of the distances between all user pairs between cluster units; Repeat the process until the preset number of cluster units is reached, and the user grouping result is obtained; Calculate the importance score of each feature in each user group, where the importance score is the product of feature information gain and feature contrast; The importance scores are sorted in descending order, and corresponding features are selected as a feature set for user clustering according to a preset number of preferences, and a consumption behavior portrait result of the user is generated based on the feature set.

7. The method according to claim 6, characterized in that Performing clustering calculation on the user similarity matrix using a hierarchical clustering algorithm includes: Based on the user similarity matrix, according to a preset most similar number threshold, a corresponding number of most similar user nodes are selected for a user node to establish connection relationships and construct a neighbor relationship graph; Calculate the similarity distance between each user node and adjacent nodes in the neighbor relationship graph to obtain the local density value, and calculate the distance from each user node to all nodes with a local density value greater than itself, and select the minimum value as the relative distance value of the user node; Multiply the local density value of each user node by the relative distance value to obtain a core metric sequence. Perform a differential operation on the core metric sequence to obtain a differential sequence. Calculate the core set threshold through the mutation point of the differential sequence, and filter to obtain the core set. Calculate the connection paths between non-core user nodes and each core user node, select the maximum local density value of all user nodes on the connection path, and divide the corresponding non-core user node into the cluster unit where the corresponding core user node is located; Calculate the ratio of the number of edges and the product of the scale between adjacent cluster units as the connectivity, and construct a cluster unit hierarchical tree; The product of the density accessibility and average connectivity of the cluster unit boundary nodes is calculated as the stability value, and the boundary nodes below the preset stability threshold are re-divided into the cluster unit with the highest stability, and finally the optimized user grouping results are output.

8. A multi-dimensional user consumption behavior portrait analysis system based on a neural network, used to implement the method according to any one of claims 1 to 7, characterized in that: include: The first unit is used to obtain the user's historical consumption behavior data, construct the initial feature vector through feature engineering, and obtain the basic feature vector; The second unit is used to perform feature decomposition based on the basic feature vector using a subsequence dynamic pruning algorithm, calculate sequence similarity based on entropy-weighted local sensitive mapping, identify the minimum feature unit through an iterative compression and reconstruction process, and determine the key time series features; The third unit is used to extract temporal dependencies based on key temporal features using a pre-trained bidirectional long short-term memory neural network to obtain consumer behavior sequence features; The fourth unit is used to build a multi-task adversarial feature extraction network based on the characteristics of consumer behavior sequences. It eliminates scene bias through joint optimization and contrast loss function to obtain scene-invariant features. The fifth unit is used to perform nonlinear feature fusion through a multi-layer perceptron based on key temporal features, consumer behavior sequence features, and scene-invariant features to obtain multi-dimensional combined features; The sixth unit is used to construct a feature index tree based on multi-dimensional combined features using discrete coding, combined with bitmap filtering and asynchronous update mechanism to obtain the similarity relationship between users; The seventh unit is used to group users based on multi-dimensional combination features and similarity relationships using a hierarchical clustering algorithm to obtain user consumption behavior portraits.

9. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Pharmacy member group portrait construction method

    CN117391765A

  • Consumption portrait-based user repayment risk prediction method and system

    CN118569981A

  • Visitor identification and multi-dimensional user portrait routing distribution method based on private domain traffic

    CN119172298A

  • Private domain live broadcast user behavior analysis and drainage recommendation method based on deep learning

    CN119311952A

  • User behavior analysis method based on multi-source information

    CN119415980A

Cited By

  • User portrait optimization method and system based on big data

    CN121188413A

  • Big data-based user portrait optimization method and system

    CN121188413B