Personalized commodity recommendation method based on time period granularity modeling

By employing a personalized product recommendation method based on time-period granular modeling, and combining user profiles and historical interaction data, a dynamic mask matrix is ​​generated for attention calculation. This addresses the issue of dynamically changing user interests and achieves more accurate recommendation results.

CN121120214APending Publication Date: 2025-12-12TIANJIN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511354119.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-22
Publication Date
2025-12-12

AI Technical Summary

Technical Problem

Existing recommendation systems struggle to accurately capture the differences in user interests across different time periods when user interests change dynamically, leading to a decline in recommendation accuracy and user satisfaction.

Method used

By constructing a personalized product recommendation method based on time-period granular modeling, combining user profile features and historical product interaction sequences, and using time-period feature values ​​to generate a dynamic mask matrix, local and global attention calculations are performed to capture changes in user interests at different time periods.

Benefits of technology

It improves the accuracy and personalization of recommendations, enabling more precise adaptation to users' behavioral patterns over time, thereby enhancing user experience and platform conversion efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure QLYQS_11
    Figure QLYQS_11
  • Figure QLYQS_12
    Figure QLYQS_12
Patent Text Reader

Abstract

The invention discloses a personalized commodity recommendation method based on time period granularity modeling. The method comprises the following steps: starting to construct a complete user behavior sequence, extracting a timestamp, generating a unique time period characteristic value, constructing a dynamic mask mechanism from a local mask to a global mask, obtaining a final local attention score and a global attention score, and obtaining a final user behavior sequence; selecting the last vector of the final global attention score output sequence as the comprehensive interest expression of the user at the next moment, and performing similarity calculation on the predicted target commodity embedding vector and the last vector to obtain the most relevant Top-K commodities, the invention further provides an electronic device and a non-transitory computer readable storage medium for executing the method. The commodity recommendation accuracy is effectively improved, real-time dynamic adjustment of recommended commodities can be achieved by flexibly capturing interest changes of the user in different time periods, the recommendation result better meets the personalized requirements of the user in all the time periods, and then the user experience and the platform conversion efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of personalized recommendation technology, specifically a personalized product recommendation method based on time-time granularity modeling. Background Technology

[0002] In an era of exploding information volume and intensive dissemination, recommender systems, as a crucial tool for alleviating information overload and enhancing user experience and business conversion, have gradually become an important research direction in the field of artificial intelligence. Recommender systems analyze users' historical interaction behavior and interests to filter personalized candidate products from a massive amount of goods. However, user interests are not static but dynamically evolve over time. If the model ignores this crucial information of time, the recommendation results often fail to match the actual needs of users at different times, leading to a decline in recommendation accuracy and user satisfaction.

[0003] In existing research, sequence recommendation models are commonly used to capture the changing trends of user behavior over time. These methods typically organize users' interaction history into a sequence input model to learn dynamic patterns of user interests. Early methods relied heavily on simple operations like pooling, but their expressive power was limited. With the development of deep learning, various architectural innovations have been proposed. For example, models based on self-attention mechanisms can capture global dependencies in sequences and have become mainstream, but they still have shortcomings. Firstly, the use of temporal information is insufficient. Most existing methods only represent time factors by embedding information such as timestamps into the input sequence or by simply adjusting attention weights, making it difficult to characterize the differences in user interests across different time periods with fine granularity. Secondly, there is a lack of dynamic modeling at the time-time granularity. User interests often have strong time dependencies; for example, user behavior differs significantly in the morning, noon, and evening. If the model cannot flexibly model changes in users' short-term and long-term interests across different time periods, it is difficult to guarantee the accuracy and personalization of recommendations.

[0004] Therefore, there is an urgent need to develop a personalized product recommendation method based on time-time granularity modeling to solve the above problems. Summary of the Invention

[0005] One of the objectives of this invention is to provide a personalized product recommendation method based on time-time granularity modeling to solve the problems mentioned in the background art.

[0006] To achieve the above objectives, this invention provides a personalized product recommendation method based on time-time granularity modeling, characterized by the following steps: S101. Obtain user profile features Interactive product series with history and build user data sets User embedding vectors are obtained by constructing an embedding table that matches the features of each user profile. ; By analyzing historical interaction product sequences Constructing product feature sequences And for each product feature sequence Construct the corresponding embedding table to obtain the interactive product embedding vector. ; Based on user embedding vector and interactive product embedding vectors The complete user behavior sequence is as follows: (1) (1); in, For a complete user behavior sequence, This is the user embedding vector located at the first position in the complete user behavior sequence. This represents the vector concatenation operation. Represents the truncated or padded interactive product embedding vector Interactive product embedding vector Arranged in chronological order d represents the length of the user interaction sequence, and d represents the output dimension of the interactive product embedding vector.

[0007] S201. Extract the interaction timestamp sequence corresponding to the historical interactions from the historical interaction product sequence, and extract the date value. with hourly value According to hourly values Get the time period flag value Then, the date value and the time period flag value are combined into a unique time period feature value: (2); in, These are the characteristic values ​​for a time period. For date values, is the time period marker value, and L is the length of the user interaction sequence.

[0008] S301. Obtain the user according to formula (2) The time-period feature sequence is obtained, and a row expansion matrix and a column expansion matrix are constructed for comparison. The user's data is obtained through element-by-element equality comparison of the expansion matrices. Local mask matrix A causal mask matrix is ​​superimposed on the local mask matrix. The final local mask matrix is ​​obtained. : (3); in This represents the final local mask matrix. Represents a local mask matrix. This indicates element-wise multiplication. Represents the causal mask matrix; Global mask matrix Using a causal mask matrix: (4); in, Represents the global mask matrix. Represents the causal mask matrix; S401. Obtain the complete user behavior sequence from equation (1) With the corresponding position embedding vector Adding them together yields the complete user behavior sequence features after location enhancement. Subsequently, a multi-attention mechanism of a deep learning model is used to perform calculations in both the local and global attention stages. The final local attention score is obtained through calculation in the global attention stage. The global attention calculation stage is obtained through calculation. .

[0009] S501. Obtain User The final global attention score output sequence is used to select the last vector as the user's comprehensive interest expression at the next time step. The last vector is the output vector of the last time step in the final global attention score output sequence.

[0010] Define the target product set for prediction as Establish the target commodity set for prediction The mapping from the feature values ​​of the predicted target product to the embedding vector of the predicted target product is used to calculate the similarity between the last vector and the embedding vector of the predicted target product. The top-K most relevant products are obtained by ranking them by similarity and used as the predicted recommended products for the user.

[0011] Furthermore, in step S101, by constructing features related to each user profile... The matched embedding table yields the final user embedding vector. Includes the following steps: S111. Define the user set ,in, Represents the total number of users and user profile characteristics. N represents the total number of profile features, such as gender, age, and education level. S112. For each user profile feature Construct the corresponding user profile feature embedding table and map it to user profile feature embedding vectors. The mapping process is as follows: (5); in, Embed vectors for user profile features. Indicates the first User profile feature embedding table Indicates the first The value range of each user profile feature. This represents the dimension of the mapped user profile feature embedding vector; S113. Concatenate all user profile feature embedding vectors, and then transform them to a uniform dimension using a feature mapping function to obtain the user embedding vector: (6); Where, vector Represents the user embedding vector. Represents the user feature mapping function. This represents the vector concatenation operation. Indicates the dimension of the user embedding vector; In step S101, by analyzing the historical interactive product sequence Constructing product feature sequences And for each product feature sequence Construct the corresponding embedding table to obtain the interactive product embedding vector. Includes the following steps: S121. Constructing a Commodity Feature Sequence ,in , Indicates the first Product feature sequence, Indicates user No. The first interactive product For each product feature sequence, an embedding table is constructed to obtain the product sequence feature embedding vector. The mapping process is represented as follows: (7); in, Indicates the first The product sequence feature embedding matrix corresponding to the product sequence features of the class. This represents the embedding table corresponding to the product sequence features. This indicates the range of values ​​for the product sequence feature. This represents the dimension of the embedding vector of the product sequence features after mapping; S122. After concatenating all product sequence feature embedding vectors, the product feature mapping function is used to uniformly output the dimension, resulting in the interactive product embedding vector. for: (8); in, Represents the interactive product embedding vector. Represents the product feature mapping function. This represents the operation of concatenating the feature embedding vectors of the corresponding product sequence. This indicates the output dimension of the interactive product embedding vector.

[0012] Furthermore, users The historical interactive product sequence is ,in, For users The actual number of interacted items, and the historical interacted item sequence is arranged in ascending order of timestamps.

[0013] Further, step S201, which involves extracting the interaction timestamp sequence corresponding to the historical interactions from the historical interaction product sequence, includes the following steps: S211. Define User The historical interaction timestamp sequence is ,in This represents a placeholder for user information at the first position in the historical interaction timestamp sequence. Indicates user number The actual timestamp information of this interaction, if Then add at the end As filler value, if Then keep the most recent Each interaction timestamp; In step S201, the date value is extracted. with hourly value According to hourly values Get the time period flag value Then, the feature values ​​for the time period are obtained, including the following steps: S221. Define the parsing function for the date and hour values ​​of each product interaction as follows: (9); in, For date values, This is an hourly value. Based on hourly value Define the time period division function for: (10); in, Indicates time period flag value, time period characteristic value L is the length of the user interaction sequence.

[0014] Further, in step S301, a row extension matrix and a column extension matrix are constructed for comparison. The user's result is obtained through an element-by-element equality comparison of the extended matrices and the column extension matrices. Local mask matrix The steps of superimposing the causal mask matrix include: S311. According to the user The time period feature sequence is The sequence length is uniformly L, and the row expansion matrix is: (11); The column extended matrix is: (12); Get users The local mask matrix is: (13); in, , Represents the first element in the local mask matrix. The time-time feature value of each location, Represents the first element in the local mask matrix. The time-time feature value of each location, S312. The causal mask matrix is ​​defined as follows: (14); in Let L represent the causal mask matrix, and let L represent the length of the causal mask matrix.

[0015] Furthermore, the local attention computation phase includes the following steps: S411. During the local attention calculation stage, the complete user behavior sequence features after location enhancement are processed. Perform linear projection to obtain the local attention query matrix. Local attention key matrix and local attention value matrix Then the local attention score was calculated. According to local attention scores The final local attention score is: (15); in, Represents the score of local attention Perform a normalization operation so that the sum of the attention weights for each row is 1. Represents the local attention value matrix; In step S401, the global attention calculation phase includes the following steps: S421. During the global attention calculation phase, the final local attention score will be calculated. As input for global attention calculation Perform linear projection to obtain the global attention query matrix. Global attention key matrix and global attention value matrix Then the global attention score was calculated. Based on global attention score Obtain the final global attention score for: (16); in, Represents the final global attention score Perform a normalization operation so that the sum of the attention weights for each row is 1. This represents the global attention value matrix.

[0016] Furthermore, in step S401, the complete user behavior sequence features after location enhancement... for: (17); In step S411, the local attention score is calculated for local attention. The steps include: S412. For users after location enhancement Complete behavioral sequence features Perform linear projection to obtain the local attention query matrix. Local attention key matrix and local attention value matrix for: , , (18); in, , , For the projection matrix to be learned, For the dimension of attention head, S413. Calculate the local attention score for: (19); in, For local attention scores, For local attention query matrix, For local attention key matrix, For the dimension of attention head, The local mask matrix generated by equation (3); In step S421, the global attention score is calculated. The steps include: S422. Obtain the global attention query matrix. Global attention key matrix and global attention value matrix for: , , (20); in, , , For another set of learned projection matrices, S423 calculates the global attention score. : (twenty one); in, The global attention score. For global attention query matrix, The global attention key matrix, For the dimension of attention head, The global mask matrix obtained by equation (4) is given.

[0017] Further, in step S501, the user is obtained. The final global attention score output sequence is as follows: (twenty two); in, Indicates user The final global attention score output sequence, Expression (22) in the first The output vector at each time step, with the last vector being the user's... The final sequence output is the output vector of the last time step. .

[0018] In step S501, the target product set is predicted. The mapping relationship from the predicted target product feature values ​​to the predicted target product embedding vector is as follows: (twenty three); in, This indicates the predicted feature value of the target product. This represents the predicted target product embedding vector. Indicates goods The value of the m-th feature, Represents the product feature mapping function. This indicates the operation of concatenating the predicted feature values ​​of the target product at the corresponding positions. This represents the embedding table corresponding to the product sequence features.

[0019] Another object of the present invention is to provide an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a method for personalized product recommendation based on time-time granularity modeling according to any one of claims 1 to 8.

[0020] Another object of the present invention is to provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the personalized product recommendation method based on time-time granularity modeling as claimed in any one of claims 1 to 8.

[0021] Compared with the prior art, the beneficial effects of the present invention are: 1. This invention constructs a behavioral sequence containing complete user information, effectively integrating and organizing user profile features (such as gender, age, etc.) and user interaction product features (such as category, price, etc.) into a sequence form. This solves the problem of the separation between user profiles and product features and the incomplete basic data for recommendations, and provides comprehensive behavioral data support for personalized product recommendations.

[0022] 2. This invention innovatively proposes a method for modeling user interaction behavior sequences based on time period granularity. By constructing time period features through the timestamp information of the interaction sequence, it fully considers the differences in user needs at different time periods as well as the common needs at the same time period, thereby making the recommended products more accurately match the user's behavioral patterns in the time dimension.

[0023] 3. The dynamic masking mechanism designed in this invention is applicable to both local and global information capture. It can personalize the masking strategy according to the time period characteristics of different users, effectively improving the model's efficiency in capturing key information and enhancing the accuracy and relevance of personalized recommendations.

[0024] 4. The local-to-global attention computing mechanism proposed in this invention can accurately capture users' short-term local interest preferences and long-term global interest evolution trends at different time periods, effectively breaking through the limitations of traditional feature extraction and significantly enhancing the ability to deeply mine user interests.

[0025] 5. This invention can effectively improve the accuracy of product recommendations on e-commerce platforms. By flexibly capturing changes in users' interests at different times, it can achieve real-time dynamic adjustment of recommended products, making the recommendation results more in line with users' personalized needs and actual intentions at different times, thereby improving user experience and platform conversion efficiency, and has high practical application value. Attached Figure Description

[0026] Figure 1 This is a flowchart of a personalized product recommendation method based on time-time granularity modeling. Detailed Implementation

[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0028] To facilitate a proper understanding of the solutions provided in the following embodiments of the present invention, the terms involved in the present invention will be explained as follows before describing the technical solutions provided by the present invention: Transformer-like models: A family of models that are based on the core mechanisms of the original Transformer architecture and are improved and optimized to address specific task pain points. Their core goal is to retain and resolve the limitations of the original architecture in terms of efficiency, generalization, and task adaptability.

[0029] User profile features: In this invention, the category refers to static basic features, which are the core dimensions that characterize the user's inherent attributes or long-term stable state.

[0030] Historical product interaction sequence: A sequence of data records of users' past interactions with products. These interactions include, but are not limited to, purchasing, browsing, rating, and adding to cart.

[0031] Product feature sequence: refers to the sequence formed by arranging various features of a product in a certain order. These features may include the product's basic attributes, functional characteristics, appearance features, brand information, etc.

[0032] Time period feature value: A quantitative indicator extracted from the input time series data according to "time segments" that can characterize the core information of the segment.

[0033] The projection matrix of the learning process: a matrix automatically optimized through model training, used to map data from one feature space to another.

[0034] Complete user behavior sequence: An ordered data sequence that comprehensively records all user interactions related to business objectives within the platform, such as browsing, clicking, adding to cart, purchasing, and favorites, with time as the axis.

[0035] Top-K: From a massive pool of candidate results, select the top K results based on preset ranking metrics such as relevance, similarity, and prediction score.

[0036] The following detailed description is exemplary and intended to provide further detailed explanation of the invention. Unless otherwise specified, all technical terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this invention is for describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention.

[0037] Example 1 Please see Figure 1 This embodiment provides a technical solution, a personalized product recommendation method based on time-time granularity modeling, including the following steps: S101. Obtain user profile features Interactive product series with history and build user data sets User embedding vectors are obtained by constructing an embedding table that matches the features of each user profile. User profile characteristics As the starting position feature of the sequence, it is used to provide an initial reference for product recommendations when the user's historical interaction records are insufficient or missing. The user profile features are static features such as gender, age, education, and occupation.

[0038] By analyzing historical interaction product sequences Constructing product feature sequences And for each product feature sequence Construct the corresponding embedding table to obtain the interactive product embedding vector. Product feature sequence Each location corresponds to an interactive product, which includes not only the product identifier ID (ID) feature, but also the product's category features, price features, and other contextual features, such as the type of interaction behavior and rating.

[0039] Based on user embedding vector and interactive product embedding vectors The complete user behavior sequence is as follows: (1) (1); in, For a complete user behavior sequence, This is the user embedding vector located at the first position in the complete user behavior sequence. This represents the vector concatenation operation. Represents the truncated or padded interactive product embedding vector Interactive product embedding vector Arranged in chronological order Let d be the length of the user interaction sequence, and d be the output dimension of the interactive product embedding vector. This sequence construction method enables cold-start recommendations based on user profile features when there are no historical user interaction sequences, and also allows for in-depth analysis of user interests by fully utilizing product feature sequences when user interaction data is abundant.

[0040] S201. A method for modeling user interaction sequences based on time period granularity is proposed. By utilizing the time information of users' historical interaction behavior, a time period granularity modeling mechanism is introduced to more accurately depict the behavioral patterns and demand differences of users in different time periods. First, the timestamp information corresponding to each interaction is extracted from the user's historical product interaction sequence. Then, the timestamps are converted to obtain date and hour values. To improve the ability to represent the time dimension, this embodiment divides 24 hours into six time periods: early morning, morning, noon, afternoon, evening, and midnight, each corresponding to a fixed time range. Based on this, combined with the date value and the time period identifier, a corresponding time period feature value is established for each of the user's product interactions.

[0041] Specifically, the combination of date value and time period flag value forms a unique time period feature value: (2); in, These are the characteristic values ​​for a time period. For date values, This is a time period marker value; S301. Design a dynamic masking mechanism suitable for capturing local and global information. This mechanism takes time period feature values ​​as the core and dynamically generates corresponding mask matrices according to the time period feature values ​​of different users, thereby effectively distinguishing local interests from global interests during the attention calculation process and improving the model's efficiency in capturing key information.

[0042] Specifically, the user is obtained according to Equation 1 (2). The time-period feature sequence is obtained, and a row expansion matrix and a column expansion matrix are constructed for comparison. The user's data is obtained through element-by-element equality comparison of the expansion matrices. Local mask matrix A causal mask matrix is ​​superimposed on the local mask matrix. The final local mask matrix is ​​obtained. : (3); in This represents the final local mask matrix. Represents a local mask matrix. This indicates element-wise multiplication. Represents the causal mask matrix; Global mask matrix Using a causal mask matrix: (4); in, Represents the global mask matrix. This represents the causal mask matrix.

[0043] It is important to note that different users exhibit significant differences in their interactive behaviors, and their time-segment feature sequences also differ. Therefore, the masking mechanism designed in this invention is not a fixed, static form 1, but rather can be personalized to suit each user's actual interaction. Through this method 1, each user corresponds to a unique mask matrix, enabling the model to more accurately highlight local interest information within the same time segment during attention calculations, while simultaneously preserving the global interest evolution trend across time segments.

[0044] S401. Proposes a "local to global" attention calculation mechanism to capture users' short-term interest preferences and long-term interest evolution trends in different time periods, and realize deep modeling of user interests; Specifically, the complete user behavior sequence obtained from equation 1 (1) With the corresponding position embedding vector Adding them together yields the complete user behavior sequence features after location enhancement. Subsequently, a multi-attention mechanism of a deep learning model is used to perform calculations in both the local and global attention stages. The final local attention score is obtained through calculation in the global attention stage. The global attention calculation stage is obtained through calculation. .

[0045] This step performs local attention calculations on interactive items within the same time period to extract short-term local preference features of users within that time period. Then, using a global mask matrix, it uniformly models historical interactions across different time periods, thereby capturing the long-term evolution trend of user interests. Through the synergistic effect of local and global attention mechanisms, the recommendation system can characterize users' short-term interests at a fine-grained level while simultaneously grasping long-term interest changes at a macro level, thus significantly improving the ability to deeply mine users' true needs and the accuracy of personalized recommendations.

[0046] S501. Obtain User The final global attention score output sequence selects the last vector as the user's comprehensive interest expression at the next time step. The last vector is the output vector of the last time step in the final global attention score output sequence. The last vector integrates the user's local interest preferences in the short time period and the long-term interest trend across time periods, which can accurately depict the user's immediate needs and overall behavioral intentions.

[0047] Define the target product set for prediction as Establish the target commodity set for prediction The mapping from the feature values ​​of the predicted target product to the embedding vector of the predicted target product is used to calculate the similarity between the last vector and the embedding vector of the predicted target product. The top-K most relevant products are obtained by ranking them by similarity and used as the predicted recommended products for the user.

[0048] Working Principle: This embodiment constructs a personalized product recommendation method based on time-time granular modeling through steps S5. First, the method integrates user profiles and historical interaction product feature sequences to form a complete user behavior sequence. Then, it introduces a time-time granular modeling mechanism, combining time-time feature values ​​divided by date and hour values ​​to characterize user behavior patterns in different time periods. Further, it generates a final local mask matrix and a final global mask matrix to effectively distinguish between short-term and long-term interests. Based on this, it proposes a local-to-global attention calculation mechanism to achieve multi-level modeling of user interests. Finally, it uses the last embedding vector at the end of the sequence as a comprehensive interest expression and completes Top-K recommendation by matching its similarity with the predicted target product embedding vector.

[0049] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus.

[0050] Example 2 This embodiment further describes the method in the example in conjunction with specific calculation formula 1: S101. Define the user set ,in, Represents the total number of users and user profile characteristics. N is the total number of image features. For each user profile feature Construct the corresponding user profile feature embedding table and map it to user profile feature embedding vectors. The mapping process is as follows: (5); in, Embed vectors for user profile features. Indicates the first User profile feature embedding table Indicates the first The value range of each user profile feature. This represents the dimension of the user profile feature embedding vector after mapping.

[0051] All user profile feature embedding vectors are concatenated, and then transformed to a uniform dimension using a feature mapping function to obtain the user embedding vector: (6); Where, vector Represents the user embedding vector. Represents the user feature mapping function. This represents the vector concatenation operation. This represents the dimension of the user embedding vector.

[0052] Constructing product feature sequences ,in , Indicates the first Product feature sequence, Indicates user No. The first interactive product For each product feature sequence, an embedding table is constructed to obtain the product sequence feature embedding vector. The mapping process is represented as follows: (7); in, Indicates the first The product sequence feature embedding matrix corresponding to the product sequence features of the class. This represents the embedding table corresponding to the product sequence features. This indicates the range of values ​​for the product sequence feature. This represents the embedding vector dimension of the product sequence features after mapping.

[0053] After concatenating the feature embedding vectors of all product sequences, the product feature mapping function is used to unify the output dimension, resulting in the interactive product embedding vector. for: (8); in, Represents the interactive product embedding vector. Represents the product feature mapping function. This represents the operation of concatenating the feature embedding vectors of the corresponding product sequence. This indicates the output dimension of the interactive product embedding vector.

[0054] Let the length of the user interaction sequence be... When the number of products actually interacted with by the user When, a zero vector is added to the end of the sequence as padding value. At that time, only the most recent one is retained. The complete user behavior sequence obtained from the interaction with each product is as follows: (1) (1); in, For a complete user behavior sequence, This is the user embedding vector located at the first position in the complete user behavior sequence. This represents the vector concatenation operation. Represents the truncated or padded interactive product embedding vector Interactive product embedding vector Arranged in chronological order d represents the length of the user interaction sequence, and d represents the output dimension of the interactive product embedding vector.

[0055] S201. Extract the interaction timestamp sequence corresponding to the historical interactions from the historical interaction product sequence, and define the user. The historical interaction timestamp sequence is ,in This represents a placeholder for user information at the first position in the historical interaction timestamp sequence. Indicates user number The actual timestamp information of this interaction, if Then add at the end As filler value, if Then keep the most recent Each interaction timestamp.

[0056] Define the parsing function for the date and hour values ​​of each product interaction as follows: (9); in, For date values, This is an hourly value. Based on hourly value Define the time period division function for: (10); in, Indicates a time period flag value.

[0057] The date value and time period flag value are then combined into a unique time period feature value: (2); in, These are the characteristic values ​​for a time period. For date values, The time period flag value is the length of the user interaction sequence.

[0058] S301. Obtain the user according to formula (2) The time-period feature sequence is obtained, and row expansion matrices and column expansion matrices are constructed for comparison. The row expansion matrix is ​​as follows: (11); The column extended matrix is: (12); The user is obtained by comparing the element-wise equality of the extended matrix and the column extended matrix. The local mask matrix is: (13); in, , Represents the first element in the local mask matrix. The time-time feature value of each location, Represents the first element in the local mask matrix. The local mask matrix is ​​constructed by assigning time-segment feature values ​​to each location. When the two values ​​are equal, the corresponding matrix element is set to 1; otherwise, it is set to 0. The resulting local mask matrix effectively highlights the interaction relationships within the same time segment, ensuring that the model only focuses on the feature associations of local time segments during subsequent attention calculations. Furthermore, each user receives a local mask based on their own time-segment features.

[0059] To prevent features from traversing future timeframes, a causal mask matrix is ​​superimposed on top of the local mask matrix. The final local mask matrix is ​​obtained. .

[0060] The causal mask matrix is ​​defined as follows: (14); Final local mask matrix for: (3); in This represents the final local mask matrix. Represents a local mask matrix. This indicates element-wise multiplication. Represents the causal mask matrix; Global mask matrix Using a causal mask matrix: (4); in, Represents the global mask matrix. This represents the causal mask matrix. Through the above design, the local masking mechanism can capture local interests within the same time period while adhering to prediction logic to avoid information crossover; the global masking mechanism ensures that global modeling across time periods is carried out under reasonable causal constraints. Ultimately, this dynamic masking mechanism can generate differentiated mask matrices based on the time-period characteristics of different users.

[0061] S401. The complete user behavior sequence obtained by equation (1) With the corresponding position embedding vector Adding them together yields the complete user behavior sequence features after location enhancement. for: (17); Subsequently, a multi-attention mechanism based on a deep learning model is adopted. In this implementation method 1, the calculation of the local attention calculation stage and the global attention calculation stage is based on a Transformer-like model.

[0062] During the local attention computation stage, the complete user behavior sequence features after location augmentation are processed. Perform linear projection to obtain the local attention query matrix. Local attention key matrix and local attention value matrix for: , , (18); in, , , For the projection matrix to be learned, For the dimension of attention head.

[0063] The local attention score was calculated. for: (19); in, For local attention scores, For local attention query matrix, For local attention key matrix, For the dimension of attention head, The local mask matrix generated by equation (3) ensures that only interactions within the same time period and satisfying causal constraints can be captured.

[0064] Based on local attention scores The final local attention score is obtained as follows (15); in, Represents the score of local attention Perform a normalization operation so that the sum of the attention weights for each row is 1. This represents the local attention value matrix. The final local attention score. It integrates the characteristic information of historical interactions within the same time period.

[0065] During the global attention calculation phase, the final local attention score is calculated. As input for global attention calculation Perform linear projection to obtain the global attention query matrix. Global attention key matrix and global attention value matrix for: , , (20); in, , , For another set of learned projection matrices, Calculate the global attention score for: (twenty one); in, The global attention score. For global attention query matrix, The global attention key matrix, For the dimension of attention head, The global mask matrix obtained by equation (4) is given.

[0066] Based on global attention score Obtain the final global attention score for (16); in, Represents the final global attention score Perform a normalization operation so that the sum of the attention weights for each row is 1. This represents the global attention value matrix.

[0067] Through the two-stage calculation described above, the model first captures short-term interest features within a local scope over the same time period, and then models the long-term interest evolution across time periods globally, thereby achieving a multi-level expression of user interests. The final sequence representation can be used for subsequent personalized product recommendation predictions.

[0068] S501. Obtain User The final global attention score output sequence is as follows: (twenty two); in, Indicates user The final global attention score output sequence, Expression (22) in the first The output vector at each time step, with the last vector being the user's... The final sequence output is the output vector of the last time step. .

[0069] Predict the target product set The mapping relationship from the predicted target product feature values ​​to the predicted target product embedding vector is as follows: (twenty three); in, This indicates the predicted feature value of the target product. This represents the predicted target product embedding vector. Indicates goods The value of the m-th feature, Represents the product feature mapping function. This indicates the operation of splicing the corresponding positions to predict the feature values ​​of the target product.

[0070] The last vector is selected as the user's comprehensive interest expression at the next time step. The last vector is the output vector of the last time step in the final global attention score output sequence. The last vector is embedded in the predicted target product vector. Similarity calculations are performed, and the top-K most relevant products are obtained by ranking them by similarity, which are then used as predictive product recommendations for users.

[0071] Through this step, the system uses the unified mapping space of the final interest representation and product embedding to complete Top-K matching, which not only ensures that the user's historical behavior and candidate products are measured in the same embedding space, but also realizes personalized recommendation based on time-time granular modeling.

[0072] Preferably, the present invention provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the personalized product recommendation method based on time-time granularity modeling of the present invention.

[0073] Preferably, the present invention provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the personalized product recommendation method based on time-time granularity modeling of the present invention.

[0074] Example 3 This implementation method verifies the feasibility of Examples 1 and 2 through specific experiments: This embodiment uses two publicly available general recommendation datasets, MovieLens-1M and MovieLens-20M, as well as a real-world industrial-grade large-scale dataset. The MovieLens series datasets are standard datasets in the recommendation system field, covering user movie ratings and tagging behavior, and can be used to verify the model's recommendation performance under different data scales. The industrial-grade large-scale dataset contains rich user profile features, product features, interaction timestamps, and interaction behavior types, and can realistically reflect the recommendation needs in large-scale commercial scenarios.

[0075] In experiments on a general dataset, two representative baseline models were selected for comprehensive comparison: one was the traditional recurrent neural network recommendation model GRU4Rec, which uses gated recurrent units (GRUs) to model users' sequential behavioral features; the other was the Transformer-based sequence recommendation model SASRec, which effectively characterizes user interests through a self-attention mechanism. The evaluation metrics included HR@K (hit rate), NDCG@K (normalized discount cumulative gain), and MRR (mean reciprocal rank). These metrics comprehensively evaluate model performance from multiple perspectives, including recall accuracy, ranking rationality, and the diversity of recommendation effects; higher metric values ​​indicate better model performance.

[0076] In experiments on industrial datasets, the industry-standard dual-tower DSSM model was selected as the baseline for comparison. Evaluation metrics included HR@K (hit rate) and online order revenue, which respectively measure the recall coverage of the recommendation results and their actual contribution to business conversion, thus better reflecting the needs of real-world business scenarios.

[0077] In terms of experimental setup, the overall model learning rate was set to 0.001, the maximum length of the interaction sequence was uniformly set to 200, and the hidden layer dimension was uniformly set to 256. For the general dataset, the batch size was set to 128, the training epochs were 100, and the experiment was repeated 5 times with the average value taken to reduce random fluctuations. For the industrial dataset, the batch size was set to 10240, and Top-K training was completed in one epoch using data from the past 7 days, fully demonstrating the training efficiency under large-scale data. All experiments were performed on an NVIDIA A100-80GB GPU. Under the settings of this invention, HR@K (hit rate) is improved, demonstrating that this method achieves comprehensive coverage of short-term, long-term, and low-frequency interests; the leading NDCG@K (normalized discount cumulative gain) reflects that this method introduces an interest value assessment module, combining user behavior types such as collections, comments, and clicks, and item quality characteristics such as ratings and reputation to quantify interest priority, rather than simply relying on time sequence or frequency, making the recommendation list more consistent with users' true interest preferences; the breakthrough in MRR (mean reciprocal ranking) lies in the realization of decomposing user interests into "core attributes," "secondary attributes," and "scenario attributes," and prioritizing accurate matching based on core attributes during the matching stage, significantly improving recommendation accuracy and user satisfaction.

[0078] The experimental results show that the method proposed in this invention has stronger user interest modeling capabilities and better recommendation performance in both general recommendation scenarios and real industrial scenarios. It can significantly improve the accuracy and personalization level of recommendation systems and demonstrate good application value in large-scale commercial environments.

[0079] It is noteworthy that those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0080] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0081] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0082] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0083] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not 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 modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

[0084] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus.

[0085] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A personalized product recommendation method based on time-time granularity modeling, characterized in that, Includes the following steps: S101. Obtain user profile features Interactive product series with history and build user data sets User embedding vectors are obtained by constructing an embedding table that matches each of the user profile features. ; By analyzing the historical interaction product sequence Constructing product feature sequences And for each of the product feature sequences Construct the corresponding embedding table to obtain the interactive product embedding vector. ; According to the user embedding vector and the interactive product embedding vector The complete user behavior sequence is as follows: (1) (1); in, For the complete user behavior sequence, The user embedding vector located at the first position of the complete user behavior sequence. This represents the vector concatenation operation. This represents the truncated or padded interactive product embedding vector. The interactive product embedding vector Arranged in chronological order d is the length of the user interaction sequence, and d is the output dimension of the interactive product embedding vector. S201. Extract the interaction timestamp sequence corresponding to the historical interactions from the historical interaction product sequence, and extract the date value. with hourly value According to the hour value Get the time period flag value The date value and the time period flag value are then combined into a unique time period feature value: (2); in, These are the characteristic values ​​for a time period. For the date value, The time period is the identifier value, and L is the length of the user interaction sequence; S301. Obtain the user according to formula (2) The time-period feature sequence is obtained, and a row expansion matrix and a column expansion matrix are constructed for comparison. The user's information is obtained through element-by-element equality comparison between the two matrices. Local mask matrix A causal mask matrix is ​​superimposed on the local mask matrix. The final local mask matrix is ​​obtained. : (3); in This represents the final local mask matrix. This represents the local mask matrix. This indicates element-wise multiplication. This represents the causal mask matrix; Global mask matrix Using a causal mask matrix: (4); in, This represents the global mask matrix. This represents the causal mask matrix; S401. The complete user behavior sequence obtained from equation (1) With the corresponding position embedding vector Adding them together yields the complete user behavior sequence features after location enhancement. Subsequently, a multi-attention mechanism of a deep learning model is used to perform calculations for the local attention calculation stage and the global attention calculation stage. In the local attention calculation stage, the final local attention score is obtained through calculation. The global attention calculation stage is obtained through calculation. ; S501. Obtain User The final global attention score output sequence is used to select the last vector as the user's comprehensive interest expression at the next time step. The last vector is the output vector of the last time step in the final global attention score output sequence. Define the target product set for prediction as The target product set for prediction is established as follows: The mapping from the feature values ​​of the predicted target product to the embedding vector of the predicted target product is used to calculate the similarity between the last vector and the embedding vector of the predicted target product. The most relevant Top-K products are obtained by ranking them by similarity and used as the predicted recommended products for the user.

2. The personalized product recommendation method based on time-time granularity modeling according to claim 1, characterized in that, In step S101, by constructing a feature corresponding to each user profile... The matched embedding table yields the final user embedding vector. Includes the following steps: S111. Define the user set ,in, The total number of users, the user profile features N represents the total number of profile features, such as gender, age, and education level. S112. For each of the user profile features Construct the corresponding user profile feature embedding table and map it to user profile feature embedding vectors. The mapping process is as follows: (5); in, Embed vectors for the user profile features. Indicates the first The user profile feature embedding table. Indicates the first The value range of each of the aforementioned user profile features This represents the dimension of the user profile feature embedding vector after mapping; S113. Concatenate all the user profile feature embedding vectors, and then transform them to a unified dimension using a feature mapping function to obtain the user embedding vector: (6); Where, vector This represents the user embedding vector. Represents the user feature mapping function. This represents the vector concatenation operation. This represents the dimension of the user embedding vector; In step S101, the historical interactive product sequence is processed. Constructing product feature sequences And for each of the product feature sequences Construct the corresponding embedding table to obtain the interactive product embedding vector. Includes the following steps: S121. Constructing a Commodity Feature Sequence ,in , Indicates the first Product feature sequence, Indicates user No. The first interactive product For each of the product feature sequences, an embedding table is constructed to obtain a product sequence feature embedding vector. The mapping process is expressed as follows: (7); in, Indicates the first The product sequence feature embedding matrix corresponding to the product sequence features. This represents the embedding table corresponding to the product sequence features. This indicates the range of values ​​for the product sequence feature. This represents the dimension of the embedding vector of the product sequence features after mapping; S122. After concatenating all the product sequence feature embedding vectors, the dimension is uniformly output through the product feature mapping function to obtain the interactive product embedding vector. for: (8); in, This represents the interactive product embedding vector. This represents the product feature mapping function. This indicates the operation of concatenating the feature embedding vectors of the product sequence at the corresponding positions. This represents the output dimension of the interactive product embedding vector.

3. The personalized product recommendation method based on time-time granularity modeling according to claim 2, characterized in that, The user The historical interactive product sequence is ,in, For users The actual number of interacted items, and the historical interacted item sequence is arranged in ascending order of timestamps.

4. The personalized product recommendation method based on time-time granularity modeling according to claim 1, characterized in that, Step S201 involves extracting the interaction timestamp sequence corresponding to the historical interactions from the historical interaction product sequence, including the following steps: S211. Define User The historical interaction timestamp sequence is ,in This indicates a placeholder for the user information at the first position of the historical interaction timestamp sequence. Indicates user number The actual timestamp information of this interaction, if Then add at the end As filler value, if Then keep the most recent Each interaction timestamp; In step S201, the date value is extracted. with hourly value According to the hour value Get the time period flag value Subsequently, the time period feature values ​​are obtained, including the steps. S221. Define the parsing function for the date and hour values ​​of each product interaction as follows: (9); in, For the date value, The hourly value, Based on hourly value Define the time period division function for: (10); in, This indicates the time period flag value.

5. The personalized product recommendation method based on time-time granularity modeling according to claim 1, characterized in that, In step S301, a row extension matrix and a column extension matrix are constructed for comparison. The user's value is obtained through an element-by-element equality comparison between the two matrices. Local mask matrix The step of superimposing the causal mask matrix includes: S311. According to the user The time period feature sequence is The sequence length is uniformly L, and the row expansion matrix is: (11); The column expansion matrix is: (12); Get users The local mask matrix is: (13); in, , Represents the first in the local mask matrix The time-time feature value of each location, Represents the first in the local mask matrix The time-period feature values ​​of each location; S312. The causal mask matrix is ​​defined as follows: (14); in Let L represent the causal mask matrix, and let L represent the length of the causal mask matrix.

6. The personalized product recommendation method based on time-time granularity modeling according to claim 1, characterized in that, In step S401, the local attention calculation stage includes the following steps: S411. During the local attention calculation stage, the complete user behavior sequence features after location enhancement are... Perform linear projection to obtain the local attention query matrix. Local attention key matrix and local attention value matrix Then the local attention score was calculated. According to the local attention score The final local attention score is: (15); in, Represents the local attention score Perform a normalization operation so that the sum of the attention weights for each row is 1. This represents the local attention value matrix; In step S401, the global attention calculation stage includes the following steps: S421. In the global attention calculation stage, the final local attention score is... As input for global attention calculation Perform linear projection to obtain the global attention query matrix. Global attention key matrix and global attention value matrix Then the global attention score was calculated. According to the global attention score Obtain the final global attention score for: (16); in, Represents the final global attention score Perform a normalization operation so that the sum of the attention weights for each row is 1. This represents the global attention value matrix.

7. The personalized product recommendation method based on time-time granularity modeling according to claim 6, characterized in that, In step S401, the location-enhanced complete user behavior sequence features for: (17); In step S411, the local attention score is calculated for the local attention. The steps include: S412. For the user after location enhancement Complete behavioral sequence features Perform linear projection to obtain the local attention query matrix. Local attention key matrix and local attention value matrix The following relationship is satisfied: , , (18); in, , , For the projection matrix to be learned, For the dimension of attention head; S413. Calculate the local attention score , The calculation formula is: (19); in, The local attention score is... The local attention query matrix is... The local attention key matrix, For the dimension of attention head, The local mask matrix generated by equation (3); In step S421, the global attention score is calculated. The steps include: S422. Obtain the global attention query matrix. Global attention key matrix and global attention value matrix It satisfies the following relationship: , , (20); in, , , For another set of learned projection matrices; S423 calculates the global attention score. : (21); in, The global attention score is... The global attention query matrix is... The global attention key matrix, For the dimension of attention head, The global mask matrix obtained by equation (4) is given.

8. The personalized product recommendation method based on time-time granularity modeling according to claim 1, characterized in that, In step S501, the user is obtained. The final global attention score output sequence is as follows: (22); in, Indicates the user The final global attention score output sequence, The expression in the first The output vector at each time step, the last vector being the user's... The final sequence output is the output vector of the last time step. ; In step S501, the predicted target product set The mapping relationship from the predicted target product feature value to the predicted target product embedding vector is as follows: (23); in, This represents the predicted feature value of the target product. This represents the predicted target product embedding vector. Indicates goods The value of the m-th feature, This represents the product feature mapping function. This indicates the operation of splicing the predicted target product feature values ​​at the corresponding positions. This represents the embedding table corresponding to the product sequence features.

9. An electronic device, characterized in that, include: At least one processor; The at least one processor is also connected in communication with a memory, wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the personalized product recommendation method based on time-time granularity modeling according to any one of claims 1 to 8.

10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, in, The computer instructions are used to cause the computer to execute the personalized product recommendation method based on time-time granularity modeling as described in any one of claims 1 to 8.