Disclosure of Invention
In view of the above, the present invention provides a method and a system for guiding active learning scoring based on matrix decomposition, so as to better predict preference information of a user and improve recommendation accuracy.
In order to achieve the above purpose, the invention provides the following technical scheme:
in one aspect, the invention provides an active learning scoring guidance method based on matrix decomposition, which comprises the following steps:
step A: respectively acquiring user characteristics of a new user, user characteristics of other users, project characteristics of unscored projects of the new user and project characteristics of scored projects of other users; the user characteristics of the new user, the user characteristics of the other users, the project characteristics of the unscored projects of the new user and the project characteristics of the scored projects of the other users are all obtained on the basis of factorization training of a user scoring matrix;
and B: obtaining similar users by calculating cosine similarity between the user characteristics of the new user and the user characteristics of the other users; the similar user is a user similar to the new user in the other users;
and C: acquiring an optimal project by adopting the popularity and the information content of the scored projects in the similar users, handing the optimal project to the new user, so as to score the optimal project by adopting the new user and acquire a scoring result; and the information content of the scored projects is obtained by calculating the cosine similarity of the project features of the unscored projects of the new user and the project features of the scored projects of the similar users.
Preferably, the method further comprises:
step D: and B, updating the user characteristics of the new user according to the grading result, and executing the step B until the cycle times reach preset times.
Preferably, before step a, the method further comprises:
and acquiring the user scoring matrix.
Preferably, the step C includes:
step C1: determining popularity of the similar user scored items;
step C2: calculating a product of the popularity and the information content;
step C3: judging whether the product of the acquired popularity and the information content is maximum or not, and if so, executing a step C4; if not, return to step C2;
step C4: and when the obtained product of the popularity and the information content is maximum, determining the similar user scored project as the optimal project.
In another aspect, the present invention further provides an active learning scoring guidance system based on matrix decomposition, including:
the first acquisition module is used for respectively acquiring the user characteristics of a new user, the user characteristics of other users, the project characteristics of unscored projects of the new user and the project characteristics of scored projects of other users; the user characteristics of the new user, the user characteristics of the other users, the project characteristics of the unscored projects of the new user and the project characteristics of the scored projects of the other users are all obtained on the basis of factorization training of a user scoring matrix;
a second obtaining module, configured to obtain similar users by calculating cosine similarities between the user characteristics of the new user and the user characteristics of the other users; the similar user is a user similar to the new user in the other users;
the third acquisition module is used for acquiring an optimal project by adopting the popularity and the information content of the scored projects in the similar users, handing the optimal project to the new user, so as to score the optimal project by adopting the new user and acquire a scoring result; and the information content of the scored projects is obtained by calculating the cosine similarity of the project features of the unscored projects of the new user and the project features of the scored projects of the similar users.
Preferably, the system further comprises:
and the updating module is used for updating the user characteristics of the new user according to the grading result, and returning to execute to obtain similar users by calculating the cosine similarity between the user characteristics of the new user and the user characteristics of other users until the cycle number reaches the preset number.
Preferably, the system further comprises:
and the acquisition module is used for acquiring the user scoring matrix.
Preferably, the third obtaining module includes:
the acquisition unit is used for determining the popularity of the similar user scored projects;
a calculation unit for calculating a product of the popularity and the information content;
the judging unit is used for judging whether the product of the acquired popularity and the information content is maximum or not, and if so, determining the similar user scored project as the optimal project; if not, returning to calculate the product of the popularity and the information content.
Compared with the prior art, the invention has the following advantages:
the invention provides an active learning scoring guidance method and system based on matrix decomposition, which respectively acquire user characteristics of a new user, user characteristics of other users, project characteristics of unscored projects of the new user and project characteristics of scored projects of other users through factorization of a user scoring matrix; further, similar users are obtained by calculating cosine similarity between the user characteristics of the new user and the user characteristics of the other users; acquiring an optimal project by adopting the popularity and the information content of the scored projects in the similar users, handing the optimal project to the new user, so as to score the optimal project by adopting the new user and acquire a scoring result; and the information content of the scored projects is obtained by calculating the cosine similarity of the project features of the unscored projects of the new user and the project features of the scored projects of the similar users. Compared with the prior art, the active learning scoring guidance method and system based on matrix decomposition are adopted, preference information of the user is well predicted, and recommendation accuracy is improved.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Some items in the active selection set are scored and some are not. In the active learning process, if the scored item is selected, the collaborative filtering recommendation model obtains a learning opportunity for the user, otherwise, the learning opportunity is wasted due to rejection of the user. The purpose of the active learning method proposed by the inventor is to enable the selected item to be most possibly answered by the new user and to fully utilize the scoring information given by the current user and the training user. Due to the fact that the number of interactions with the user is small, the number of scoring data for obtaining the active learning is small, only depending on a few scores provided by a new user, enough information cannot be obtained to find a proper query, and particularly when the number of items is large. Our solution is to combine new users with trained users to provide efficient queries using the information available to the trained users.
The active learning method provided by the invention is based on Pool-based active learning. To solve the problem of cold start of a user, actively selecting items to score a new user is of the Pool-based type. The Pool-based active learning generally comprises an unmarked sample Pool, in a collaborative filtering recommendation model, an unmarked sample Pool is formed by an unmarked item set which is not evaluated by a new user, in each iteration process, an active learning method selects an item with the highest information content according to a certain selection strategy to score the new user, then, scoring data given by the user is used for expressing the interest preference of the user, and finally, the collaborative filtering recommendation model capable of generating effective recommendation for the new user is established. As shown in fig. 1, a global collaborative filtering model is obtained by learning based on the existing user rating information in the collaborative filtering recommendation model, the interest preference of a new user is obtained by learning based on the initial rating given by the cold start user, and then the collaborative filtering recommendation model selects the item with the most information content from the unscored item set according to a certain item selection strategy and allows the user to score the item. And after the user gives the scoring information, adding the new score into the scored data set, and retraining the collaborative filtering recommendation model for the next item selection. And selecting other items as the user scores by the next iteration collaborative filtering recommendation model, wherein the termination condition is that the number of times of interaction with a new user reaches a certain standard. After the active learning scoring guidance process is completed, the collaborative filtering recommendation model can predict the preference information of the user according to the existing scoring information with high information content, and further generate a project recommendation list for a new user. In order to obtain scoring data with high information content with as few interactions as possible, the key problem is to select the most valuable items from a set of unscored items.
Referring to fig. 2, a flowchart of an active learning scoring guidance method based on matrix decomposition according to an embodiment of the present invention is shown, including:
step A: and respectively acquiring the user characteristics of the new user, the user characteristics of other users, the project characteristics of unscored projects of the new user and the project characteristics of scored projects of other users.
The user characteristics of the new user, the user characteristics of other users, the project characteristics of unscored projects of the new user and the project characteristics of scored projects of other users are obtained based on factorization training of a user scoring matrix.
Firstly, factorization training is carried out on a user scoring matrix S, and a user and a project are matched into a K-dimensional factorization feature spaceAnd obtaining factor feature spaces U and V corresponding to the user features and the project features. In the factor feature spaceIn (2), each item x uses a vectorAnd (4) showing. VxEach element in (a) represents how important the item possesses the corresponding factor. Some factors are of high importance and some are of low importance. Likewise, the vector U may also be used for a given user UuTo represent UuEach element in the set representing a factor characteristic corresponding to a user. User vector UuAnd item vector VxInner product U ofuVx TThe overall user preference for item features is reflected, so the available inner product can be used to estimate the predicted score for item x for user u, as follows:
wherein,the prediction for item x is scored for user u.
The key problem here is to calculate the corresponding match between each item and the user, and after each matching value is calculated, the user score can be predicted by the inner product of two factor features (user feature and item feature). The matrix factorization based approach is to decide whether to generate recommendations for the user based on the predicted score value.
In order to calculate the inner product of the two factor features, the factor feature spaces U and V need to be obtained by training with the existing scoring data S. The method for obtaining the values of the elements in U and V is as follows: elements in U and V are initialized randomly, and then synergy is calculated for all scoring data S ((U, x) epsilon S) in SFiltering the prediction error e of the recommendation modelu,x:
Wherein R isuxThe user u is given a true score for item x, typically 1-5.
Meanwhile, since the unknown score is predicted by using the existing score data, the over-fitting problem on S should be avoided. For example, in the collaborative filtering recommendation model, some users always like to score high, some items are popular, and a higher score can be obtained than other items, so as to avoid the over-fitting problem on the data, some penalty terms should be added to limit the values of the model parameters, and then the element values in the factor feature spaces U and V are obtained by minimizing the square sum of the global prediction errors. The global prediction error estimate after adding the bias factor is as follows:
where Opt (S, U, V) is the prediction error; and lambda is a deviation term coefficient.
It should be noted that the prediction error is generally small, such as 0.0001.
Next, a local optimal solution of the factor eigenspaces U and V is obtained by using a stochastic gradient descent method, and the corresponding partial derivatives are calculated as follows:
wherein, Vx,k、Uu,kThe factor features corresponding to the item x and the user u are the factor features respectively.
The training process of factorization is iterated on the scoring set S, and feature values in the factorial feature spaces U and V are continuously updated along the opposite direction of the gradient at a certain learning rate until the prediction error Opt (S, U, V) is reduced to a small value or is not changed any more, namely the collaborative filtering recommendation model parameters reach convergence, the learning rate is represented by α, and the penalty term coefficient is represented by λ, then the elements in U and V are updated as follows:
Uu,k←Uu,k-α(eu,xVx,k-λUu,k)
Vx,k←Vx,k-α(eu,xUu,k-λVx,k) (5)
for all scored data (U, x) e S, the entire U needs to be updateduAnd VxThe vector, i.e., the value of K, is K ∈ {1, 2.
And B: and calculating cosine similarity between the user characteristics of the new user and the user characteristics of other users to obtain similar users.
Wherein, the similar user is a user similar to the new user in other users.
When the matrix factorization training is completed, the user features and the item features are matched into corresponding factorization feature spaces U and V, and users or items with similar scoring behaviors are matched into the same region. According to the user characteristics of the new user in the factor characteristic space, a similar user set of the new user is found, then the optimal item is selected from the scored item sets of the similar users to query the user score, and therefore effective query can be obtained, and the scoring information of the similar users of the new user can be fully utilized. The method comprises the following steps that effective item query is selected, the search of similar neighbors of a new user is an important step, and if the calculation of the similar users is accurate, the simulation of the preference information of the new user according to the scoring behavior of the similar users is accurate. Of course, if the similar user selection is incorrect, the effectiveness of the selected item may be affected. It is known that in matrix factorization, the score prediction is calculated according to the inner product of the user features and the item features, so the cosine similarity is selected to calculate the similarity between users. The user factorial feature space U may be represented as:
for two users u in factor feature spaceiAnd ujThe corresponding feature vector can be expressed as:
ui=[ui1,ui2,…,uiK]
uj=[uj1,uj2,…,ujK](7)
then user uiAnd ujSimilarity sim (u) ofi,uj) The calculation is as follows:
and C: and acquiring an optimal project by adopting the popularity and the information content of the scored projects in the similar users, handing the optimal project to a new user, and scoring the optimal project by adopting the new user to acquire a scoring result.
And the information content of the scored projects is obtained by calculating the cosine similarity of the project features of the unscored projects of the new user and the project features of the scored projects of the similar users.
After obtaining the similar neighbor set of the new user, the selection of the project needs to be considered in terms of both the popularity and the information content of the project.
(1) Item popularity metrics
And selecting popular items from the similar user scored item sets to score the user. New users tend to evaluate a more popular project because many users with similar behavior to this user score this project, which is a basic starting point for collaborative filtering methods. The hot items are considered, so that effective query can be guaranteed, and grading information of similar users can be fully utilized.
For item x, the popularity pop (x) metric is simple, i.e. the number of users that have scored the current item, as follows:
in the formula, XuRepresent the set of unscored items for new user u, and c represent other users in the collaborative filtering recommendation model.
(2) Information content measurement
More user scoring data can be obtained by inquiring the evaluation of popular items for the user, but the collaborative filtering recommendation model is not greatly helped to obtain the personalized preference information of the user, so the information content of the selected items is considered, and the items with higher information content are selected from the unscored item set. From the rationale of collaborative filtering based on items, if a user is more interested in an item, we can speculate that the user will also like other items that are more similar to the item. Therefore, the similarity between the unscored items of the new user and the scored items of the similar user is considered, the possibility that the new user provides scores for the query items can be improved, and the user scores of the selected items can be guaranteed to have higher information content, namely the query items are preferred by the user.
Calculate the similarity between projects, we consider as follows:
after the matrix decomposition training is completed, similar items have similar factor features, so that the item features of the items are adopted to measure the similarity among the items. The item feature space V can be represented as:
for two items x in the factor space of the itemiAnd xjThe corresponding feature vector can be expressed as:
xi=[xi1,xi2,…,xiK]
xj=[xj1,xj2,…,xjK](11)
calculating each item x in the set of unscored items of the new useriSimilar user scored item set IuSimilarity sim (x) of middle itemi,Iu) As follows:
as can be seen from the similarity analysis among the measurement users, cosine similarity is a good criterion for calculating the similarity among the factor space features, so the item xiAnd xjSimilarity sim (x) ofi,xj) The calculation is similar to calculating the similarity of the user features.
By combining the two analysis points, when selecting a project from an unscored project set each time, the project with the largest product value of the popularity degree and the information content is considered as an optimal project and submitted to a new user for scoring. Since the popularity value is much larger than the similarity value, in the product of the two values, the popularity plays a dominant role, and to balance the influence of the two properties, we adopt logpop (x) to represent the popularity of the item, info (x)i,Iu) To represent the information content, the optimal item x*The selection criteria of (a) are as follows:
in the embodiment, the user characteristics of a new user, the user characteristics of other users, the project characteristics of unscored projects of the new user and the project characteristics of scored projects of other users are respectively obtained through factorization of a user scoring matrix; further, similar users are obtained by calculating cosine similarity between the user characteristics of the new user and the user characteristics of the other users; acquiring an optimal project by adopting the popularity and the information content of the scored projects in the similar users, handing the optimal project to the new user, so as to score the optimal project by adopting the new user and acquire a scoring result; and the information content of the scored projects is obtained by calculating the cosine similarity of the project features of the unscored projects of the new user and the project features of the scored projects of the similar users. Compared with the prior art, the method and the device have the advantages that the preference information of the user is better predicted, and the recommendation accuracy is further improved.
Referring to fig. 3, another flowchart of an active learning scoring guidance method based on matrix decomposition according to an embodiment of the present invention is shown, and on the basis of fig. 1, the method may further include the following steps:
step A1: and acquiring a user scoring matrix.
It should be noted that the process of obtaining the user scoring matrix in the embodiment of the present invention is the same as the existing method of obtaining the user scoring matrix, and therefore, the details are not repeated herein.
Step D: and D, updating the user characteristics of the user according to the grading result, and executing the step B until the cycle times reach the preset times.
When a new user enters the collaborative filtering recommendation model to give a project score, the prediction collaborative filtering recommendation model needs to be updated, and the user characteristics of the new user are learned. However, many users already exist in the collaborative filtering recommendation model, and it takes a long time to retrain the entire collaborative filtering recommendation model.
The time complexity of the retraining factorization collaborative filtering recommendation model is O (| S | × K × t), wherein t represents the iteration number, K represents the dimension of the factorization space, and | S | represents the size of the scored set. Taking Netflix dataset data as an example, K is 40, t is 120, and S is 100,000,000, 4800 hundred million feature updates are required for training to complete. Therefore, there is a need to optimize the process of retraining the entire collaborative filtering recommendation model.
The invention adopts an optimization method for on-line updating of a new user, wherein the on-line updating means that after initial training of all users, the subsequent updating is only trained for scores added by the new user, when the scores of the new user are obtained, the user characteristics of the user are initialized into a random set, then a collaborative filtering recommendation model is trained according to the scores provided by the new user, when the new user gives scores, the method only trains all the characteristics for the new user, and other characteristics in the matrix are kept unchangeduxThe collaborative filtering recommendation models obtained by training are almost the same. But if the user is a new user, when the score R is givenuxWhen added to the user score matrix, the user characteristics of the user may change significantly due to the score. Therefore, only the full features of the new user are trained while keeping the features of the other users in the matrix unchanged.
Analysis shows that the time complexity of the online updating method is | C (u, h) | × K × t, | C (u, h) | represents the evaluation score given by the new user. The new user online updating method can greatly improve the updating speed of the user characteristics because the number of the scored items of the new user is small.
After the user characteristics of a new user are trained by using an online updating method, the processes of similar neighbor searching, optimal item searching and the like are iterated until the preset query times are reached, and then the process is terminated.
Referring to fig. 4, a sub-flowchart of an active learning scoring guidance method based on matrix decomposition according to an embodiment of the present invention is shown, which may include the following steps:
step C1: the popularity of similar user scored items is determined.
Step C2: the product of popularity and information content is calculated.
Step C3: judging whether the product of the acquired popularity and the information content is maximum or not, and if so, executing a step C4; if not, return to step C2.
Step C4: and when the product of the acquired popularity and the information content is maximum, determining the similar user scored projects as the optimal projects.
Corresponding to the embodiment of the foregoing method, an embodiment of the present invention further provides a schematic structural diagram of an active learning scoring guidance system based on matrix decomposition, as shown in fig. 5, which may include: a first obtaining module 11, a second obtaining module 12 and a third obtaining module 13, wherein:
the first obtaining module 11 is configured to obtain a user characteristic of the new user, a user characteristic of another user, a project characteristic of an unscored project of the new user, and a project characteristic of a scored project of another user.
The user characteristics of the new user, the user characteristics of other users, the project characteristics of unscored projects of the new user and the project characteristics of scored projects of other users are obtained based on factorization training of a user scoring matrix.
The second obtaining module 12 is configured to obtain similar users by calculating cosine similarities between the user characteristics of the new user and the user characteristics of other users.
The similar user is a user similar to the new user in other users.
And the third obtaining module 13 is configured to obtain an optimal project by using the popularity and the information content of the scored projects in the similar users, deliver the optimal project to the new user, and score the optimal project by using the new user to obtain a scoring result.
And the information content of the scored items is obtained by calculating the cosine similarity of the item features of the unscored items of the new user and the item features of the scored items of the similar users.
Preferably, the third obtaining module 13 may include: an acquisition unit, a calculation unit and a judgment unit, wherein:
the acquisition unit is used for determining the popularity of the scored projects of the similar users;
a calculation unit for calculating a product of popularity and information content;
the judging unit is used for judging whether the product of the acquired popularity and the information content is maximum or not, and if so, determining the scored projects of the similar users as the optimal projects; if not, returning to execute the product of the popularity and the information content.
In the embodiment, the user characteristics of a new user, the user characteristics of other users, the project characteristics of unscored projects of the new user and the project characteristics of scored projects of other users are respectively obtained through factorization of a user scoring matrix; further, similar users are obtained by calculating cosine similarity between the user characteristics of the new user and the user characteristics of the other users; acquiring an optimal project by adopting the popularity and the information content of the scored projects in the similar users, handing the optimal project to the new user, so as to score the optimal project by adopting the new user and acquire a scoring result; and the information content of the scored projects is obtained by calculating the cosine similarity of the project features of the unscored projects of the new user and the project features of the scored projects of the similar users. Compared with the prior art, the method and the device have the advantages that the preference information of the user is better predicted, and the recommendation accuracy is further improved.
Referring to fig. 6, another structural diagram of an active learning scoring guidance system based on matrix decomposition according to an embodiment of the present invention is shown, and on the basis of fig. 5, the active learning scoring guidance system may further include: an acquisition module 10 and an update module 14, wherein:
and the updating module 14 is configured to update the user characteristics of the user according to the scoring result, and return to execute the operation of obtaining similar users by calculating cosine similarities between the user characteristics of the new user and the user characteristics of other users until the cycle number reaches a preset number.
It should be noted that the preset number of times is specifically the preset number of times of interaction with the new user.
And the obtaining module 10 is used for obtaining a user scoring matrix.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. The term "comprising", without further limitation, means that the element so defined is not excluded from the group consisting of additional identical elements in the process, method, article, or apparatus that comprises the element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.