A method, apparatus, device, and storage medium for recommending conversations
By utilizing the general interest generator, short-term interest generator, and distance generator in the conversation recommendation model, and employing unsupervised agents and multi-head attention mechanisms, the problem that traditional conversation recommendation systems cannot leverage long-sequence user behavior and global dependencies is solved, achieving more accurate recommendation results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILEHANGZHOUINFORMATION TECH CO LTD
- Filing Date
- 2022-10-26
- Publication Date
- 2026-05-05
AI Technical Summary
Traditional conversational recommendation systems struggle to effectively leverage long sequences of user behavior and global dependencies, resulting in insufficient recommendation accuracy, especially when users are not logged in, making it difficult to accurately predict the next item of interest.
A conversational recommendation model is adopted, including a general interest generator, a short-term interest generator, and a distance generator. An unsupervised agent is used to simulate the general interest encoding, a multi-head attention mechanism is combined to obtain the short-term interest encoding, and the dissimilarity score is determined by the distance generator to achieve the recommendation of target items.
It improves the accuracy of session recommendations, enabling accurate recommendation of target items even when the user is not logged in, and effectively learns common information and global dependencies in the session.
Smart Images

Figure CN116975419B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and includes, but is not limited to, a conversation recommendation method, apparatus, device, and storage medium. Background Technology
[0002] With the rapid development of technologies such as cloud computing, big data, and the Internet of Things, the volume of big data on the internet has exploded. In this era of information overload, many users face the burden of information overload, thus requiring recommendation systems to help them filter information. However, traditional recommendation systems rely on analyzing users' long-term operational data to obtain their long-term static preferences, and then make recommendations accordingly. Many users are unwilling to register or log in due to complex procedures or concerns about privacy leaks. A user's next action depends not only on long-term static preferences but also on their current interests, which can be inferred from recent interactions. Therefore, conversation-based recommendation systems have emerged.
[0003] Session recommendation aims to predict a user's next item of interest based on the click order of their recent items. Common methods include Markov chains, Recursive Neural Networks (RNNs), and Graph Neural Networks (GNNs). Markov chains are a classic approach that assumes the next action depends on the last one or a few actions. RNNs model both the user's sequential behavior and primary purpose, capturing general interests from the long-term memory of the session context. Some methods also consider repeated consumption, introducing repeated exploration mechanisms to significantly improve performance in repetitive session scenarios. GNNs primarily construct session graphs from session sequences to obtain dependencies between adjacent items.
[0004] Markov chains are a classic approach, but they cannot leverage long sequences of user behavior and are prone to data sparsity problems. RNN-based models outperform CNN-based models, but they struggle to learn long-range dependencies; the performance of RNN-based methods degrades significantly as session sequences lengthen. While GNNs address the long-range learning limitations of RNNs by considering item transitions, GNN-based methods can only learn dependencies between adjacent items, failing to learn global dependencies. Summary of the Invention
[0005] In view of this, embodiments of this application provide a session recommendation method, apparatus, device, and storage medium.
[0006] The technical solution of this application embodiment is implemented as follows:
[0007] In a first aspect, embodiments of this application provide a conversation recommendation method, the method comprising:
[0008] Obtain a session recommendation model, an input session, and a target item set, wherein the session recommendation model includes at least a general interest generator, a short-term interest generator, and a distance generator;
[0009] The general interest encoding of the input session is simulated by an unsupervised agent of the general interest generator;
[0010] The short-term interest encoding of the input session is obtained using the multi-head attention mechanism of the short-term interest generator.
[0011] Using the distance generator, based on the general interest code, the short-term interest code, and the target items, the dissimilarity score between the input session and each target item in the target item set is determined to obtain the recommendation result for the input session.
[0012] Secondly, embodiments of this application provide a conversation recommendation device, the device comprising:
[0013] The first acquisition module is used to acquire the session recommendation model, the input session, and the target item, wherein the session recommendation model includes at least a general interest generator, a short-term interest generator, and a distance generator;
[0014] A simulation module is used to simulate the general interest encoding of the input session using an unsupervised agent of the general interest generator;
[0015] The second acquisition module is used to acquire the short-term interest code of the input session using the multi-head attention mechanism of the short-term interest generator;
[0016] A determination module is used to use the distance generator to determine the dissimilarity score between the input session and the target item based on the general interest code, the short-term interest code, and the target item, so as to obtain the recommendation result of the input session.
[0017] Thirdly, embodiments of this application provide an electronic device, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the program to implement the above-described method.
[0018] Fourthly, embodiments of this application provide a storage medium storing executable instructions for implementing the above-described method when executed by a processor.
[0019] In this embodiment, a session recommendation model, an input session, and a target item set are first obtained. The session recommendation model includes at least a general interest generator, a short-term interest generator, and a distance generator. Then, the unsupervised agent of the general interest generator simulates the general interest encoding of the input session. The multi-head attention mechanism of the short-term interest generator is used to obtain the short-term interest encoding of the input session. Finally, the distance generator, based on the general interest encoding, the short-term interest encoding, and the target items, determines the dissimilarity score between the input session and each target item in the target item set to obtain the recommendation result for the input session. In this way, the general interest generator can effectively learn common information in the session, simulate the user's general interests, and, combined with the short-term interest generator, capture and retain the complete dependencies between all items to obtain short-term interests, greatly improving the accuracy of session recommendations. Attached Figure Description
[0020] Figure 1 A schematic diagram illustrating the implementation process of a session recommendation method provided in this application embodiment;
[0021] Figure 2 This application provides a schematic diagram of the implementation process for training a general interest generator.
[0022] Figure 3 A schematic diagram illustrating the implementation process of a training session recommendation model provided in this application embodiment;
[0023] Figure 4 A schematic diagram of the architecture of a conversation recommendation model provided in an embodiment of this application;
[0024] Figure 5 This is a schematic diagram of the composition structure of a conversation recommendation device provided in an embodiment of this application;
[0025] Figure 6 This is a schematic diagram of a hardware entity of an electronic device provided in an embodiment of this application. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the specific technical solutions of the embodiments will be further described in detail below with reference to the accompanying drawings. The following embodiments are used to illustrate this application, but are not intended to limit the scope of this application.
[0027] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0028] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0030] This application provides a session recommendation method, such as... Figure 1 As shown, the method includes:
[0031] Step S110: Obtain the session recommendation model, input session and target item set, wherein the session recommendation model includes at least a general interest generator, a short-term interest generator and a distance generator;
[0032] Here, the conversation recommendation model can recommend target items to the user from the target item set based on the input conversation. The conversation recommendation model includes at least a general interest generator, a short-term interest generator, and a distance generator. The general interest generator is used to generate the user's general interests based on the input conversation; the short-term interest generator is used to generate the user's short-term interests based on the input conversation; and the distance generator is used to recommend a target item to the user from the target item set based on the general interest and the short-term interest.
[0033] Step S120: Simulate the general interest encoding of the input session using the unsupervised proxy of the general interest generator;
[0034] Here, a modeling component for agent selection can be used to select an unsupervised agent p from a predefined agent set in an unsupervised manner through end-to-end learning. s The selected unsupervised agent p s It can mimic the general interests of the input conversation.
[0035] Step S130: Obtain the short-term interest encoding of the input session using the multi-head attention mechanism of the short-term interest generator;
[0036] Here, the encoder network f can be... s As a short-term interest generator for input sessions.
[0037] Since short-term sessions can represent a user's short-term interests, the encoder network f s The input session s can be encoded into a latent representation S sAs shown in formula (1) below:
[0038] S s =f S (s) (1);
[0039] In some embodiments, a multi-head self-attention network with residual connections can be used as f s This network can obtain the dependencies between items in a sequence and effectively model the sequence.
[0040] During implementation, short-term interest in input sessions s can be obtained using the following formulas (2) to (7):
[0041] E = [e1, e2, ..., e n (2);
[0042]
[0043]
[0044]
[0045] H = Concat(head1,...,head) h W o +E (6);
[0046] f S (s)=ReLU(HW (1) +b (1) W (2) +b (2) (7);
[0047] Where E is the d-dimensional embedding obtained by the input session s after passing through the embedding layer. Let W be the parameter matrix of the i-th head attention, h be the number of head attentions, and W be the parameter matrix of the i-th head attention. o It is a projection matrix, W (1) W (2) It is a d×d matrix, b (1) b (2) It is a d-dimensional vector.
[0048] In this way, through the multi-head attention mechanism, each item in the session can assign weights to other items, thereby learning dependencies with other items. Then, h individual head attentions are combined with multi-head attention to learn dependencies at different positions. Residual connections can also be added to the network to help the model learn underlying information.
[0049] Step S140: Using the distance generator, based on the general interest code, the short-term interest code, and the target item set, determine the dissimilarity score between the input session and each target item in the target item set, so as to obtain the recommendation result of the input session.
[0050] During implementation, the short-term interest and target item set obtained using a general interest generator can be embedded and projected onto the hyperplane of the selected unsupervised agent to construct the model, thus obtaining the distance generator.
[0051] The distance generator can be used to determine the dissimilarity score between the input session and each target item in the target item set to obtain the recommendation result for the input session.
[0052] In this embodiment, a session recommendation model, an input session, and a target item set are first obtained. The session recommendation model includes at least a general interest generator, a short-term interest generator, and a distance generator. Then, the unsupervised agent of the general interest generator simulates the general interest encoding of the input session. The multi-head attention mechanism of the short-term interest generator is used to obtain the short-term interest encoding of the input session. Finally, the distance generator, based on the general interest encoding, the short-term interest encoding, and the target items, determines the dissimilarity score between the input session and each target item in the target item set to obtain the recommendation result for the input session. In this way, the general interest generator can effectively learn common information in the session, simulate the user's general interests, and, combined with the short-term interest generator, capture and retain the complete dependencies between all items to obtain short-term interests, greatly improving the accuracy of session recommendations.
[0053] In some embodiments, step S140 above, "using the distance generator, based on the general interest code, the short-term interest code, and the target item set, to determine the dissimilarity score between the input session and the target item set, so as to obtain the recommendation result of the input session," can be implemented through the following steps:
[0054] Step 141: Project the short-term interest code and the target item set onto the hyperplane of the unsupervised agent using the distance generator to obtain the target short-term interest code and the target item code;
[0055] During implementation, short-term interest codes and each target item in the target item set can be encoded onto the hyperplane of the selected unsupervised agent, and their relationships can be defined on the hyperplane.
[0056] Encoding short-term interests And each target project in the project target project set I i⊥Project onto the hyperplane of the selected unsupervised agent, as shown in equations (8) to (10) below:
[0057]
[0058]
[0059] I i⊥ =I i -v Τ I i v (10);
[0060] Where, V∈R K×d It is the set of unit normal vectors of the unsupervised surrogate hyperplane, v∈R d It is projected onto p (s) Let R be the unit normal vector of the hyperplane to which the proxy hyperplane is located, and R represent space. To make the normal vector orthogonal to the proxy hyperplane and have a unit length, we can force |v·p|. (s) | / ||p (s) ||2≤ε and use||V j Regularization is performed by setting ||2=1.
[0061] Step 142: Use the distance generator to obtain the aggregate value of the general interest code and the target short-term interest code, and the distance between them and the target item code;
[0062] Step 143: Determine the dissimilarity score between the input session and the target item based on the distance, and determine the target item with the smallest dissimilarity score in the target item set as the recommendation result of the input session.
[0063] In the implementation process, the dissimilarity score between the input session s and the target item i can be estimated by using the aggregated value of the general interest code and the target short-term interest code, and the distance between them. The specific expression of the dissimilarity score is as follows: (11)
[0064]
[0065] Here, the larger dist(s,i) is, the lower the probability that item i will be the next item in session s.
[0066] In this embodiment, the short-term interest code and the target item set are first projected onto the hyperplane of the unsupervised agent using the distance generator to obtain the target short-term interest code and the target item code. Then, the distance generator is used to obtain the aggregate value of the general interest code and the target short-term interest code, and the distance between this aggregate value and the target item code. Finally, based on the distance, the dissimilarity score between the input session and the target item is determined, and the target item with the smallest dissimilarity score in the target item set is identified as the recommendation result for the input session. In this way, the short-term interest code and the general interest code can be combined to provide the user with a more accurate target item recommendation.
[0067] In some embodiments, the general interest generator includes at least an encoder network, a normalized exponential function with a temperature coefficient, and the unsupervised agent, such as... Figure 2 As shown, training the general interest generator includes the following steps:
[0068] Step S210: Obtain the training set and the proxy embedding set;
[0069] Step S220: During the training process, the sessions in the training set are input into the encoder network to obtain a set of probability vectors;
[0070] During implementation, an encoder network can be used to generate a set of probability vectors α, as shown in the following formula (12):
[0071] α=f P (s) (12);
[0072] Where is f P The encoder network for the session.
[0073] Step S230: Use the normalized exponential function with temperature coefficient to convert the probability vector into a skewed probability distribution;
[0074] During implementation, a softmax function with a temperature coefficient can be used to transform the probability vector into a skewed probability distribution π∈R. K R represents space. As shown in formula (13) below:
[0075]
[0076] Where K is the predefined number of agents, π j τ is the probability of the j-th agent, and τ is the temperature coefficient.
[0077] Step S240: Based on the mapping relationship between the skewed probability distribution and the agent embedding set, determine the unsupervised agent in the agent embedding set.
[0078] During implementation, it can be determined that the input session is indeed an unsupervised agent as shown in formulas (14) and (15):
[0079]
[0080]
[0081] Where P is the agent embedding matrix, and after several rounds of training, τ becomes very small, and π becomes a one-hot vector, which can select a unique unsupervised agent from the agent embedding set for session recommendation.
[0082] In this embodiment, a training set and a proxy embedding set are first obtained. Then, during training, the sessions from the training set are input into the encoder network to obtain a set of probability vectors. The probability vectors are then converted into a skewed probability distribution using a normalized exponential function with a temperature coefficient. Finally, based on the mapping relationship between the skewed probability distribution and the proxy embedding set, the unsupervised proxy is determined from the proxy embedding set. Thus, after training, an unsupervised proxy for session recommendation can be selected from the proxy embedding set.
[0083] In some embodiments, the "obtaining the training set" step S210 above can be achieved through the following steps:
[0084] Step 211: Obtain the original dataset;
[0085] You can use the original dataset, such as the Yoochoose dataset.
[0086] Step 212: Filter the original dataset for sessions whose length is less than the length threshold and whose frequency is less than the frequency threshold to obtain the target dataset;
[0087] During preprocessing, since a length of 1 cannot display the impact of the user's previous action on the next action, sessions with a length of 1 in the dataset can be filtered out; sessions that appear less than 5 times are considered to have no reference value, and sessions that appear less than 5 times can be filtered out.
[0088] Step 213: Segment the target dataset to obtain a training set and a test set, wherein the training set and the test set include sequences and the labels of the sequences.
[0089] Here, the segmentation process can be to divide the input sessions S = {s1, s2, ..., s...} in the training set and the test set. n The sequence is split into segments, generating sequences and corresponding labels ([s1], s2), ([s1, s2], s3), ..., ([s1, s2, ..., s3)). n-1 ],s n ).
[0090] In this embodiment, a target dataset is obtained by filtering out sessions whose length is less than a length threshold and whose frequency is less than a frequency threshold from the original dataset; the target dataset is then segmented to obtain a training set and a test set. This effectively expands the training and test sets, improving the accuracy of the model's recommendations.
[0091] In some embodiments, step S230 above, "converting the probability vector into a skewed probability distribution using the normalized exponential function with a temperature coefficient," can be achieved through the following steps:
[0092] Step 231: Obtain the initial temperature coefficient of the temperature coefficient;
[0093] During implementation, as shown in formula (13) above, as τ decreases, π gradually becomes a hard distribution approaching a single-hot vector; as τ increases, each element of π approaches 1 / K. Therefore, a large initial value can be assigned to τ, which is then gradually reduced during training.
[0094] Step 232: Convert the probability vector into a skewed probability distribution using a normalized exponential function with the initial temperature coefficient, wherein the skewed probability distribution approximates the hard distribution of a single heat vector.
[0095] As shown in formula (15) above, after several rounds of training, τ becomes very small, and π becomes a single-hot vector.
[0096] In this embodiment, an initial temperature coefficient is first obtained; then, the probability vector is converted into a skewed probability distribution using a normalized exponential function with the initial temperature coefficient, wherein the skewed probability distribution approximates the hard distribution of a single heat vector. Thus, by setting the initial temperature coefficient, the obtained skewed probability distribution approximates the hard distribution of a single heat vector.
[0097] In some embodiments, training the session recommendation model includes the following steps:
[0098] Step S310: Train the session recommendation model using the hinge loss function;
[0099] Step S320: During the training process, add weighted orthogonal regularization and distance regularization to the objective function.
[0100] In the implementation process, the hinge loss function is used to train the session recommendation model, and weighted orthogonal regularization and distance regularization are added to the objective function to enhance the learning ability. The specific loss function is shown in the following formula (16):
[0101]
[0102] Where is the training set of the sessions, i+ is the correct next item of session s, NI(s) is the set of incorrect next items of session s, and [x] + Let represent max(x,0), and m be the boundary. After adding the regularization term, the final objective function can be defined using the following formulas (17) to (19):
[0103]
[0104]
[0105] F=L+λ dist ·reg dist +λ orthog ·reg orthog (19);
[0106] Where, λ dist and λ orthog These are the regularization coefficients for distance regularization and orthogonal regularization, respectively.
[0107] Step S330: Establish an evaluation system including hit rate indicators and average reciprocal ranking to optimize the session recommendation model through evaluation indicators.
[0108] During implementation, an evaluation system can be established that includes the HR@20 hit rate metric and the MRR@20 mean reciprocal rank metric. By evaluating the metrics, the model can be optimized to obtain the optimal method.
[0109] In this embodiment, a hinge loss function is used to train the session recommendation model, and weighted orthogonal regularization and distance regularization are added to the objective function to enhance learning ability. An evaluation system including hit rate and average reciprocal ranking is established to optimize the session recommendation model through evaluation metrics and obtain the optimal method.
[0110] Figure 4 This is a schematic diagram of the architecture of a conversation recommendation model provided in an embodiment of this application, as shown below. Figure 4 As shown in the diagram, the architecture includes: dataset preprocessing 41, a general interest generator 42, a short-term interest generator 43, and a distance generator 44, wherein...
[0111] Dataset preprocessing 41 can use the original dataset, such as the Yoochoose dataset. During preprocessing, filter out session data of length 1 and items appearing less than 5 times, and perform sequence segmentation preprocessing. Here, segmentation preprocessing can involve dividing the input sessions S = {s1, s2, ..., s...} from the training and test sets.n The sequence is split into segments, generating sequences and corresponding labels ([s1], s2), ([s1, s2], s3), ..., ([s1, s2, ..., s3)). n-1 ],s n Data preprocessing can expand the training and test sets, thereby improving the accuracy of model recommendations.
[0112] During model training, the interest generator 42 can typically select an unsupervised agent p from a predefined set of agent embeddings in an unsupervised manner through end-to-end learning. s The selected unsupervised agent p s It can mimic the general interests of the input session s. Here, the general interest generator 42 includes at least an encoder network, a normalized exponential function with a temperature coefficient, and an unsupervised agent.
[0113] Short-term sessions themselves represent a user's short-term interests, and the short-term interest generator 43 can encode the input session s into a latent representation S. s Here, the short-term interest generator includes at least a multi-head attention network.
[0114] The short-term interest generator 43 can generate short-term interests. Embedded with project goals i⊥ The model is constructed by projecting the model onto the hyperplane of the selected unsupervised agent, resulting in the distance generator 44.
[0115] In this application embodiment, a short-term session recommendation technology based on unsupervised agent and multi-head attention mechanism is proposed. The general interest generator simulates the general interest of the input session, and the multi-head attention network in the short-term interest generator captures and retains the complete dependency relationship between all items to obtain the short-term interest of the input session, so as to ensure accurate recommendations to users even when they are not logged in.
[0116] Based on the foregoing embodiments, this application provides a conversation recommendation device, which includes various modules, each module including sub-modules, and each sub-module including units. It can be implemented by a processor in an electronic device; of course, it can also be implemented by specific logic circuits. In the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.
[0117] Figure 5This is a schematic diagram of the composition structure of the conversation recommendation device provided in the embodiments of this application, as shown below. Figure 5 As shown, the device 500 includes:
[0118] The first acquisition module 510 is used to acquire a session recommendation model, an input session, and a target item, wherein the session recommendation model includes at least a general interest generator, a short-term interest generator, and a distance generator.
[0119] Simulation module 520 is used to simulate the general interest encoding of the input session using an unsupervised proxy of the general interest generator;
[0120] The second acquisition module 530 is used to acquire the short-term interest code of the input session using the multi-head attention mechanism of the short-term interest generator;
[0121] The first determining module 540 is used to determine the dissimilarity score between the input session and each target item in the target item set based on the general interest code, the short-term interest code, and the target item using the distance generator, so as to obtain the recommendation result of the input session.
[0122] In some embodiments, the first determining module 540 includes a projection submodule, a first acquisition submodule, and a determining submodule. The projection submodule is used to project the short-term interest code and the target item set onto the hyperplane of the unsupervised agent using the distance generator, respectively, to obtain the target short-term interest code and the target item code. The first acquisition submodule is used to use the distance generator to obtain the aggregate value of the general interest code and the target short-term interest code, and the distance between it and the target item code. The determining submodule is used to determine the dissimilarity score between the input session and the target item based on the distance, and to determine the target item with the smallest dissimilarity score in the target item set as the recommendation result for the input session.
[0123] In some embodiments, the general interest generator includes at least an encoder network, a normalized exponential function with a temperature coefficient, and the unsupervised agent. The apparatus further includes a third acquisition module, an input module, a transformation module, and a second determination module. The third acquisition module is used to acquire a training set and an agent embedding set. The input module is used to input sessions from the training set into the encoder network during training to obtain a set of probability vectors. The transformation module is used to convert the probability vectors into a skewed probability distribution using the normalized exponential function with a temperature coefficient. The determination module is used to determine the unsupervised agent in the agent embedding set based on the mapping relationship between the skewed probability distribution and the agent embedding set.
[0124] In some embodiments, the third acquisition module includes a second acquisition submodule, a filtering submodule, and a segmentation submodule, wherein the second acquisition submodule is used to acquire the original dataset; the filtering submodule is used to filter sessions in the original dataset whose length is less than a length threshold and whose frequency is less than a frequency threshold to obtain a target dataset; the segmentation submodule is used to segment the target dataset to obtain a training set and a test set, wherein the training set and the test set include sequences and the labels of the sequences.
[0125] In some embodiments, the conversion submodule includes an acquisition unit and a conversion unit, wherein the acquisition unit is used to acquire the initial temperature coefficient of the temperature coefficient; and the conversion unit is used to convert the probability vector into a skewed probability distribution using a normalized exponential function with the initial temperature coefficient, wherein the skewed probability distribution approximates the hard distribution of a single thermal vector.
[0126] In some embodiments, the apparatus further includes a training module and an adding module, wherein the training module is used to train the session recommendation model using a hinge loss function; and the adding module is used to add weighted orthogonal regularization and distance regularization to the objective function during training.
[0127] In some embodiments, the apparatus further includes a building module for building an evaluation system including a hit rate metric and an average reciprocal ranking, so as to optimize the session recommendation model through evaluation metrics.
[0128] The descriptions of the above device embodiments are similar to those of the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0129] It should be noted that, in the embodiments of this application, if the above methods are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of software products. These computer software products are stored in a storage medium and include several instructions to cause electronic devices (such as mobile phones, tablets, laptops, desktop computers, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.
[0130] Correspondingly, embodiments of this application provide a storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in the session recommendation method provided in the above embodiments.
[0131] Correspondingly, embodiments of this application provide an electronic device, Figure 6 A schematic diagram of a hardware entity of an electronic device provided in an embodiment of this application, such as... Figure 6 As shown, the hardware entity of the device 600 includes a memory 601 and a processor 602. The memory 601 stores a computer program that can run on the processor 602. When the processor 602 executes the program, it implements the steps in the session recommendation method provided in the above embodiments.
[0132] The memory 601 is configured to store instructions and applications executable by the processor 602, and can also cache data to be processed or already processed (e.g., image data, audio data, voice communication data and video communication data) of the processor 602 and various modules in the electronic device 600, and can be implemented by flash memory or random access memory (RAM).
[0133] It should be noted that the descriptions of the storage medium and device embodiments above are similar to the descriptions of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0134] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0135] It should be noted that, in this document, 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. Unless otherwise specified, 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 that element.
[0136] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0137] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.
[0138] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0139] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.
[0140] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a mobile phone, tablet computer, laptop computer, desktop computer, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, magnetic disks, or optical disks.
[0141] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0142] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0143] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.
[0144] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A conversation recommendation method, characterized in that, The session recommendation is used to predict the user's next item of interest based on the click order of the user's recent items, and the method includes: Obtain a session recommendation model, an input session, and a target item set, wherein the session recommendation model includes at least a general interest generator, a short-term interest generator, and a distance generator; The general interest encoding of the input session is simulated by an unsupervised agent of the general interest generator; The short-term interest encoding of the input session is obtained using the multi-head attention mechanism of the short-term interest generator. The distance generator is used to project the short-term interest code and the target item set onto the hyperplane of the unsupervised agent to obtain the target short-term interest code and the target item code, respectively. The distance generator is used to obtain the aggregated value of the general interest code and the target short-term interest code, and the distance between them and the target item code; Based on the distance, the dissimilarity score between the input session and each target item in the target item set is determined, and the target item with the smallest dissimilarity score in the target item set is determined as the recommendation result of the input session; The general interest generator includes at least an encoder network, a normalized exponential function with a temperature coefficient, and the unsupervised agent. Training the general interest generator includes: Obtain the training set and the proxy embedding set; During training, the sessions in the training set are input into the encoder network to obtain a set of probability vectors; The probability vector is converted into a skewed probability distribution using the normalized exponential function with a temperature coefficient. Based on the mapping relationship between the skewed probability distribution and the agent embedding set, the unsupervised agent is determined in the agent embedding set.
2. The method as described in claim 1, characterized in that, The acquisition of the training set includes: Obtain the original dataset; Filter the original dataset to obtain the target dataset by filtering out sessions whose length is less than a length threshold and sessions whose frequency is less than a frequency threshold; The target dataset is segmented to obtain a training set and a test set, wherein the training set and the test set include sequences and the labels of the sequences.
3. The method as described in claim 1, characterized in that, The step of converting the probability vector into a skewed probability distribution using a normalized exponential function with a temperature coefficient includes: Obtain the initial temperature coefficient of the temperature coefficient; The probability vector is converted into a skewed probability distribution using a normalized exponential function with the initial temperature coefficient, wherein the skewed probability distribution approximates the hard distribution of a single heat vector.
4. The method as described in claim 1, characterized in that, The method further includes: The session recommendation model is trained using the hinge loss function; During training, weighted orthogonal regularization and distance regularization are added to the objective function.
5. The method as described in claim 1, characterized in that, An evaluation system including hit rate and average reciprocal ranking is established to optimize the session recommendation model through evaluation metrics.
6. A conversation recommendation device, characterized in that, The session recommendation is used to predict the user's next item of interest based on the click order of the user's recent items, and the device includes: The first acquisition module is used to acquire the session recommendation model, the input session, and the target item, wherein the session recommendation model includes at least a general interest generator, a short-term interest generator, and a distance generator; A simulation module is used to simulate the general interest encoding of the input session using an unsupervised agent of the general interest generator; the general interest generator includes at least an encoder network, a normalized exponential function with a temperature coefficient, and the unsupervised agent; The second acquisition module is used to acquire the short-term interest code of the input session using the multi-head attention mechanism of the short-term interest generator; The projection submodule in the first determination module is used to project the short-term interest code and the target item set onto the hyperplane of the unsupervised agent using the distance generator, respectively, to obtain the target short-term interest code and the target item code; The first acquisition submodule in the first determining module is used to acquire the distance between the aggregate value of the general interest code and the target short-term interest code and the target item code using the distance generator; The determination submodule in the first determination module is used to determine the dissimilarity score between the input session and each target item in the target item set based on the distance, and to determine the target item with the smallest dissimilarity score in the target item set as the recommendation result of the input session; The third acquisition module is used to acquire the training set and the proxy embedding set; The input module is used to input the sessions in the training set into the encoder network during the training process to obtain a set of probability vectors; A conversion module is used to convert the probability vector into a skewed probability distribution using the normalized exponential function with a temperature coefficient. The second determining module is used to determine the unsupervised agent in the agent embedding set based on the mapping relationship between the skew probability distribution and the agent embedding set.
7. An electronic device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1 to 5.
8. A storage medium, characterized in that, It stores executable instructions for causing a processor to execute, thereby implementing the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Graph neural network travel package recommendation method based on multi-task self-encoding
CN115017405A