Sequence recommendation method, system, medium and device based on personalized contrastive loss

By combining the personalized contrastive loss function PCL with the deep learning model SASRec, the problem of compact feature space distribution in sequence recommendation is solved, achieving better feature representation and recommendation performance.

CN116049547BActive Publication Date: 2025-12-16XI AN JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310003947.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-03
Publication Date
2025-12-16
Estimated Expiration
2043-01-03

AI Technical Summary

Technical Problem

Existing contrastive loss functions in sequence recommendation result in an overly compact feature space distribution, impairing personalized feature expression and lacking absolute and uniform constraints.

Method used

We employ a personalized contrastive loss function (PCL) combined with binary cross-entropy and cross-entropy loss functions. The deep learning model SASRec is trained using user and item interaction records. Absolute constraints and uniformity regularization are introduced to improve upon the shortcomings of the contrastive loss function.

Benefits of technology

It significantly improves recommendation performance, enhances the uniformity of the feature space and the personalized feature representation, and improves recommendation accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116049547B_ABST
    Figure CN116049547B_ABST
Patent Text Reader

Abstract

The application discloses a sequence recommendation method and system based on personalized contrast loss, a medium and equipment, arranges the interaction record data of a user according to time sequence to form sequence interaction data of the user; the feature expression of the user and the item is obtained through a deep learning recommendation model SASRec by using the sequence interaction data of the user; the model is trained based on a personalized contrast loss function PCL by using the feature expression of the user and the item. By introducing the absolute constraint and uniformity regularization constraint of cross-entropy or binary cross-entropy loss, the problem that the contrast loss CL only has relative constraint and insufficient uniformity distribution constraint of the item is improved, and a sequence recommendation method PCL4SRec is formed, which significantly improves the performance of sequence recommendation.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of recommendation systems, and particularly relates to a sequence recommendation method, system, medium and equipment based on personalized contrastive loss. BACKGROUND

[0002] Sequence recommendation considers the time information in user interaction records or the order of user interaction, and can realize more accurate recommendation in combination with long-term and short-term preferences of users, and has become one of important research directions. Recently, sequence recommendation methods based on contrastive learning have also become a research hotspot. However, existing research methods are limited to the conventional process of contrastive learning framework in recommendation and adopt the way of multi-task learning. This chapter believes that the core of contrastive learning is contrastive loss (CL), which realizes better performance through more sample contrast. At the same time, the mainstream loss function in sequence recommendation is very limited, and binary cross entropy (BCE) and cross entropy (CE) are absolutely dominant, and BPR (Bayesian Personalized Ranking) is also used. Contrastive loss can be introduced and improved as a new loss function in the field of sequence recommendation. The existing method based on improved contrastive loss has obtained better recommendation results than the contrastive learning framework method in the Top-k recommendation field. Therefore, the introduction and improvement of contrastive loss (CL) to make it more suitable for sequence recommendation not only expand the original contrastive learning method, but also provide a new loss function and better performance, which has important significance.

[0003] Personalization is particularly important for sequence recommendation. The recommendation system values the expression of personalized features to achieve personalized recommendation and thousands of faces. Different users have different features, and the same user will also have changes in interests over time. In particular, sequence recommendation requires different positions or time representations of users in the sequence to be different and personalized. Therefore, personalized feature representation is the key to accurate recommendation. In more and more methods and models, the representation of users at different times is obtained by feature aggregation of items. The personalization of item latent vectors and the overall personalization expression ability of the model will directly affect the personalized representation of users at different times, so personalization is particularly important for sequence recommendation.

[0004] However, experiments show that contrastive loss is detrimental to personalized feature expression. As shown in Figure 3 , especially Figure 3(c) On the ML-1M dataset, the feature space distribution of the contrastive loss (CL) is too compact, causing the nodes to be too concentrated, which is not conducive to the expression of personalized features. Using variance to measure the smoothness of the feature of the graph node, it is found that the variance of the contrastive loss is less than half of the BCE loss (Beauty dataset) or 1 / 3

[0005] Specific analysis, this is caused by the two shortcomings of the contrastive loss:

[0006] (1) Intuitively, the closer the user is to the positive example, the better, and the farther the user is from the negative example, the better. This is a "relative" constraint, because it is only based on relative distance, without a certain distance or decision surface to provide an "absolute" constraint. Therefore, the contrastive loss has the problem of insufficient absolute constraint, resulting in poor feature distribution.

[0007] (2) Existing research shows that uniformity tends to preserve the feature distribution with the most information, that is, uniform distribution on a unit hypersphere. That is, a good distribution should be that all items are as evenly distributed as possible. But the contrastive loss only limits the distance between the user and the negative sample, making them more evenly distributed, so there is a problem of insufficient uniformity constraint.

[0008] Therefore, it is of great significance to analyze and improve the feature space distribution of the contrastive loss function in sequence recommendation, which is compact and detrimental to the expression of personalized features, to provide a new contrastive learning method and loss function for sequence recommendation and improve the performance of sequence recommendation. SUMMARY

[0009] The technical problem to be solved by the present application is to provide a sequence recommendation method, system, medium and equipment based on personalized contrastive loss to solve the technical problem of compact feature space distribution of the CL loss function in sequence recommendation and detrimental to the expression of personalized features.

[0010] The technical scheme adopted by the present application is as follows:

[0011] A sequence recommendation method based on personalized contrastive loss, the interactive record data of the user is arranged in chronological order to form user sequence interactive data; using the user sequence interactive data, the deep learning recommendation model SASRec is trained based on the PCL loss function to obtain the feature expression h u and v i of the user and the item; using the feature expression h u and v i of the user and the item, the most similar item is recommended to the user according to the similarity result of the user and each item to complete the recommendation task. ​

[0012] Specifically, the deep learning recommendation model SASRec is used as an encoder to obtain an initial H 0 After L-layer encoding, H L is obtained. u .

[0013] Specifically, the feature of the item sequence of the user interaction is S u ={v1, v2,..., v t}; the item latent vector and the position latent vector p i are used as inputs of the deep learning recommendation model SASRec together, and the feature expression v i of the item is specifically:

[0014]

[0015] wherein, is the initial feature expression of the user i.

[0016] Specifically, the personalized contrastive loss function L PCL is specifically:

[0017] L PCL = a * L CL + (1-a) * L BCE + l * L uniform

[0018] or

[0019] L PCL = a * L CL + (1-a) * L CE + l * L uniform

[0020] wherein, a and l are hyperparameters, L CL is a contrastive loss function, L BCE is binary cross-entropy, L CE is cross-entropy, and L uniform is a uniformity loss function.

[0021] Further, the contrastive loss function L CL is:

[0022]

[0023] wherein, sim(u, i) is a cosine similarity based on the feature expressions h u and v i of the user u and the item i, i + is a positive sample of the target user u, N is a training batch size, and I -A negative sample set is constituted by sampling a negative sample for each interaction of the user, and tau is a temperature coefficient.

[0024] Further, the binary cross-entropy L BCE is:

[0025]

[0026] The cross-entropy L CE is specifically:

[0027]

[0028] wherein, is a predicted value; y i is a true value in onehot form composed of 0 or 1, N is a training batch size, and sigma is a nonlinear activation function.

[0029] Further, the uniformity loss function L uniform is:

[0030]

[0031] wherein, v1 and v2 are any two in the positive sample set, v4 is any two in the negative sample set, f(·) is a feature converter, and E is an expectation.

[0032] In a second aspect, an embodiment of the present application provides a sequence recommendation system based on personalized contrast loss, comprising:

[0033] A data processing module arranges the interaction record data of the user in chronological order to form user sequence interaction data;

[0034] A learning module uses the user sequence interaction data obtained by the sorting module to train, based on a PCL loss function, through a deep learning recommendation model SASRec, to obtain feature expressions h u and v i of the user and the items.

[0035] A recommendation module uses the feature expressions h u and v i of the user and the items obtained by the learning module to recommend the most similar items to the user according to the similarity results of the user and each item, to complete the recommendation task.

[0036] In a third aspect, a computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the sequence recommendation method based on personalized contrast loss described above when executing the computer program.

[0037] In a fourth aspect, the embodiments of the present application provide a computer readable storage medium comprising a computer program, which, when executed by a processor, implements the steps of the sequence recommendation method based on the personalized contrastive loss described above.

[0038] Compared with the prior art, the present application has at least the following beneficial effects:

[0039] A sequence recommendation method based on personalized contrastive loss, first data processing obtains the user's historical interaction sequence, then through a common method such as SASRec model, the feature expression of the user at different time and the feature expression of the user are obtained, and the final model is obtained by training through the proposed PCL loss function and used for recommendation. This method can use any existing sequence recommendation model, use the proposed PCL loss to learn by means of the effect of the contrastive loss function, also compensate for the deficiency of the relative constraint of CL through the absolute constraint of CE or BCE, and through the uniformity constraint between positive samples and negative samples added by the uniform regularization, make the feature space distribution of the samples more uniform and reasonable, and keep the personalized features of the samples.

[0040] Further, the user's interaction record data is arranged in chronological order to complete data preprocessing, which facilitates the use of sequence recommendation, and the feature expression h u of the user is obtained through the deep learning recommendation model SASRec, and the potential feature expression of the user and the item based on the deep learning model is realized.

[0041] Further, the model is trained based on the personalized contrastive loss function PCL, which makes the model better constrained through the PCL loss, expands the distribution of samples in the feature space, and further maintains the personalized features, both takes advantage of the contrastive loss and compensates for its deficiency, and the personalized contrastive loss function L PCL Combines the contrastive loss, binary cross-entropy loss and uniformity regularization, and adds different weights to make them work together, which better optimizes the model in the training process.

[0042] Further, the contrastive loss function L CL Utilizes the advanced loss function in the current contrastive learning field, which has many advantages such as difficult sample mining, reducing popularity bias, and utilizing more negative samples for comparison.

[0043] Further, the binary cross-entropy or cross-entropy has a clear classification boundary constraint, which is an absolute constraint, which makes up for the deficiency of the relative constraint of the contrastive loss function.

[0044] Further, the uniformity loss function L uniform Provides uniform distribution constraint between any positive samples and negative samples, which makes up for the deficiency of the contrastive loss L CLOnly the distance between positive and negative samples is enlarged, and more samples are not made to tend to uniform distribution.

[0045] It can be understood that the beneficial effects of the second aspect to the fourth aspect can be referred to the related description in the first aspect, which will not be repeated here.

[0046] In summary, the personalized contrast loss function PCL and the recommendation method PCL4SRec formed by the contrast loss, the cross-entropy loss and the uniformity regularization significantly improve the recommendation performance.

[0047] The technical solutions of the present application will be further described in detail below with the help of the accompanying drawings and examples. BRIEF DESCRIPTION OF DRAWINGS

[0048] Figure 1 The method flowchart of the present application is shown in the figure.

[0049] Figure 2 The flowchart of the PCL4SRec method is shown in the figure, and the right side shows the improvement principle of PCL.

[0050] Figure 3 The visualization diagram of the personalized feature expression of PCL and BCE, CL loss functions is shown in the figure, where (a) is Beauty, (b) is Sports, and (c) is ML-1M.

[0051] Figure 4 The quantitative expression diagram of the personalized features of PCL in the training process is shown in the figure, where (a) is Beauty, (b) is Sports, and (c) is ML-1M.

[0052] Figure 5 The schematic diagram of the computer device provided by an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION

[0053] The technical solutions in the embodiments of the present application will be described clearly and completely below with the help of the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present application.

[0054] In the description of the present application, it should be understood that the terms “include” and “contain” indicate the existence of the described features, whole, steps, operations, elements and / or components, but do not exclude the existence or addition of one or more other features, whole, steps, operations, elements, components and / or sets thereof.

[0055] It should also be understood that the terms used in the specification and the following claims are for the purpose of describing particular embodiments and are not intended to be limiting, as the specific scope of the invention is disclosed in the appended claims. As used in this specification and the appended claims, the singular forms "a," "an" and "the" encompass plural referents unless the context clearly dictates otherwise.

[0056] It should also be further understood that the term "and / or" as used in the specification and in the claims, means and encompasses any and all possible combinations of one or more of the associated listed items and can be used interchangeably with the phrase "and / or". Additionally, the character " / " in the present invention generally represents a "or" relationship between the objects before and after it.

[0057] It should be understood that, although the terms first, second, third, etc. can be used herein to describe various ranges or elements, these ranges or elements should not be limited by these terms. These terms are only used to distinguish one range or element from another. For example, a first range could be termed a second range without departing from the scope of the embodiments.

[0058] The word "if" as used herein means "when" or "upon" or "in response to a determination" or "in response to a detection," depending on the context. Similarly, the phrase "if it is determined" or "if a detected (recited condition or event)" can be interpreted to mean "upon a determination" or "in response to a determination" or "when a detected (recited condition or event)" or "in response to a detected (recited condition or event)," depending on the context.

[0059] Various structural diagrams according to the disclosed embodiments of the present invention are shown in the accompanying drawings. These diagrams are not drawn to scale, in which certain details are shown in a somewhat exaggerated manner for the purpose of clarity and understanding, and certain details can be omitted. The shapes of various regions, layers, and their relative sizes and positional relationships shown in the drawings are merely exemplary, and in actuality can be deviated due to manufacturing tolerances or technical limitations, and regions / layers with different shapes, sizes, and relative positions can be additionally designed by those skilled in the art according to actual needs.

[0060] This invention provides a sequence recommendation method based on personalized contrastive loss. User interaction records are arranged chronologically to form user sequence interaction data. Using this user sequence interaction data, a deep learning recommendation model, SASRec, is used to obtain feature representations of users and items. The model is then trained using these feature representations based on the personalized contrastive loss function, PCL. By introducing absolute constraint binary cross-entropy (or cross-entropy) loss and uniformity regularization constraints, the problem of insufficient relative constraints and inadequate constraints on the uniform distribution of items (samples) in contrastive loss (CL) is improved, resulting in the sequence recommendation method PCL4SRec, which significantly enhances the performance of sequence recommendation.

[0061] Please see Figure 1 This invention discloses a sequence recommendation method based on personalized contrastive loss, comprising the following steps:

[0062] S1. Arrange the user's interaction record data in chronological order to form the user's sequence interaction data;

[0063] S2. Using the user sequence interaction data obtained in step S1, obtain the feature representations h of users and items through the deep learning recommendation model SASRec. u and v i ;

[0064] Features of User Interaction Sequences S u ={v1,v2,...,v t} as input to the deep learning recommendation model SASRec, v i These are the latent vector features of the item, where the latent vector P∈R t* This is used to represent the position of an item in the sequence. Therefore, by adding the item latent vector and the position latent vector together, the input of an item in the user sequence is represented as:

[0065]

[0066] The deep learning recommendation model SASRec serves as the encoder. The initial representation of the sequence, after passing through an L-layer Transformer encoder, yields the following new representation:

[0067] H L =Transformer(H 0 )

[0068] Last layer H L The representation of this is the user's final characteristic, namely This is the user representation at time t, which can be simplified as h. u .

[0069] S3, obtaining the feature expression h of the user and the item by using step S2 u and v i , based on the personalized contrast loss function L PCL , training the deep learning recommendation model SASRec according to the similarity results of the user and each item , recommending the most similar item to the user u, and completing the recommendation task.

[0070] S301, calculating the contrast loss function L CL ;

[0071] The cosine similarity sim(u, i) based on the feature expression h u , v i of the user u and the item i is specifically:

[0072]

[0073] The contrast loss function L CL is specifically:

[0074]

[0075] Wherein, sim(u, i) is the cosine similarity based on the feature expression h u , v i of the user u and the item i, G is the interaction graph composed of u and i; i + is the positive sample of the target user u, N is the training batch size, I - is a set of negative samples, each of which is sampled from the user's interaction.

[0076] Follow the sampling strategy used in contrast learning, that is, for the user u, in addition to the positive sample i + , the other N-1 negative samples at the same time are also regarded as the negative samples at this time.

[0077] S302, calculating binary cross entropy or cross entropy;

[0078] The binary cross entropy L BCE is specifically:

[0079]

[0080] The cross entropy L CE is specifically:

[0081]

[0082] Wherein, is the predicted value; y iThe truth value is in one-hot form consisting of 0s or 1s, and both binary cross-entropy and cross-entropy have clear classification boundaries. Here, L is used. BCE But L CE It can also be used.

[0083] S303. Calculate the uniformity loss function;

[0084] Uniformity loss function L uniform Specifically:

[0085]

[0086] Where v1 and v2 are any two positive samples, v3 and v4 are any two negative samples, and E is the expectation. Similarly, when the model has direct user latent vectors, uniformity constraints can also be applied to users.

[0087] S304. Calculate the personalized contrastive loss function PCL;

[0088] Personalized contrast loss function L PCL Specifically:

[0089] L PCL =α*L CL +(1-α)* BCE +* uniform

[0090] Or when using cross-entropy L CE At that time, the personalized contrastive loss function L PCL Specifically:

[0091] L PCL =α*L CL +(1-α)* BCE +* uniform

[0092] Here, α and λ are hyperparameters used to balance the contributions of different loss functions so that they work together.

[0093] S305. Based on the personalized contrast loss function L obtained in steps S301 to S304 PCL Training of SASRec is based on the user's final feature representation. and the characteristics of each item v i inner product Based on the similarity calculation, the most similar item is recommended to user u, thus completing the recommendation task.

[0094] The application provides a sequence recommendation system based on personalized contrast loss in one embodiment, which can be used to implement the sequence recommendation method based on personalized contrast loss.

[0095] The data processing module arranges the interactive record data of the user in chronological order to form user sequence interactive data.

[0096] The learning module trains the user sequence interactive data obtained by the sorting module through a deep learning recommendation model SASRec based on a PCL loss function to obtain feature expressions h u and v i of the user and the items.

[0097] The recommendation module uses the feature expressions h u and v i of the user and the items obtained by the learning module to recommend the most similar items to the user according to the similarity results of the user and the items, thereby completing the recommendation task.

[0098] In another embodiment of the application, a terminal device is provided, which includes a processor and a memory. The memory is used to store a computer program, and the computer program includes program instructions. The processor is used to execute the program instructions stored in the computer storage medium. The processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor is the computing core and control core of the terminal, and is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement a corresponding method flow or a corresponding function. The processor in the embodiments of the application can be used for the operation of the sequence recommendation method based on personalized contrast loss, including:

[0099] The data processing module arranges the interactive record data of the user in chronological order to form user sequence interactive data. The learning module trains the user sequence interactive data obtained by the sorting module through a deep learning recommendation model SASRec based on a PCL loss function to obtain feature expressions h u and v i; utilize the feature expression h u and v i , the deep learning recommendation model SASRec is trained based on the personalized contrast loss function, the most similar items are recommended to the user according to the similarity results of the user and each item, and the recommendation task is completed.

[0100] In another embodiment of the application, the application also provides a storage medium, specifically a computer readable storage medium (Memory), which is a memory device in a terminal device, used for storing programs and data. It can be understood that the computer readable storage medium herein can include a built-in storage medium in the terminal device, and of course can also include an expansion storage medium supported by the terminal device. The computer readable storage medium provides a storage space, which stores an operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer readable storage medium herein can be a high-speed RAM memory or a non-volatile memory such as at least one disk memory.

[0101] The one or more instructions stored in the computer readable storage medium can be loaded and executed by the processor to realize the corresponding steps of the sequence recommendation method based on the personalized contrast loss in the above-mentioned embodiments; the one or more instructions stored in the computer readable storage medium are loaded and executed by the processor to perform the following steps:

[0102] The user interaction record data is arranged in chronological order to form user sequence interaction data; the user sequence interaction data is used to train the deep learning recommendation model SASRec based on the PCL loss function, and the feature expression h u and v i of the user and the item is obtained; u and v i ; the deep learning recommendation model SASRec is trained based on the personalized contrast loss function, the most similar items are recommended to the user according to the similarity results of the user and each item, and the recommendation task is completed.

[0103] Please refer to Figure 5The computer device 60 of this embodiment comprises a processor 61, a memory 62, and a computer program 63 stored in the memory 62 and executable on the processor 61, which, when executed by the processor 61, implements the personalized contrastive loss based sequence recommendation method in the embodiments. For the sake of brevity, the details are not repeated here. Alternatively, the computer program 63, when executed by the processor 61, implements the functions of the models / units in the personalized contrastive loss based sequence recommendation system in the embodiments. For the sake of brevity, the details are not repeated here.

[0104] The computer device 60 can be a desktop computer, a notebook computer, a palm computer, a cloud server, or the like. The computer device 60 can include, but is not limited to, the processor 61 and the memory 62. Those skilled in the art can understand that the computer device 60 can include more or fewer components, or some components can be combined, or different components can be included, for example, the computer device can also include an input / output device, a network access device, a bus, and the like. Figure 5 The computer device 60 is merely an example and does not constitute a limitation on the computer device 60, and can include more or fewer components than shown, or combine certain components, or different components, for example, the computer device can also include an input / output device, a network access device, a bus, and the like.

[0105] The processor 61 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic components, discrete hardware components, or the like. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0106] The memory 62 can be an internal storage unit of the computer device 60, such as a hard disk or a memory of the computer device 60. The memory 62 can also be an external storage device of the computer device 60, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, or the like.

[0107] Further, the memory 62 can include both an internal storage unit and an external storage device of the computer device 60. The memory 62 is used to store computer programs and other programs and data required by the computer device. The memory 62 can also be used to temporarily store data that has been output or will be output.

[0108] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.

[0109] The method of the present application is widely tested on three different categories of goods "Beauty", "Sports and Outdoors" and "Toys and Games" in the Amazon review dataset, and the MovieLens1M movie rating dataset, which are abbreviated as Beauty, Sports, Toys and ML-1M respectively. The evaluation indicators are HR@5, HR@10, NDCG@5 and NDCG@10. The comparative methods include the most traditional method POP and deep learning-based methods such as GRU4Rec, NARM, SASRec, CoSeRec, LightSANs and DuoRe, etc. The deep learning-based methods adopt advanced technologies such as RNN, attention mechanism, Transformer, contrastive learning, etc.

[0110] Please refer to Figure 2 , the PCL4SRec proposed achieves the best performance on all datasets and indicators. As shown in the last two columns of Table 1, the improvement ratio relative to the baseline method SASRec is very obvious, with the lowest exceeding 20% and the highest nearly 96%. Relative to all other best results, the improvement ratio of the method in this chapter is mostly more than 10%, with the highest nearly 27%. The comparison results are shown in Table 1.

[0111] Table 1 Comparison of experimental results of methods

[0112]

[0113] Ablation analysis is performed in steps to verify the effectiveness of PCL relative to the traditional loss function BCE, and the results are shown in Table 2. The results show that the use of CL proposed in the present application is better than BCE, and the addition of BCE, Uniform based on CL proposed in the present application is effective, and PCL which comprehensively uses the above losses is the best.

[0114] Table 2 Ablation analysis

[0115]

[0116] The adaptability of PCL on different deep learning recommendation models is shown, and the results are shown in Table 3. NARM and GRU4Rec are commonly used basic sequence recommendation models, and LightSANs is an advanced model recently proposed. NARM is a user latent vector, which is complementary to the uniform distribution of the item feature in the paper. In addition, the cross-entropy loss CE and the PCL form based on CE are also considered. Neg.Sample refers to the number of negative samples, one represents one negative sample, and all represents all items as negative samples. Overall, PCL is optimal in various loss functions and different sampling quantities. The loss function based on all samples tends to achieve better results.

[0117] Table 3 Adaptability of PCL on different models

[0118]

[0119] Please refer to Figure 3 , which shows the significant improvement of the sample feature space distribution under PCL, which is beneficial to the expression of personalized features. The feature space of the contrast loss CL is the most compact, and the distance between nodes is the smallest. The main area of the feature space of BCE+CL is larger than that of the contrast loss, and the feature space of PCL is the largest, and the distribution between nodes is the most uniform among the four. Compared with BCE+CL, there is a significant expansion of the space, which shows the effectiveness of the regularization of Uniform. CL is a relative constraint and thus lacks absolute constraint, and CL only expands the distance between users and negative samples and thus lacks uniformity constraint on samples. The present application makes the distribution of samples in the feature space more uniform and reasonable by overcoming the two shortcomings.

[0120] Please refer to Figure 4 , which shows the quantitative expression of personalized features in the training process. Variance can represent the dispersion degree of the overall distribution, and can measure the individual distance and dispersion degree, that is, the degree of personalization. The variance of PCL is significantly increased compared with CL.

[0121] In summary, the sequence recommendation method, system, medium and equipment based on personalized contrast loss, by introducing absolute constraint BCE / CE and uniformity regularization, improves the problems of relative constraint of contrast loss CL and insufficient constraint on the uniformity of sample space, and forms a sequence recommendation method PCL4SRec, which significantly improves the performance of sequence recommendation and obtains leading results on multiple public datasets. The PCL loss function and recommendation method proposed by the present application are simple and effective, and have certain adaptability to different model methods.

[0122] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be realized in the form of hardware or software function unit. In addition, the specific name of each functional unit and module is only for the convenience of mutual distinction, and does not limit the protection scope of the present application. The specific working process of the unit and module in the above system can refer to the corresponding process in the foregoing method embodiment, which will not be described here.

[0123] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can be referred to the related description of other embodiments.

[0124] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the present application can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are executed in hardware or software mode depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of the present application.

[0125] In the embodiments provided by the present application, it should be understood that the disclosed apparatus / terminal and method can be implemented by other ways. For example, the above-mentioned apparatus / terminal embodiments are only schematic, and the division of the modules or units is only a logical function division, and there can be another division way in actual implementation, for example, 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 or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0126] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0127] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware, or in the form of a software functional unit.

[0128] The integrated module / unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on such understanding, the present application realizes all or part of the processes in the above-mentioned embodiment methods, and can also be completed by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can realize the steps of each method embodiment when executed by a processor. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate forms, etc. The computer-readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0129] The present application is described with reference to flowcharts and / or block diagrams according to the methods, devices (systems), and computer program products of the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one flow or multiple flows and / or blocks Figure 1 The device that implements the functions specified in one flow or multiple flows and / or blocks.

[0130] These computer program instructions can also be stored in a computer-readable storage medium, which can guide the computer or other programmable data processing devices to work in a specific manner, so that the instructions stored in the computer-readable storage medium produce a manufactured product including instruction devices, which implement the functions specified in the flowcharts and / or block diagrams.Figure 1 one or more processes and / or functions described in one or more blocks. Figure 1 one or more blocks or multiple blocks.

[0131] These computer program instructions can also be loaded into computer or other programmable data processing devices, so that a series of operational steps are performed on the computer or other programmable data processing devices to generate a computer-implemented process, so that the instructions executed on the computer or other programmable data processing devices provide steps for implementing the function described in one or more processes and / or functions described in one or more blocks. Figure 1 one or more processes and / or functions described in one or more blocks. Figure 1 one or more blocks or multiple blocks.

[0132] The above is only to illustrate the technical idea of the present application, and cannot limit the protection scope of the present application. Any modification made according to the technical idea of the present application on the basis of the technical scheme falls within the protection scope of the claims of the present application.

Claims

1. A sequence recommendation method based on personalized contrastive loss, characterized in that, User interaction records are arranged in chronological order to form user sequence interaction data. Using this user sequence interaction data, a deep learning recommendation model, SASRec, is developed based on a personalized contrastive loss function. Training is performed to obtain feature representations of users and items. and ; Using user and item characteristics to express and The deep learning recommendation model SASRec is trained based on a personalized contrast loss function. Based on the similarity results between the user and each item, the most similar item is recommended to the user to complete the recommendation task. Personalized contrastive loss function Specifically: or wherein, is a hyperparameter, is a contrastive loss function, is a binary cross-entropy, is a cross-entropy, is a uniformity loss function; Contrastive loss function is: wherein, is based on the user , features of the item , cosine similarity of the features, is a positive sample of the target user , is a training batch size, is a set of negative samples, each of which is sampled from each interaction of the user, is a temperature coefficient; Binary cross-entropy is: cross-entropy Specifically: wherein, is the predicted value; is the true value in onehot form consisting of 0 or 1, is the training batch size, is a non-linear activation function; Uniformity loss function is: wherein, , for any two of the positive sample set, for any two of the negative sample set, is a feature transformer, is an expectation. 2.The personalized contrastive loss based sequential recommendation method of claim 1, wherein, The deep learning recommendation model SASRec is used as an encoder to initially encode a user interaction sequence After layer encoder As the final feature of the user . 3.The personalized contrastive loss based sequential recommendation method of claim 1, wherein, Features of a sequence of items of user interaction are ; The item latent vector and the position latent vector are input together as a deep learning recommendation model SASRec, and the feature expression of the item is Specifically: ​ wherein, is the initialized feature representation for the user i .

4. A sequence recommendation system based on personalized contrastive loss, characterized in that, comprising: a data processing module, which arranges the user's interactive record data in chronological order to form user sequence interactive data; The learning module uses the user sequence interaction data obtained by the sorting module to train a deep learning recommendation model SASRec based on a PCL loss function to obtain feature expressions of the user and the item and ; personalized contrast loss function Specifically: or wherein, is a hyperparameter, is a contrastive loss function, is a binary cross-entropy, is a cross-entropy, is a uniformity loss function; Contrastive loss function is: wherein, is based on the user , the item characteristic expression , cosine similarity, is the positive sample of the target user , the training batch size , a negative sample is sampled for each interaction of the user to form a set of negative samples , and the temperature coefficient ; Binary cross-entropy is: cross-entropy Specifically: wherein, is a predicted value; is a true value in onehot form consisting of 0 or 1, is a training batch size, is a nonlinear activation function; Uniformity loss function is: wherein, , for any two of the positive sample set, for any two of the negative sample set, is a feature transformer, is an expectation; The recommendation module uses the learning module to obtain the feature expression of the user and the item and , and the personalized contrast loss function is used to train the deep learning recommendation model SASRec, the most similar item is recommended to the user according to the similarity result of the user and each item, and the recommendation task is completed. 5.The personalized contrastive loss based sequential recommendation system of claim 4, wherein, The deep learning recommendation model SASRec is used as an encoder to initially encode a user interaction sequence After layer encoder as the final feature of the user . 6.The personalized contrastive loss based sequential recommendation system of claim 4, wherein, Features of a sequence of items of user interaction are ; The item latent vector and the position latent vector are input together as a deep learning recommendation model SASRec, and the feature expression of the item is The item latent vector and the position latent vector are input together as a deep learning recommendation model SASRec, and the feature expression of the item is Specifically: wherein, is the initialized feature representation for the user i ​ 7. A computer-readable storage medium storing one or more programs, the one or more programs comprising instructions that when executed by a computer cause the computer to perform a method of any of claims 1-6. the one or more programs include instructions that when executed by a computing device, cause the computing device to perform the method of claim 1 or 2 or 3.

8. A computing device, comprising: comprising: one or more processors, memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing the steps in the method of claim 1 or 2 or 3.