A recommendation method and system based on unsupervised learning

The unsupervised learning-based recommendation method addresses the need for manual annotation and improves model performance by constructing sample pairs and calculating similarity scores, enhancing multi-layer feature representation and polysemy, and enabling offline embedding storage for faster recommendations.

CN113901289BActive Publication Date: 2025-01-03新华智云科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111171685.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-08
Publication Date
2025-01-03
Estimated Expiration
2041-10-08

AI Technical Summary

Technical Problem

Existing recommendation systems in industrial scenarios face challenges due to the need for large amounts of manual annotation resources and insufficient model performance, particularly with methods like word2vec and BERT, which struggle with polysemy and multi-layer feature representation, and are limited in high-concurrency situations.

Method used

A recommendation method using unsupervised learning that constructs positive and negative sample pairs through BERT model training, determines loss values, and calculates similarity scores without manual intervention, enabling offline embedding feature vector storage and improved model accuracy.

Benefits of technology

The method reduces the need for manual annotation, enhances the representation of words and improves the model's robustness and enhances the model's ability to handle multi-layer features and polysemy, while allowing for faster recommendations by enabling offline embedding storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113901289B_ABST
    Figure CN113901289B_ABST
Patent Text Reader

Abstract

The invention discloses a recommendation method and system based on unsupervised learning. The method comprises the following steps: obtaining first training data, inputting the first training data into a BERT model for the first time to obtain second training data, inputting the first training data into the BERT model for the second time to obtain third training data; the second training data and the third training data constitute a positive sample pair and a negative sample pair, the positive sample pair and the negative sample are input into a loss function to obtain a loss value; judging whether the loss value is within a preset threshold, if so, obtaining an accurate BERT model; obtaining user data, inputting the processed user data into the accurate BERT model, calculating the similarity score between the user data and the data to be recommended, and recommending users according to the similarity score. The beneficial effect is that the problem of multi-layer feature representation of words and polysemy of a word can be better solved, the resources required for manual annotation can be reduced, the problem of insufficient annotation resources can be well alleviated, and the recommendation speed can be greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of recommendation methods, and more specifically, the present invention relates to a recommendation method and system based on unsupervised learning. Background Art

[0002] In recommendation system projects, such as film and television recommendation, text similarity is usually used to recommend similar items. Text similarity is a relatively common recommendation algorithm. The application of text similarity in recommendation system projects can be summarized as calculating the similarity score of the introduction text, sorting by the similarity score, and making recommendations based on the sorting results. In recommendation projects in industrial scenarios, there is often a problem of no labeled data, and the performance of the recommendation algorithm also needs to be considered. The current technical solutions for recommendation projects in industrial scenarios have the following defects:

[0003] First, a method is to use a large-scale corpus to train the word vectors of the corpus text through word2vec. After the training is completed, the text is segmented and the word vector corresponding to each word is found. All word vectors of the text are pooled to generate sentence vectors of fixed dimensions, and the cosine similarity of two sentence vectors is calculated to measure the relevance between the texts.

[0004] One of the limitations of the word2vec method is that it cannot solve the problem of polysemy. Word2vec starts from the distribution hypothesis of word meaning, which means that the meaning of a word is given by the words that frequently appear in its context, and the dense vector representation of the training word. However, this vector is fixed in other text scenarios, and it is impossible to obtain different semantic vectors according to the context.

[0005] Another limitation of the word2vec method is that words do not have multi-layer features. Word2vec trains a single-layer classification network through a simple vector embedding representation matrix, fixing the word vector of a word. Therefore, compared with pre-trained models such as Bert, word2vec cannot reflect the complex characteristics of words, including syntax, semantics, etc.

[0006] Second, another solution is to use the Bert pre-trained model to jointly represent the two texts and perform downstream text similarity fine-tuning tasks. Use manual annotation resources to label the paired texts with similarity tags, concatenate the two paired texts with the [SEP] delimiter, input them into the Bert model, obtain the logits layer at the model output layer and calculate the sigmoid layer, and finally get the text similarity score.

[0007] One of the limitations of the BERT pre-trained model is that the joint representation of two texts input into the BERT model requires a lot of human annotation resources. Another limitation of the joint representation of two texts input into the BERT model is the insufficient model performance. When predicting the model, this method requires two texts as input at the same time. It is impossible to store the embedding representation of the text offline, so it is difficult to use in high-concurrency situations. Summary of the invention

[0008] The purpose of the present invention is to provide a recommendation method and system based on unsupervised learning to solve the technical problem that a large amount of manpower is required to label resources in the recommendation method in the above-mentioned prior art.

[0009] In order to achieve the above technical objectives, the technical solution adopted by the present invention is as follows:

[0010] A recommendation method based on unsupervised learning includes the following steps:

[0011] Obtain first training data, input the first training data into the BERT model for the first time, obtain second training data, input the first training data into the BERT model for the second time, obtain third training data;

[0012] The second training data and the third training data constitute a positive sample pair and a negative sample pair, and the positive sample pair and the negative sample are input into a loss function to obtain a loss value;

[0013] Determine whether the loss value is within the preset threshold. If not, repeat the operation to obtain the first training data, the first training data is input into the BERT model for the first time and the subsequent steps; if yes, obtain the accurate BERT model;

[0014] Obtain user data, input the processed user data into the precise BERT model, calculate the similarity score between the user data and the data to be recommended, and recommend users based on the similarity score.

[0015] Preferably, the first training data is input into the BERT model for the first time to obtain the second training data, and the first training data is input into the BERT model for the second time to obtain the third training data, which specifically includes the following steps:

[0016] Set the preset parameters of the dropout layer in the BERT model to non-zero, and set each output node to zero with the probability of the preset parameters;

[0017] The first training data is input into the BERT model for the first time to obtain second training data, and the first training data is input into the BERT model for the second time to obtain third training data, wherein the second training data and the third training data are different.

[0018] Preferably, the second training data and the third training data constitute a positive sample pair and a negative sample pair, which specifically includes the following steps:

[0019] The second training data and the third training data constitute a positive sample pair based on the same input data;

[0020] The second training data and the third training data constitute a negative sample pair based on different input data.

[0021] Preferably, obtaining user data and inputting the processed user data into the precise BERT model specifically comprises the following steps:

[0022] Enhancing the user data, wherein the enhancing method includes back-translation and word pair exchange;

[0023] Input the enhanced user data into the precise BERT model to obtain the user's embedding feature vector.

[0024] Preferably, the method further comprises the steps of:

[0025] The updated training data is obtained online at regular intervals, the updated training data is input into the precise BERT model, and the precise BERT model is further trained according to the updated training data.

[0026] Preferably, the second training data is an embedding feature vector, the third training data is an embedding feature vector, and both the second training data and the third training data are data to be recommended.

[0027] Preferably, the second training data, the third training data and the embedding feature vector of the user are all stored in a database.

[0028] Preferably, calculating the similarity score between the user data and the data to be recommended, and making recommendations to the user according to the similarity score specifically comprises the following steps:

[0029] Calculate the similarity score between the user data and the data to be recommended according to the cosine similarity algorithm;

[0030] Sorting is performed according to the similarity scores to obtain a similarity sorting list, and recommendations are made to users according to the similarity sorting list.

[0031] A recommendation system based on unsupervised learning, comprising:

[0032] A first training module is used to obtain first training data, the first training data is input into the BERT model for the first time to obtain second training data, and the first training data is input into the BERT model for the second time to obtain third training data;

[0033] The second training module is used for the second training data and the third training data to form a positive sample pair and a negative sample pair, and the positive sample pair and the negative sample are input into a loss function to obtain a loss value.

[0034] A judgment module is used to judge whether the loss value is within a preset threshold. If not, repeat the operation to obtain the first training data, the first training data is input into the BERT model for the first time and the subsequent steps; if so, obtain the accurate BERT model;

[0035] The recommendation module obtains user data, inputs the processed user data into the precise BERT model, calculates the similarity score between the user data and the data to be recommended, and recommends users based on the similarity score.

[0036] A computer-readable storage medium, characterized in that computer instructions are stored on the computer-readable storage medium, and the steps of the above-mentioned method are implemented when the computer instructions are executed by a processor.

[0037] The beneficial effects provided by the present invention are:

[0038] 1. The present invention obtains user data, inputs the processed user data into the precise BERT model, calculates the similarity score between the user data and the data to be recommended, recommends users according to the similarity score, and uses the precise BERT model for text representation in comparative learning, which can well solve the problems of multi-layer feature representation of words and polysemy of a word. The precise BERT model learns the features of different levels of different network layers during training. The high-level network layer reflects the features that depend on the context part, and the low-level network layer reflects the features that depend on the grammatical level. Therefore, compared with the text similarity method of word2vec, the precise BERT model trained in this application can better solve the problems of multi-layer feature representation of words and polysemy of a word.

[0039] 2. The present invention constructs positive sample pairs and negative sample pairs through the second training data and the third training data, and the positive sample pairs and negative samples are input into the loss function to obtain the loss value. No manual intervention is required in the process of constructing the positive sample pairs and negative sample pairs. Therefore, compared with the text similarity prediction method that uses text joint representation to input into the BERT model, it can reduce the resources required for manual annotation, and can well alleviate the problem of insufficient annotation resources.

[0040] 3. The present invention determines whether the loss value is within a preset threshold. If not, repeat the operation to obtain the first training data, the first training data is input into the BERT model for the first time and the subsequent steps; if yes, the accurate BERT model is obtained. Once the accurate BERT model training is completed, the embedding feature vector can be obtained offline using the existing model, which can greatly improve the recommendation speed compared to the text similarity prediction method of inputting the text joint representation into the BERT model. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0042] Figure 1 It is a flowchart of the recommendation method based on unsupervised learning. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0044] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] Embodiment 1:

[0046] like Figure 1 As shown, this embodiment includes a recommendation method based on unsupervised learning, including the following steps: obtaining first training data, inputting the first training data into the BERT model for the first time, obtaining second training data, inputting the first training data into the BERT model for the second time, obtaining third training data;

[0047] The second training data and the third training data constitute a positive sample pair and a negative sample pair, and the positive sample pair and the negative sample are input into the loss function to obtain the loss value; determine whether the loss value is within the preset threshold, if not, repeat the operation to obtain the first training data, the first training data is input into the BERT model for the first time and the subsequent steps; if yes, obtain the accurate BERT model;

[0048] Obtain user data, input the processed user data into the precise BERT model, calculate the similarity score between the user data and the data to be recommended, and recommend users based on the similarity score.

[0049] The first training data is input into the BERT model for the first time to obtain the second training data, and the first training data is input into the BERT model for the second time to obtain the third training data, which specifically includes the following steps: setting the preset parameters of the dropout layer in the BERT model not to 0, and setting each output node to 0 with the probability of the preset parameters; the first training data is input into the BERT model for the first time to obtain the second training data, and the first training data is input into the BERT model for the second time to obtain the third training data, wherein the second training data and the third training data are different.

[0050] Specifically, the preset parameter of the dropout layer in the BERT model is not set to 0, and the preset parameter is set to p. In this embodiment, the value of p is 0.1. Even if the data input each time is the same, each output node is set to 0 with a probability of p, so the result of each output is different. Therefore, the first training data is input into the BERT model twice to obtain the second training data and the third training data, but the second training data and the third training data are not the same.

[0051] The second training data and the third training data constitute a positive sample pair and a negative sample pair, which specifically includes the following steps: the second training data and the third training data constitute a positive sample pair based on the same input data; the second training data and the third training data constitute a negative sample pair based on different input data.

[0052] Specifically, the first training data includes at least data A and data B. The first training data is input into the BERT model for the first time to obtain the second training data. Data A and data B are input into the BERT model together for the first time to obtain data A1 and data B1. The first training data is input into the BERT model for the second time to obtain the third training data. Data A and data B are input into the BERT model together for the second time to obtain data A2 and data B2.

[0053] The two pairs of data, data a1 and data a2, data b1 and data b2, are respectively used as positive sample pairs; the four pairs of data, data a1 and data b1, data a1 and data b2, data a2 and data b1, data a2 and data b2, are respectively used as negative sample pairs.

[0054] Obtain user data and input the processed user data into the precise BERT model, which specifically includes the following steps: enhance the user data, including back translation and word pair exchange; input the enhanced user data into the precise BERT model to obtain the user's embedding feature vector. By enhancing user data, the amount of training data is increased, the generalization ability of the model is improved, and at the same time, noise data is added to improve the robustness of the model and solve the problem of insufficient or unbalanced data.

[0055] It also includes the following steps: regularly obtaining updated training data online, inputting the updated training data into the precise BERT model, and further training the precise BERT model based on the updated training data. It ensures that the precise BERT model can distinguish the currently updated training data and ensure the quality of the recommendation.

[0056] Calculating the similarity score between the user data and the data to be recommended, and recommending the user based on the similarity score specifically includes the following steps: calculating the similarity score between the user data and the data to be recommended based on the cosine similarity algorithm; sorting based on the similarity score to obtain a similarity sorted list, and recommending the user based on the similarity sorted list. Specifically, the cosine similarity algorithm evaluates the similarity score between the user's embedding feature vector and the data to be recommended by calculating the cosine value of the angle between them.

[0057] The second training data is an embedding feature vector, the third training data is an embedding feature vector, and both the second training data and the third training data are data to be recommended. The second training data, the third training data and the user's embedding feature vector are all stored in the database.

[0058] Embodiment 2:

[0059] This embodiment includes a recommendation system based on unsupervised learning, including:

[0060] The first training module is used to obtain the first training data, the first training data is input into the BERT model for the first time to obtain the second training data, and the first training data is input into the BERT model for the second time to obtain the third training data;

[0061] The second training module is used for the second training data and the third training data to form positive sample pairs and negative sample pairs. The positive sample pairs and negative samples are input into the loss function to obtain the loss value.

[0062] A judgment module is used to judge whether the loss value is within a preset threshold. If not, repeat the operation to obtain the first training data, input the first training data into the BERT model for the first time, and the subsequent steps; if so, obtain an accurate BERT model;

[0063] The recommendation module obtains user data, inputs the processed user data into the precise BERT model, calculates the similarity score between the user data and the data to be recommended, and recommends users based on the similarity score.

[0064] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of embodiment 1.

[0065] Embodiment 3:

[0066] A computer-readable storage medium stores computer instructions, which implement the steps of the method in Example 1 when executed by a processor.

[0067] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0068] The present invention is described with reference to the flowcharts and / or block diagrams of the method, terminal device (system), and computer program product according to the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0069] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0070] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable terminal device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0071] It should be noted that:

[0072] The "one embodiment" or "embodiment" mentioned in the specification means that the specific features, structures or characteristics described in conjunction with the embodiment are included in at least one embodiment of the present invention. Therefore, the phrases "one embodiment" or "embodiment" appearing in various places throughout the specification do not necessarily refer to the same embodiment.

[0073] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0074] In addition, it should be noted that the shapes and names of the parts and components of the specific embodiments described in this specification may be different. Any equivalent or simple changes made based on the structure, features and principles described in the patent concept of the present invention are included in the protection scope of the patent of the present invention. The technicians in the technical field of the present invention can make various modifications or supplements to the specific embodiments described or replace them in a similar manner, as long as they do not deviate from the structure of the present invention or exceed the scope defined by the claims, they should all fall within the protection scope of the present invention.

Claims

1. A recommendation method based on unsupervised learning, characterized in that: The following steps are involved: Obtaining first training data, inputting the first training data into the BERT model for the first time to obtain second training data, and inputting the first training data into the BERT model for the second time to obtain third training data, wherein the steps specifically include: setting a preset parameter of a dropout layer in the BERT model not to 0, and setting each output node to 0 with the probability of the preset parameter; inputting the first training data into the BERT model for the first time to obtain second training data, and inputting the first training data into the BERT model for the second time to obtain third training data, wherein the second training data and the third training data are different; The second training data and the third training data constitute a positive sample pair and a negative sample pair, and the positive sample pair and the negative sample pair are input into a loss function to obtain a loss value, wherein the second training data and the third training data constitute a positive sample pair and a negative sample pair, specifically including the following steps: the second training data and the third training data constitute a positive sample pair based on the same input data; the second training data and the third training data constitute a negative sample pair based on different input data; Determine whether the loss value is within the preset threshold. If not, repeat the operation to obtain the first training data, the first training data is input into the BERT model for the first time and the subsequent steps; if yes, obtain the accurate BERT model; Obtain user data, input the processed user data into the precise BERT model, calculate the similarity score between the user data and the data to be recommended, and recommend the user according to the similarity score, wherein obtaining user data and inputting the processed user data into the precise BERT model specifically includes the following steps: enhancing the user data, wherein the enhancement method includes back translation and word pair exchange; inputting the enhanced user data into the precise BERT model to obtain the user's embedding feature vector.

2. The recommendation method based on unsupervised learning as claimed in claim 1, characterized in that: Also includes the steps: The updated training data is obtained online at regular intervals, the updated training data is input into the precise BERT model, and the precise BERT model is further trained according to the updated training data.

3. The recommendation method based on unsupervised learning as claimed in claim 1, characterized in that: The second training data is an embedding feature vector, the third training data is an embedding feature vector, and both the second training data and the third training data are data to be recommended.

4. The recommendation method based on unsupervised learning as claimed in claim 1, characterized in that: The second training data, the third training data and the embedding feature vector of the user are all stored in a database.

5. The recommendation method based on unsupervised learning as claimed in claim 1, characterized in that: Calculating the similarity score between the user data and the data to be recommended, and recommending the user according to the similarity score specifically comprises the following steps: Calculate the similarity score between the user data and the data to be recommended according to the cosine similarity algorithm; Sorting is performed according to the similarity scores to obtain a similarity sorting list, and recommendations are made to users according to the similarity sorting list.

6. A recommendation system based on unsupervised learning, characterized in that: The recommendation system executes the recommendation method based on unsupervised learning according to any one of claims 1 to 5, comprising: A first training module is used to obtain first training data, the first training data is input into the BERT model for the first time to obtain second training data, and the first training data is input into the BERT model for the second time to obtain third training data; A second training module, used for the second training data and the third training data to form a positive sample pair and a negative sample pair, the positive sample pair and the negative sample pair are input into a loss function to obtain a loss value; A judgment module is used to judge whether the loss value is within a preset threshold. If not, repeat the operation to obtain the first training data, the first training data is input into the BERT model for the first time and the subsequent steps; if so, obtain the accurate BERT model; The recommendation module obtains user data, inputs the processed user data into the precise BERT model, calculates the similarity score between the user data and the data to be recommended, and recommends users based on the similarity score.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the steps of the recommendation method based on unsupervised learning as described in any one of claims 1 to 5 are implemented.