Blog vector generation model training method, blog recommendation method and device, and equipment
By binning the category features of blog posts and iteratively training the neural network model, combined with an attention mechanism to generate blog post vectors, the cold start problem of fast blog post updates in recommendation systems is solved, and personalized blog post recommendations are realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MICRO DREAM TECHTRONIC NETWORK TECH CHINACO
- Filing Date
- 2023-05-29
- Publication Date
- 2026-05-22
Smart Images

Figure CN116578757B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data mining technology, and in particular to a method for training a blog post vector generation model, a method and apparatus for recommending blog posts, and a device. Background Technology
[0002] Feature engineering in recommender systems primarily involves extracting features that express user interests and preferences from massive user behavior logs, such as tag preferences and author preferences. Deep learning possesses powerful end-to-end learning capabilities, which can significantly improve the effectiveness of feature mining. Embedding is a crucial part of deep learning, mainly a method for transforming discrete variables into fixed-length continuous vectors. The representational power of the embedding vector directly affects the accuracy of the mined features.
[0003] Existing methods for embedding high-dimensional ID / category features mainly focus on two directions for improvement: one is to add additional information, that is, items belonging to the same category or brand should have more similar representation vectors; the other is to use inductive graph neural networks, which use the connection information between nodes to sample neighbors, and then continuously fuse the information of adjacent nodes through multi-layer aggregation functions, and use the fused information to predict node labels.
[0004] However, the above methods have at least the following problems when applied to recommendation systems: 1) The information content in the recommendation system is updated too quickly, resulting in a serious cold start problem. For example, a large number of blog posts emerge every day, and the update speed of blog posts is too fast, with less than 50% of the blog posts being repeated every other day; 2) The correlation between multiple pieces of information browsed by users is not significant, making it difficult to mine representation vectors to express user interest and preference features through the correlation between various pieces of information. Summary of the Invention
[0005] To address the aforementioned issues, this application provides a method for training a blog post vector generation model, a method and apparatus for recommending blog posts, and a device for such recommendation. The specific technical solutions are as follows:
[0006] In a first aspect, embodiments of this application provide a training method for a blog post vector generation model, including:
[0007] A session sequence sample set is obtained based on the historical session data of multiple users. Each session sequence sample in the session sequence sample set includes: multiple blog posts belonging to the same session corresponding to the same user, and target blog posts that the user is interested in from the multiple blog posts.
[0008] The neural network model is iteratively trained using the conversation sequence sample set. The category features of each blog post in the conversation sequence sample are extracted and binned to obtain the category bins corresponding to each blog post. The category identifier code corresponding to each blog post is obtained based on the mapping of the category bins corresponding to each blog post.
[0009] The category identifier code corresponding to each blog post in the conversation sequence sample, as well as the target blog post, are input into the neural network model for feature fusion processing based on the attention mechanism, and the predicted blog post vector corresponding to the conversation sequence sample is output.
[0010] The model parameters of the neural network model are adjusted based on the predicted blog post vectors corresponding to the session sequence samples and the loss function of the neural network model until the set convergence condition is met. The trained neural network model is then used as the blog post vector generation model.
[0011] In one possible implementation, obtaining a session sequence sample set based on historical session data from multiple users includes:
[0012] Collect historical session data from multiple users, including access data to blog posts generated by users' historical behavior.
[0013] The historical session data is grouped according to user identifiers, the access data corresponding to the same user is sorted according to access time, and the blog post information in the access data is grouped according to the session division rules to obtain the session sequence sample set; wherein, the session division rules are as follows: for the access data corresponding to the same user, if the access frequency within a set time period is lower than a preset frequency threshold, the access data before the first moment and the access data after the second moment belong to different sessions; the first moment is the left end moment of the set time period, and the second moment is the right end moment of the set time period.
[0014] In one possible implementation, after obtaining the session sequence sample set based on historical session data from multiple users, the method further includes:
[0015] Filter out blog posts in the session sequence sample set whose access duration is less than a preset time threshold; or,
[0016] Filter out session sequence samples in the session sequence sample set whose number of blog post information is less than a preset threshold.
[0017] In one possible implementation, the step of inputting the category identifier code corresponding to each blog post in the session sequence sample and the target blog post into the neural network model for feature fusion processing based on an attention mechanism, and outputting the predicted blog post vector corresponding to the session sequence sample, includes:
[0018] For any blog post in the conversation sequence sample, the category identifier code corresponding to the blog post is used as the first blog post vector of the blog post, and the similarity value between the first blog post vector and the target blog post vector corresponding to the target blog post is determined as the attention weight corresponding to the first blog post vector.
[0019] Based on the first blog post vector of each blog post and the attention weight corresponding to the first blog post vector, the predicted blog post vector corresponding to the session sequence sample is determined.
[0020] In one possible implementation, the loss function includes a first loss function and a second loss function. The first loss function is used to characterize the matching degree between the predicted blog post vector corresponding to the session sequence sample and the first blog post vector represented by the category identifier code corresponding to each blog post information. The second loss function is used to characterize the distance between the different category feature distributions included in the predicted blog post represented by the predicted blog post vector.
[0021] Secondly, embodiments of this application provide a blog post recommendation method, including:
[0022] Obtain the target user's target session sequence; the target session sequence includes multiple blog posts belonging to the same session corresponding to the target user;
[0023] Based on the category features of each blog post in the target session sequence, a category identifier code corresponding to each blog post is determined; the category identifier code corresponding to each blog post is input into the blog post vector generation model for feature fusion processing, and the predicted blog post vector of the target user is output; the blog post vector generation model is trained using the training method of the blog post vector generation model as described in the first aspect;
[0024] Determine the similarity between the candidate blog post vector corresponding to the candidate blog post in the preset database and the predicted blog post vector;
[0025] Candidate blog posts that meet preset similarity criteria are recommended to the target user.
[0026] Thirdly, embodiments of this application provide a training apparatus for a blog post vector generation model, comprising:
[0027] The sample acquisition module is used to acquire a session sequence sample set based on the historical session data of multiple users. Each session sequence sample in the session sequence sample set includes: multiple blog posts belonging to the same session corresponding to the same user, and target blog posts that the user is interested in from the multiple blog posts.
[0028] The model training module is used to iteratively train the neural network model using the conversation sequence sample set, extract the category features of each blog post in the conversation sequence sample and perform bucketing to obtain the category bucket corresponding to each blog post, and obtain the category identifier code corresponding to each blog post based on the category bucket mapping corresponding to each blog post.
[0029] The category identifier code corresponding to each blog post in the conversation sequence sample, as well as the target blog post, are input into the neural network model for feature fusion processing based on the attention mechanism, and the predicted blog post vector corresponding to the conversation sequence sample is output.
[0030] The model parameters of the neural network model are adjusted based on the predicted blog post vectors corresponding to the session sequence samples and the loss function of the neural network model until the set convergence condition is met. The trained neural network model is then used as the blog post vector generation model.
[0031] Fourthly, embodiments of this application provide a blog post recommendation device, including:
[0032] The sequence acquisition module is used to acquire the target session sequence of the target user; the target session sequence includes multiple blog post information belonging to the same session corresponding to the target user;
[0033] The identifier code determination module is used to determine the category identifier code corresponding to each blog post based on the category characteristics of each blog post in the target session sequence;
[0034] The vector output module is used to input the category identifier code corresponding to each blog post information into the blog post vector generation model for feature fusion processing, and output the predicted blog post vector of the target user; the blog post vector generation model is trained using the training device for the blog post vector generation model as described in the third aspect above;
[0035] The similarity determination module is used to determine the similarity between the candidate blog post vector corresponding to the candidate blog post in the preset database and the predicted blog post vector;
[0036] The blog post recommendation module is used to recommend candidate blog posts that meet preset similarity criteria to the target user.
[0037] Fifthly, embodiments of this application provide a computer device comprising a processor and a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to implement the above-described method.
[0038] Sixthly, embodiments of this application provide a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to implement the above-described method.
[0039] The technical solution provided in this application may include the following beneficial effects:
[0040] The training method for the blog post vector generation model provided in this application extracts the category features of each blog post in the session sequence samples and performs bucketing to obtain the category bucket corresponding to each blog post. Based on the category bucket corresponding to each blog post, the corresponding category identifier code is obtained. In this way, each blog post will have a unique category identifier code. Then, based on the category identifier code corresponding to each blog post in each session sequence sample, the model parameters of the neural network model are trained to obtain the blog post vector generation model, which can solve the cold start problem caused by the fast update speed of blog post information.
[0041] Furthermore, during the iterative training of the neural network model, the similarity value between the blog post vector represented by the category identifier code and the target blog post vector is used to determine the attention weight corresponding to each blog post vector. Based on the attention weight corresponding to the blog post vector, feature fusion processing is performed on each blog post vector in the session sequence sample to obtain the predicted blog post vector output by the neural network model. In this way, the influence of invalid low-frequency blog post information in the session sequence sample on the vector generation result can be suppressed, and the representation ability of the blog post vector can be improved.
[0042] The blog post recommendation method provided in this application takes the category identifier code corresponding to each blog post in the target session sequence as input to the blog post vector generation model for feature fusion processing, and outputs a predicted blog post vector for the target user. This predicted blog post vector is used to represent the blog post information that the target user is interested in. The method recommends the blog post information corresponding to the candidate blog post vectors corresponding to candidate blog posts in the preset database and the predicted blog post vectors to the target user if the similarity between the candidate blog post vectors and the predicted blog post vectors meets the preset conditions. This can recommend blog post information that better meets the user's personalized needs and improve user satisfaction.
[0043] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0044] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0045] Figure 1 A flowchart illustrating the training method of the blog post vector generation model provided in this application embodiment is shown.
[0046] Figure 2 A schematic diagram of the network structure of the neural network model provided in an embodiment of this application is shown;
[0047] Figure 3 A flowchart illustrating the blog post recommendation method provided in an embodiment of this application is shown;
[0048] Figure 4 This paper shows a schematic diagram of the structure of the training device for the blog post vector generation model provided in an embodiment of this application;
[0049] Figure 5 A schematic diagram of the structure of the blog post recommendation device provided in an embodiment of this application is shown;
[0050] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of this application is shown. Detailed Implementation
[0051] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0052] With the application of deep learning in recommender systems, the end-to-end learning capabilities of deep learning models are significantly superior to traditional machine learning methods. As a result, original ID-type features (such as user_id and item_id) have become increasingly prevalent in recommender models and have gradually become the most important type of feature. One-hot encoding is typically used to encode discrete features, especially ID-type features. However, since the dimension of one-hot encoding equals the total number of IDs, its dimension is at least in the hundreds of millions or even tens of billions. This encoding method is extremely sparse for the model, and the characteristics of deep learning, as well as engineering considerations, make it unsuitable for handling sparse feature vectors.
[0053] Since the advent of word2vec, the concept of embedding has rapidly spread from the field of natural language processing to almost all areas of machine learning. The sparsity of user data in fields such as advertising, recommendation, and search almost inevitably necessitates embedding users and items before building neural network models for effective training. Specifically, embedding represents an object, a word, a product, or a movie, etc., using a low-dimensional vector. Embedding can transform high-dimensional ID / category features into dense, continuous vectors, allowing for the calculation of similarity between vectors by calculating their angles, which also facilitates neural network learning. However, due to the rapid update speed of information content in recommendation systems, there is a severe cold start problem, and the correlation between multiple pieces of information viewed by a user is low, making it difficult to mine representation vectors expressing user interests and preferences based on the correlation between different pieces of information.
[0054] Based on this, this application proposes a blog post vector generation model training method to solve the cold start problem caused by the fast update speed of blog post information in the prior art. Figure 1 This diagram illustrates a flowchart of a training method for a blog post vector generation model provided in this application. This method can be executed by an electronic device, such as a terminal device or a server device. In other words, the method can be executed by software or hardware installed on the terminal device or server device. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cloud server cluster. As shown in the diagram, the method 100 may include the following steps:
[0055] S101: Obtain a session sequence sample set based on historical session data of multiple users, wherein each session sequence sample in the session sequence sample set includes: multiple blog post information belonging to the same session corresponding to the same user, and a target blog post of interest to the user among the multiple blog post information; and,
[0056] S102: Use the conversation sequence sample set to iteratively train the neural network model, extract the category features of each blog post in the conversation sequence sample and perform bucketing to obtain the category bucket corresponding to each blog post, and obtain the category identifier code corresponding to each blog post based on the category bucket mapping corresponding to each blog post.
[0057] The category identifier code corresponding to each blog post in the conversation sequence sample, as well as the target blog post, are input into the neural network model for feature fusion processing based on the attention mechanism, and the predicted blog post vector corresponding to the conversation sequence sample is output.
[0058] The model parameters of the neural network model are adjusted based on the predicted blog post vectors corresponding to the session sequence samples and the loss function of the neural network model until the set convergence condition is met. The trained neural network model is then used as the blog post vector generation model.
[0059] Specifically, the target blog posts that users are interested in can be determined from the session sequence sample based on multiple dimensions such as the duration, frequency, and feedback behavior of users accessing blog post information. For example, the blog post with the longest access time can be identified as the target blog post, or the blog post with the most views can be identified as the target blog post, or the blog post with user actions such as forwarding, collecting, or liking can be identified as the target blog post.
[0060] Data binning is a method of grouping multiple consecutive values into a smaller number of "buckets". By using rule mapping, blog post information in each session sequence sample is divided into different types. The category features of each type fall into pre-defined "buckets", resulting in category buckets. Then, based on the category bucket mapping corresponding to each blog post, a category identifier code, or mapping ID, is obtained for each blog post. Taking blog posts as an example, first, multi-dimensional category labels are set, such as "finance", "law", "emotion", "entrepreneurship", "skiing", etc. Different buckets are formed according to different values of each dimension, and different blog posts will fall into different buckets. By comprehensively considering all dimensions, a unique mapping ID is obtained for each blog post. This mapping ID is used as the ID for training the neural network model.
[0061] Through the above steps, during the iterative training of the attention-based neural network model using the session sequence sample set, the category features of each blog post in each session sequence sample are extracted and binned. Based on the category bin mapping corresponding to each blog post, the category identifier code corresponding to each blog post is obtained. In this way, each blog post will have a unique category identifier code. Then, based on the category identifier code corresponding to each blog post in each session sequence sample, the model parameters of the neural network model are trained to obtain the blog post vector generation model, which can solve the cold start problem caused by the fast update speed of blog post information.
[0062] The step of obtaining a session sequence sample set based on historical session data from multiple users includes:
[0063] S101a: Collect historical session data from multiple users, including access data for blog post information generated by users' historical behavior;
[0064] S101b: The historical session data is grouped according to user identifiers, the access data corresponding to the same user is sorted according to access time, and the blog post information in the access data is grouped according to the session division rules to obtain the session sequence sample set; wherein, the session division rules are: for the access data corresponding to the same user, if the access frequency within a set time period is lower than a preset frequency threshold, the access data before the first moment and the access data after the second moment belong to different sessions; the first moment is the left end moment of the set time period, and the second moment is the right end moment of the set time period.
[0065] In practice, historical session data can be user click sessions or user access records kept in the backend. Taking user click sessions as an example, 2 billion click sessions are collected from logged-in users as their historical session data. These click sessions are then grouped according to user identifiers (IDs) to obtain the click sessions corresponding to the same user. Furthermore, the click sessions corresponding to the same user are sorted by click time to obtain ordered click sessions.
[0066] For an ordered click session corresponding to the same user, the blog post information within the click session is grouped according to session segmentation rules to obtain a session sequence sample set. This can be understood as meaning that the same user can have multiple session sequence samples. Here, for an ordered click session of the same user, the session sequence sample segmentation rule is: for click data corresponding to the same user, if the click frequency within a set time period is lower than a preset threshold, it is divided into different session sequence samples. For example, click sessions are segmented according to the rule that 30 minutes of inactivity constitutes a different session.
[0067] The process, following the acquisition of a session sequence sample set based on historical session data from multiple users, further includes:
[0068] S101c: Filter out blog posts in the session sequence sample set whose access duration is less than a preset time threshold; or...
[0069] Filter out session sequence samples in the session sequence sample set whose number of blog post information is less than a preset threshold.
[0070] In practice, the acquired session sequence sample set can be filtered to remove invalid session sequence samples. Specifically, it can filter out blog posts whose browsing time is less than a preset time threshold (e.g., 10 seconds) or session sequence samples whose number of blog posts is less than a preset number threshold (e.g., 3). This ensures that the sample data is valid and improves the training efficiency of the blog post vector generation model.
[0071] The step of inputting the category identifier code corresponding to each blog post in the session sequence sample and the target blog post into the neural network model for feature fusion processing based on an attention mechanism, and outputting the predicted blog post vector corresponding to the session sequence sample, includes:
[0072] For any blog post in the conversation sequence sample, the category identifier code corresponding to the blog post is used as the first blog post vector of the blog post, and the similarity value between the first blog post vector and the target blog post vector corresponding to the target blog post is determined as the attention weight corresponding to the first blog post vector.
[0073] Based on the first blog post vector of each blog post and the attention weight corresponding to the first blog post vector, the predicted blog post vector corresponding to the session sequence sample is determined.
[0074] In specific implementation, such as Figure 2 As shown, by utilizing the correlation between the blog posts corresponding to the category identifier codes in the session sequence samples and the target blog post corresponding to the same session sequence sample, weights are assigned to each relevant blog post vector corresponding to the target blog post. Each weight is the attention weight of the session sequence sample to the target blog post. Specifically, the similarity value between the embedding of the target blog post and the blog post vector corresponding to the category identifier codes in the session sequence samples is calculated, and this similarity value is determined as the attention weight corresponding to the blog post vector. Based on the attention weights corresponding to each blog post vector, feature fusion processing is performed on blog post vector_1, blog post vector_2, ..., blog post vector_n to obtain the predicted blog post vector output by the neural network model. The similarity value between the blog post information and the target blog post can be calculated using methods such as dot product and cosine similarity.
[0075] Attention can be described as mapping a query and a set of key-value pairs to an output, where the query, key, value, and output are all vectors, and the output is calculated using a compatibility function that computes a weighted sum for each value. In this embodiment, a weighted maximum processing step is performed in the max pooling layer of the neural network model (the attention weight of each blog post in each session sequence is multiplied by its corresponding embedding vector, compressed to a fixed length, and then the max operation is performed). The vector obtained after max pooling is the predicted blog post vector corresponding to this session sequence.
[0076] This ensures that blog post vectors with stronger relevance to the target blog post in the session sequence samples have larger weights, while those with weaker relevance have smaller weights. If most historical behaviors are related to the target blog post, the vector after max pooling will be very large, meaning that the candidate blog post has a high probability of being related to other blog posts, thus better capturing the correlation between blog posts.
[0077] Furthermore, the loss function includes a first loss function and a second loss function. The first loss function is used to characterize the matching degree between the predicted blog post vector corresponding to the session sequence sample and the first blog post vector represented by the category identifier code corresponding to each blog post information. The second loss function is used to characterize the distance between the different category feature distributions included in the predicted blog post represented by the predicted blog post vector.
[0078] In practical implementation, besides large-scale training data and deep structures, the loss function also plays a crucial role in learning an accurate blog post representation model. The key to multi-task learning lies in its ability to learn multiple related tasks simultaneously. Through joint learning, it maintains the differences between tasks while fully utilizing their correlations, thereby improving the overall learning performance of all tasks. In this embodiment, the total loss function L for multi-task learning is:
[0079] L = L p +L ce ;
[0080] Wherein, the first loss function L p Represents matching loss, second loss function L ce The first loss function represents the matching degree between the predicted blog post vector corresponding to the session sequence sample and the blog post vector; the second loss function represents the distance between the distributions of different categories of features included in the predicted blog post represented by the predicted blog post vector corresponding to the session sequence sample.
[0081] Assume each pair of inputs is Where, x iThis means using the blog post vector corresponding to the i-th blog post as the predicted blog post vector, z j y represents the j-th element in the blog post vector corresponding to the blog post information. i,j This indicates whether they match, and the probability of them matching is:
[0082]
[0083] Where, p i,j Let represent the probability that the i-th blog post and the j-th blog post match each other, and k represent the probability of matching the predicted blog post vector x. i In practical applications, the number of mismatched negative samples is typically 10.
[0084] For a given target blog post, there may be multiple matching blog post entries in the session sequence. Regularization is applied to the matching probability, i.e. Then the matching loss L p for:
[0085]
[0086] Where, q i,j Let represent the matching degree between the i-th blog post and the j-th blog post, and ε represent the temperature coefficient hyperparameter.
[0087] As can be seen from the matching loss, its essence is KL divergence loss. When the correct result p is relatively low, the prediction q made by the neural network is also relatively low.
[0088] Furthermore, AM-Softmax is used as the second loss function, expressed as:
[0089]
[0090] Among them, s i,p Let be the true label of the p-th sample, m and τ represent hyperparameters that drive the difficulty of the classification boundary, and N is the number of negative samples, which is usually taken as 10 in practical applications.
[0091] Through the above steps, during the iterative training of the neural network model, the similarity value between the blog post vector represented by the category identifier code and the target blog post vector is determined as the attention weight corresponding to the blog post vector. Based on the attention weight corresponding to the blog post information, feature fusion processing is performed on each blog post information in the conversation sequence sample to obtain the predicted blog post vector output by the neural network model. In this way, the influence of invalid low-frequency blog post information in the conversation sequence sample on the vector generation result can be suppressed, and the representation ability of the blog post vector can be improved.
[0092] The blog post vector generation model trained using the training method provided in this application can output target blog post vectors corresponding to target conversation sequences. These target blog post vectors can be used in various fields such as product recommendation and blog post recommendation. The following description uses blog post recommendation as an example. Figure 3 The following is a flowchart illustrating the blog post recommendation method provided in an embodiment of this application. The method includes the following steps:
[0093] S301: Obtain the target user's target session sequence; the target session sequence includes multiple blog post information belonging to the same session corresponding to the target user;
[0094] S302: Determine the category identifier code corresponding to each blog post based on the category characteristics of each blog post in the target session sequence;
[0095] S303: Input the category identifier code corresponding to each blog post into the blog post vector generation model for feature fusion processing, and output the predicted blog post vector of the target user; the blog post vector generation model is trained using the above-mentioned training method for the blog post vector generation model;
[0096] S304: Determine the similarity between the candidate blog post vector corresponding to the candidate blog post in the preset database and the predicted blog post vector;
[0097] S305: Recommend candidate blog posts that meet the preset similarity criteria to the target user.
[0098] Through the above steps, the category identifier codes corresponding to each blog post in the target session sequence are input into the blog post vector generation model for feature fusion processing, and the predicted blog post vector of the target user is output. This predicted blog post vector can reflect the user's interest and preference for blog post information. Furthermore, by determining the similarity between the candidate blog post vector corresponding to the candidate blog post in the preset database and the predicted blog post vector, the candidate blog post with similarity meeting the preset conditions is recommended to the target user. This can recommend blog post information that better meets the user's personalized needs and improve user satisfaction.
[0099] Figure 4 This illustration shows a schematic diagram of the training apparatus for the blog post vector generation model provided in an embodiment of this application. The apparatus 400 includes:
[0100] The sample acquisition module 410 is used to acquire a session sequence sample set based on the historical session data of multiple users. Each session sequence sample in the session sequence sample set includes: multiple blog post information belonging to the same session corresponding to the same user, and target blog posts that the user is interested in from the multiple blog post information.
[0101] The model training module 420 is used to iteratively train the neural network model using the conversation sequence sample set, extract the category features of each blog post information in the conversation sequence sample and perform bucketing processing to obtain the category bucket corresponding to each blog post information, and obtain the category identifier code corresponding to each blog post information based on the category bucket corresponding to each blog post information.
[0102] The category identifier code corresponding to each blog post in the conversation sequence sample, as well as the target blog post, are input into the neural network model for feature fusion processing based on the attention mechanism, and the predicted blog post vector corresponding to the conversation sequence sample is output.
[0103] The model parameters of the neural network model are adjusted based on the predicted blog post vectors corresponding to the session sequence samples and the loss function of the neural network model until the set convergence condition is met. The trained neural network model is then used as the blog post vector generation model.
[0104] Specifically, when the sample acquisition module 410 is used to acquire a session sequence sample set based on historical session data of multiple users, it is used for:
[0105] Collect historical session data from multiple users, including access data to blog posts generated by users' historical behavior.
[0106] The historical session data is grouped according to user identifiers, the access data corresponding to the same user is sorted according to access time, and the blog post information in the access data is grouped according to the session division rules to obtain the session sequence sample set; wherein, the session division rules are as follows: for the access data corresponding to the same user, if the access frequency within a set time period is lower than a preset frequency threshold, the access data before the first moment and the access data after the second moment belong to different sessions; the first moment is the left end moment of the set time period, and the second moment is the right end moment of the set time period.
[0107] After obtaining a session sequence sample set based on historical session data from multiple users, the sample acquisition module 410 is further configured to:
[0108] Filter out blog posts in the session sequence sample set whose access duration is less than a preset time threshold; or,
[0109] Filter out session sequence samples in the session sequence sample set whose number of blog post information is less than a preset threshold.
[0110] The model training module 420 performs attention-based feature fusion processing on the neural network model by inputting the category identifier code corresponding to each blog post in the session sequence sample and the target blog post into the neural network model, and outputs the predicted blog post vector corresponding to the session sequence sample. Specifically, it is used for:
[0111] For any blog post in the conversation sequence sample, the category identifier code corresponding to the blog post is used as the first blog post vector of the blog post, and the similarity value between the first blog post vector and the target blog post vector corresponding to the target blog post is determined as the attention weight corresponding to the first blog post vector.
[0112] Based on the first blog post vector of each blog post and the attention weight corresponding to the first blog post vector, the predicted blog post vector corresponding to the session sequence sample is determined.
[0113] The loss function includes a first loss function and a second loss function. The first loss function is used to characterize the matching degree between the predicted blog post vector corresponding to the session sequence sample and the first blog post vector represented by the category identifier code corresponding to each blog post information. The second loss function is used to characterize the distance between the different category feature distributions included in the predicted blog post represented by the predicted blog post vector.
[0114] The training device 400 for the blog post vector generation model provided in this application embodiment is executable. Figure 1 The method described, and its implementation Figure 1 The functions of the illustrated embodiments will not be described again here.
[0115] Figure 5 A schematic diagram of the structure of the blog post recommendation device provided in an embodiment of this application is shown. The device 500 includes:
[0116] The sequence acquisition module 510 is used to acquire the target session sequence of the target user; the target session sequence includes multiple blog post information belonging to the same session corresponding to the target user;
[0117] The identifier code determination module 520 is used to determine the category identifier code corresponding to each blog post based on the category characteristics of each blog post in the target session sequence;
[0118] The vector output module 530 is used to input the category identifier code corresponding to each blog post information into the blog post vector generation model for feature fusion processing, and output the predicted blog post vector of the target user; the blog post vector generation model is trained using the above-mentioned blog post vector generation model training device;
[0119] The similarity determination module 540 is used to determine the similarity between the candidate blog post vector corresponding to the candidate blog post in the preset database and the predicted blog post vector;
[0120] The blog post recommendation module 550 is used to recommend candidate blog posts that meet preset similarity criteria to the target user.
[0121] The blog post recommendation device 500 provided in this application embodiment is capable of executing... Figure 3 The method described, and its implementation Figure 3 The functions of the illustrated embodiments will not be described again here.
[0122] Figure 6 The diagram illustrates the hardware structure of a computer device implementing the embodiments of this application. Referring to the diagram, at the hardware level, the electronic device includes a processor and optionally, an internal bus, a network interface, and memory. The memory may include RAM, such as high-speed random-access memory (RAM), or non-volatile memory, such as at least one disk storage device. Of course, the computer device may also include other hardware required for other business operations.
[0123] The processor, network interface, and memory can be interconnected via an internal bus, which can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be categorized as an address bus, data bus, control bus, etc. For ease of illustration, only a single bidirectional arrow is used in this diagram, but this does not imply that there is only one bus or one type of bus.
[0124] Memory stores programs. Specifically, programs may include program code, which includes computer operation instructions. Memory may include main memory and non-volatile memory, and provides instructions and data to the processor.
[0125] The processor reads the corresponding computer program from non-volatile memory into main memory and then runs it, logically forming a device that locates the target user. The processor executes the program stored in memory and specifically performs the following: Figure 1 or Figure 3 The methods disclosed in the embodiments shown achieve the functions and beneficial effects of the methods described in the preceding method embodiments, and will not be repeated here.
[0126] The above is as stated in this application. Figure 1 or Figure 3 The methods disclosed in the illustrated embodiments can be implemented in or by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0127] The computer device can also execute the methods described in the preceding method embodiments and achieve the functions and beneficial effects of the methods described in the preceding method embodiments, which will not be repeated here.
[0128] Of course, in addition to software implementation, the electronic device of this application does not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. In other words, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0129] This application also proposes a computer-readable storage medium that stores one or more programs, which, when executed by an electronic device including multiple applications, cause the electronic device to perform... Figure 1 or Figure 3 The methods disclosed in the embodiments shown achieve the functions and beneficial effects of the methods described in the preceding method embodiments, and will not be repeated here.
[0130] The computer-readable storage medium includes read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, etc.
[0131] Furthermore, embodiments of this application also provide a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, which, when executed by a computer, implement the following process: Figure 1-3 The methods disclosed in the embodiments shown achieve the functions and beneficial effects of the methods described in the preceding method embodiments, and will not be repeated here.
[0132] In summary, the above description is merely a preferred embodiment of this application and does not limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
[0133] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0134] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can store information accessible to a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0135] It should also be noted that 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. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0136] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
Claims
1. A training method for a blog post vector generation model, characterized in that, include: A session sequence sample set is obtained based on the historical session data of multiple users. Each session sequence sample in the session sequence sample set includes: multiple blog posts belonging to the same session corresponding to the same user, and the target blog post that the user is interested in among the multiple blog posts. The neural network model is iteratively trained using the conversation sequence sample set. The category features of each blog post in the conversation sequence sample are extracted and binned to obtain the category bins corresponding to each blog post. The category identifier code corresponding to each blog post is obtained based on the mapping of the category bins corresponding to each blog post. The category identifier code corresponding to each blog post in the conversation sequence sample, as well as the target blog post, are input into the neural network model for feature fusion processing based on the attention mechanism, and the predicted blog post vector corresponding to the conversation sequence sample is output. The model parameters of the neural network model are adjusted according to the predicted blog post vectors corresponding to the session sequence samples and the loss function of the neural network model until the set convergence condition is met, and the trained neural network model is used as the blog post vector generation model. The step of inputting the category identifier code corresponding to each blog post in the session sequence sample and the target blog post into the neural network model for feature fusion processing based on an attention mechanism, and outputting the predicted blog post vector corresponding to the session sequence sample, includes: For any blog post in the conversation sequence sample, the category identifier code corresponding to the blog post is used as the first blog post vector of the blog post, and the similarity value between the first blog post vector and the target blog post vector corresponding to the target blog post is determined as the attention weight corresponding to the first blog post vector. Based on the first blog post vector of each blog post and the attention weight corresponding to the first blog post vector, the predicted blog post vector corresponding to the session sequence sample is determined.
2. The method according to claim 1, characterized in that, The process of obtaining a session sequence sample set based on historical session data from multiple users includes: Collect historical session data from multiple users, including access data to blog posts generated by users' historical behavior. The historical session data is grouped according to user identifiers, the access data corresponding to the same user is sorted according to access time, and the blog post information in the access data is grouped according to the session division rules to obtain the session sequence sample set; wherein, the session division rules are as follows: for the access data corresponding to the same user, if the access frequency within a set time period is lower than a preset frequency threshold, the access data before the first moment and the access data after the second moment belong to different sessions; the first moment is the left end moment of the set time period, and the second moment is the right end moment of the set time period.
3. The method according to claim 2, characterized in that, After obtaining the session sequence sample set based on the historical session data of multiple users, the method further includes: Filter out blog posts in the session sequence sample set whose access duration is less than a preset time threshold; or, Filter out session sequence samples in the session sequence sample set whose number of blog post information is less than a preset threshold.
4. The method according to claim 1, characterized in that, The loss function includes a first loss function and a second loss function. The first loss function is used to characterize the matching degree between the predicted blog post vector corresponding to the session sequence sample and the first blog post vector represented by the category identifier code corresponding to each blog post information. The second loss function is used to characterize the distance between the different category feature distributions included in the predicted blog post represented by the predicted blog post vector.
5. A blog post recommendation method, characterized in that, include: Obtain the target user's target session sequence; the target session sequence includes multiple blog posts belonging to the same session corresponding to the target user; Based on the category characteristics of each blog post in the target session sequence, determine the category identifier code corresponding to each blog post; Each blog post's category identifier is input into the blog post vector generation model for feature fusion processing, and the predicted blog post vector for the target user is output. The blog post vector generation model is trained using the training method described in any one of claims 1 to 4. Determine the similarity between the candidate blog post vector corresponding to the candidate blog post in the preset database and the predicted blog post vector; Candidate blog posts that meet preset similarity criteria are recommended to the target user.
6. A training device for a blog post vector generation model, characterized in that, include: The sample acquisition module is used to acquire a session sequence sample set based on the historical session data of multiple users. Each session sequence sample in the session sequence sample set includes: multiple blog posts belonging to the same session corresponding to the same user, and target blog posts that the user is interested in from the multiple blog posts. The model training module is used to iteratively train the neural network model using the conversation sequence sample set, extract the category features of each blog post in the conversation sequence sample and perform bucketing to obtain the category bucket corresponding to each blog post, and obtain the category identifier code corresponding to each blog post based on the category bucket mapping corresponding to each blog post. The category identifier code corresponding to each blog post in the conversation sequence sample, as well as the target blog post, are input into the neural network model for feature fusion processing based on the attention mechanism, and the predicted blog post vector corresponding to the conversation sequence sample is output. The model parameters of the neural network model are adjusted according to the predicted blog post vectors corresponding to the session sequence samples and the loss function of the neural network model until the set convergence condition is met, and the trained neural network model is used as the blog post vector generation model. The model training module is specifically used to, for any blog post information in the conversation sequence sample, take the category identifier code corresponding to the blog post information as the first blog post vector of the blog post information, and determine the similarity value between the first blog post vector and the target blog post vector corresponding to the target blog post as the attention weight corresponding to the first blog post vector. Based on the first blog post vector of each blog post and the attention weight corresponding to the first blog post vector, the predicted blog post vector corresponding to the session sequence sample is determined.
7. A blog post recommendation device, characterized in that, include: The sequence acquisition module is used to acquire the target session sequence of the target user; the target session sequence includes multiple blog post information belonging to the same session corresponding to the target user; The identifier code determination module is used to determine the category identifier code corresponding to each blog post based on the category characteristics of each blog post in the target session sequence; The vector output module is used to input the category identifier code corresponding to each blog post information into the blog post vector generation model for feature fusion processing, and output the predicted blog post vector of the target user; the blog post vector generation model is trained using the training device for the blog post vector generation model as described in claim 6; The similarity determination module is used to determine the similarity between the candidate blog post vector corresponding to the candidate blog post in the preset database and the predicted blog post vector; The blog post recommendation module is used to recommend candidate blog posts that meet preset similarity criteria to the target user.
8. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing programs or instructions that can run on the processor, the programs or instructions being executed by the processor to implement the steps of the method as described in any one of claims 1 to 5.
9. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1 to 5.