Apparatus and method for user rating prediction based on adaptive latent feature analysis and optimization
By employing an adaptive latent feature analysis and optimization method for user rating prediction, and utilizing adaptive learning rate and genetic algorithm to optimize the latent feature matrices of users and items, this approach addresses the issues of low training efficiency and insufficient accuracy caused by fixed learning rates in existing recommendation algorithms, thereby achieving more efficient and accurate user rating prediction.
Patent Information
- Application Number
- CN202411529509.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2044-10-30
AI Technical Summary
In existing recommendation algorithms, a fixed learning rate is difficult to adapt to different stages of the training process, resulting in low model training efficiency, insufficient accuracy of user ratings, and the inability of stochastic gradient descent to guarantee the optimal solution, thus affecting the accuracy of recommendations.
A user rating prediction device and method based on adaptive latent feature analysis and optimization is adopted. By adjusting the learning rate through adaptive parameter adjustment and genetic algorithm, the latent feature matrices of users and items are optimized row by row, and an adaptive learning rate and objective function are constructed to gradually optimize the user rating prediction data.
It improves the efficiency and accuracy of recommendation models, enhances the accuracy of user rating predictions, and has broad applicability, applicable to other matrix optimization problems.
Smart Images

Figure CN119477061B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, in particular to a user score prediction device and method based on adaptive latent feature analysis and optimization. BACKGROUND
[0002] In the Internet era, with the rapid increase of information, users often have difficulty finding the content they are really interested in when facing a large amount of information. This information overload can lead to user fatigue and reduce user experience. Recommendation systems have emerged to alleviate the problem of information overload by analyzing users' historical ratings of some items to filter and recommend personalized content and products to users, making it easier for users to access valuable information.
[0003] Matrix decomposition and latent feature analysis are two core technologies of recommendation systems. These two technologies reveal the latent features of users and items through known user-item binary relationships and use this latent relationship to predict missing values in user-item binary relationships, thereby enabling personalized recommendations for different users.
[0004] Existing recommendation algorithms have been able to achieve the effect of recommendation, but due to the complexity of the algorithm, there are many parameters in the model that need to be adjusted, including the learning rate, which directly affects the training efficiency and final performance of the model. Although using a fixed learning rate is simple, a fixed learning rate often cannot adapt to different stages of the training process, making the algorithm unable to achieve ideal training results. Another problem is that when adjusting the feature matrix using the stochastic gradient descent method, due to the limitation of gradient information, it cannot guarantee that there is no better value in the neighborhood of the final solution, which will reduce the accuracy of user ratings and affect the accuracy of recommendations. SUMMARY
[0005] To solve the problem of low user rating accuracy in the prior art, the present application proposes a user score prediction device and method based on adaptive latent feature analysis and optimization.
[0006] To achieve the above purpose, the present application provides the following technical solutions:
[0007] The user score prediction device based on adaptive latent feature analysis and optimization specifically comprises a data receiving module 110, a data storage module 120, an adaptive parameter adjustment latent feature analysis module 130, and an output module 140.
[0008] The data receiving module 110 is configured to receive user rating history data of items.
[0009] The data storage module 120 is configured to store the rating history data sent by the data receiving module 110 and the user rating prediction data output by the output module 140.
[0010] The adaptive parameter adjustment hidden feature analysis module 130 is configured to adaptively learn and optimize the user hidden features and the item hidden features according to the rating history data, and output a first user hidden feature matrix and a first item hidden feature matrix.
[0011] The output module 140 is configured to optimize the first user hidden feature matrix and the first item hidden feature matrix to obtain a second user hidden feature matrix and a second item hidden feature matrix, and output the user rating prediction data.
[0012] Preferably, the data storage module 120 comprises a first storage unit 1201 and a second storage unit 1202; the first storage unit 1201 is configured to store the rating history data sent by the data receiving module 110; and the second storage unit 1202 is configured to store the first user hidden feature matrix and the first item hidden feature matrix output by the adaptive parameter adjustment hidden feature analysis module 130, and the user rating prediction data output by the output module 140.
[0013] Preferably, the adaptive parameter adjustment hidden feature analysis module 130 comprises a first initialization unit 1301, a first iteration unit 1302, a first optimization unit 1303, and a first iteration result output unit 1304.
[0014] The first initialization unit 1301 is configured to initialize the first process parameter.
[0015] The first iteration unit 1302 is configured to perform hidden feature analysis according to the rating history data and the first process parameter to obtain the first user hidden feature and the first item hidden feature.
[0016] The first optimization unit 1303 is configured to optimize and update the learning rate by using a genetic algorithm.
[0017] The first iteration result output unit 1304 is configured to output the first user hidden feature matrix and the first item hidden feature matrix.
[0018] Preferably, the output module 140 comprises a second initialization unit 1401, a second iteration unit 1402, and a second iteration result output unit 1403.
[0019] The second initialization unit 1401 is configured to initialize the second process parameter in the optimization process.
[0020] The second iteration unit 1402 is configured to use a genetic algorithm to perform row-by-row iterative optimization on the first user latent feature matrix and the first item latent feature matrix to obtain a second user latent feature matrix and a second item latent feature matrix.
[0021] The second iteration result output unit 1403 is configured to output user rating prediction data according to the second user latent feature matrix and the second item latent feature matrix.
[0022] The application further provides a user rating prediction method based on adaptive latent feature analysis and optimization, which specifically comprises the following steps:
[0023] S1: obtaining user rating history data and prediction instructions from a server;
[0024] S2: initializing first process parameters;
[0025] S3: constructing a first objective function according to the first process parameters and the rating history data, and outputting a first user latent feature matrix and a first item latent feature matrix;
[0026] S4: initializing second process parameters;
[0027] S5: constructing a second objective function according to the second process parameters, using a genetic algorithm to optimize the first user latent feature matrix and the first item latent feature matrix to obtain a second user latent feature matrix and a second item latent feature matrix, and outputting user rating prediction data.
[0028] Preferably, in S2, the first process parameters include a user latent feature matrix P, an item latent feature matrix Q, linear bias terms b and c, a genetic algorithm population size N, a genetic algorithm initial solution individual with respect to a learning rate, a probability r at which a genetic algorithm mutation operator is executed, a matrix update iteration control variable L, a maximum number of matrix update iterations L max , a regularization penalty term factor λ, and an iteration convergence termination threshold τ, and a learning rate η in a value range [η min , η max ].
[0029] Preferably, S3 comprises:
[0030] S3-1: constructing a first objective function ε according to a difference between real rating data and rating history data:
[0031]
[0032] In formula (1), P represents the first user latent feature matrix; Q represents the first item latent feature matrix; b and c represent linear bias terms; r u,i represents a rating matrix R Λthe value of the u-th row and the i-th column in the matrix P Λ R represents the known rating matrix P represents the predicted rating of the user u to the item i u,k q represents the value of the k-th dimension of the latent feature vector of the u-th user in the first user latent feature matrix P k,i b represents the value of the k-th dimension of the latent feature vector of the i-th item in the first item latent feature matrix Q u c represents the bias term corresponding to the vector of the user u u λ represents the regularization constant is part of the regularization term, which is used to limit the value of the feature matrix to prevent overfitting of the model, and represents the complexity of the user vector and the feature vector
[0033] S3-2: According to the first objective function ε, iteratively update the P and Q matrices to minimize the value of the objective function, and the training iteration formula is as follows:
[0034]
[0035] In formula (2), represents the updated value of the u-th row and the k-th column in the first user latent feature matrix P in the τ-th iteration represents the updated value of the u-th row and the k-th column in the first user latent feature matrix P in the (τ-1)-th iteration τ-1 η represents the learning rate obtained by S3-5 when updating the τ-th generation; λ represents the regularization penalty factor represents the difference between the real rating r u,i and the predicted value represents the updated value of the k-th row and the i-th column in the first item latent feature matrix Q in the τ-th generation represents the updated value of the k-th row and the i-th column in the first item latent feature matrix Q in the (τ-1)-th iteration represents the updated value of the bias term corresponding to the vector of the user u in the τ-th generation represents the updated value of the bias term corresponding to the vector of the item i in the τ-th generation
[0036] S3-3: Use genetic algorithm to find the learning rate η suitable for updating the matrix in the next round τ : Initialize the learning rate search population with a population size of N as the initial parent population P η {P1,…,P N}, where each particle represents a learning rate η; traverse the parent population, and each parent individual is taken as parent1, and any other parent individual is taken as parent2, and a new learning rate is generated as the child population Pηkid {kid1,…kid N},algorithm as follows:
[0037] Crossover operator: kid i = 0.8 * parent1 + 0.2 * parent2 (3)
[0038] Mutation operator: kid i = rand(η min ,η max ) if rand(0,1) < r (4)
[0039] In formula (3), (4), kid i represents the i-th child individual, parent1 represents the first parent individual, parent2 represents the second parent individual, rand(0,1) represents generating a random number in the range of (0,1); r represents the probability of executing the mutation operator;
[0040] If the random number is less than the probability r of executing the mutation operator, kid i is assigned to any value in the learning rate value range;
[0041]
[0042] In formula (5), F RMSE (η j ) represents the first objective function value corresponding to the parent individual and the child individual, that is, the mean square error of calculating the true value and the predicted value on the verification set Ω; |Ω| represents the total number of samples contained in the verification set Ω;
[0043] S3-4: According to the updated learning rate, the first objective function is iteratively optimized, and it is judged whether the iteration control variable L has reached the upper limit L max ; if yes, terminate the iteration, if not, continue the iteration;
[0044] S3-5: It is judged whether the iteration process of the first objective function converges, if yes, terminate the iteration, if not, continue the iteration;
[0045] S3-6: After the iteration of the first objective function is terminated, the first user implicit feature matrix P and the first item implicit feature matrix Q obtained when the first objective function reaches the minimum value are output.
[0046] Preferably, in the S4, the second process parameters include: the first user implicit feature matrix P, the first item implicit feature matrix Q, the genetic algorithm population size N, the disturbance amplitude β for generating new vector individuals based on the optimized vector, the initial solution individual generated when optimizing each row vector, the probability r of executing the genetic algorithm mutation operator, the matrix update iteration control variable L, the maximum value of the matrix update iteration number L max , the single vector update iteration control variable T, the maximum value of the single vector update iteration number T max , the regularization penalty term factor λ, and the iteration convergence termination threshold τ.
[0047] Preferably, the S5 includes:
[0048] S5-1: constructing a corresponding second objective function according to the second process parameters and the first user implicit feature matrix P and the first item implicit feature matrix Q or
[0049]
[0050] In formula (6), P represents the first user implicit feature matrix; Q represents the first item implicit feature matrix; b and c represent linear bias terms; R Λ represents a known rating matrix; r u,i represents the known rating matrix R Λ u, i represents the value of the u-th row and the i-th column in the known rating matrix R, i.e., the rating of the user u to the item i; p u,k represents the value of the u-th row and the k-th column in the first user implicit feature matrix P; q k,i represents the value of the k-th row and the i-th column in the first item implicit feature matrix Q;
[0051] represents the predicted rating of the user u to the item i b u represents the bias term corresponding to the vector of the user u, c u represents the bias term corresponding to the vector of the item i; λ represents a regularization constant for preventing overfitting in the training process;
[0052] S5-2: using a genetic algorithm to optimize the first user implicit feature matrix P and the first item implicit feature matrix Q row by row, respectively:
[0053] First, optimize the first user implicit feature matrix P, and then optimize the first item implicit feature matrix Q; traverse and optimize the feature matrix row by row, and randomly disturb the traversed row vector to generate N new vectors as the parent population P vector {P1,…,P N} for searching better row vector; calculate the fitness value of each parent individual according to formula (6), and record the individual with the minimum fitness value as gbest;
[0054] Then select the gbest individual as parent1 and any other parent individual as parent2 to generate the offspring population P vctorkid {kid1,…,kid N};
[0055] Crossover operator: kid i = 0.8*parent1 + 0.2*parent2 (7)
[0056] Mutation operator: kid i,e = rand(a,d) if rand(0,1) < r (8)
[0057] In formula (7) and (8), kid i represents the ith offspring individual, parent1 represents the first parent individual, parent2 represents the second parent individual, rand(a,d) represents any value in the range of (a,d); r represents the probability of executing the mutation operator; e represents the e-th dimension of the kid i vector; rand(0,1) represents generating a random number in the range of (0,1); if the random number is less than the probability r of executing the mutation operator, the e-th dimension of the kid i vector is assigned any value in the range of the vector value;
[0058] Calculate the second objective function values corresponding to the parent individuals and offspring individuals according to formula (6), arrange the second objective function values from small to large, and select the individuals corresponding to the first M second objective function values as the parent individuals of the next generation of genetic algorithm. Finally, select the optimal vector individual after the iteration of the genetic algorithm ends to replace the original vector;
[0059] S5-3: When the iteration of the second objective function terminates, the second user implicit feature matrix P * and the second item implicit feature matrix Q * are obtained by optimization when the second objective function reaches the minimum value, and the user rating prediction data is calculated:
[0060]
[0061] Formula (7), F prediction represents the rating prediction data of the user u to the item i; f represents the dimension of the implicit feature space; represents the value of the u-th row and the k-th column in the second user implicit feature matrix P * ; and Q represents a second item implicit feature matrix * the value of the kth row and ith column.
[0062] In summary, due to the adoption of the above technical solutions, compared with the prior art, the present application has at least the following beneficial effects:
[0063] The adaptive adjustment of the learning rate and the further optimization of the feature matrix in the present patent make the recommendation model more efficient and accurate, improve the accuracy of user rating prediction, and have strong universality and can be applied to other matrix optimization objects. BRIEF DESCRIPTION OF DRAWINGS
[0064] Figure 1 A schematic diagram of a user rating prediction device based on adaptive implicit feature analysis and optimization according to an exemplary embodiment of the present application.
[0065] Figure 2 A structural schematic diagram of a data storage module according to an exemplary embodiment of the present application.
[0066] Figure 3 A structural schematic diagram of an adaptive parameter adjustment implicit feature analysis module according to an exemplary embodiment of the present application.
[0067] Figure 4 A structural schematic diagram of an output module according to an exemplary embodiment of the present application.
[0068] Figure 5 A schematic diagram of a user rating prediction method based on adaptive implicit feature analysis and optimization according to an exemplary embodiment of the present application.
[0069] Figure 6 A comparison schematic diagram of user rating prediction accuracy according to an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0070] The present application will be further described in detail below in conjunction with embodiments and specific implementation manners. However, it should not be understood as limiting the scope of the above-mentioned subject matter of the present application to the following embodiments only, and any technology realized based on the content of the present application falls within the scope of the present application.
[0071] In the description of the present application, it should be understood that the terms "longitudinal", "transverse", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the purpose of facilitating the description of the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as limiting the present application.
[0072] AsFigure 1 As shown in the figure, the present application provides a user score prediction device based on adaptive hidden feature analysis and optimization, which specifically comprises a data receiving module 110, a data storage module 120, an adaptive parameter adjustment hidden feature analysis module 130 and an output module 140; the output end of the data receiving module 110 is connected with the first input end of the data storage module 120, the output end of the data storage module 120 is connected with the input end of the adaptive parameter adjustment hidden feature analysis module 130, the output end of the adaptive parameter adjustment hidden feature analysis module 130 is connected with the input end of the output module 140, and the output end of the output module 140 is connected with the second input end of the data storage module 120.
[0073] In this embodiment, the data receiving module 110 is used for receiving the score history data of the user on the project and transmitting the score data to the data storage module 120 for storage.
[0074] In this embodiment, the data storage module 120 is used for storing the score history data sent by the data receiving module 110 and the user score prediction data output by the output module 140.
[0075] As shown in the figure, the data storage module 120 comprises a first storage unit 1201 and a second storage unit 1202; the first storage unit 1201 is used for storing the score history data sent by the data receiving module 110; and the second storage unit 1202 is used for storing the first user hidden feature matrix, the first project hidden feature matrix output by the adaptive parameter adjustment hidden feature analysis module 130 and the user score prediction data output by the output module 140. Figure 2
[0076] In this embodiment, the adaptive parameter adjustment hidden feature analysis module 130 is used for adaptively learning and optimizing the user hidden feature and the hidden feature of the project according to the score history data, and outputting the first user hidden feature matrix and the first project hidden feature matrix.
[0077] As shown in the figure, the adaptive parameter adjustment hidden feature analysis module 130 comprises a first initialization unit 1301, a first iteration unit 1302, a first optimization unit 1303 and a first iteration result output unit 1304. Figure 3 The first initialization unit 1301 is used for initializing the first process parameter.
[0078] The first iteration unit 1302 is used for obtaining the first user hidden feature and the first project hidden feature by hidden feature analysis according to the score history data and the first process parameter.
[0079] The first optimization unit 1303 is used for optimizing and updating the learning rate.
[0080]
[0081] The first iteration result output unit 1304 is configured to output the first user latent feature matrix and the first item latent feature matrix.
[0082] In this embodiment, the output module 140 is configured to optimize the first user latent feature matrix and the first item latent feature matrix, and output user score prediction data.
[0083] As shown in Figure 4 the output module 140 includes a second initialization unit 1401, a second iteration unit 1402, and a second iteration result output unit 1403.
[0084] The second initialization unit 1401 is configured to initialize the second process parameter in the optimization process.
[0085] The second iteration unit 1402 is configured to perform row-by-row iterative optimization on the first user latent feature matrix and the first item latent feature matrix to obtain a second user latent feature matrix and a second item latent feature matrix.
[0086] The second iteration result output unit 1403 is configured to output user score prediction data according to the second user latent feature matrix and the second item latent feature matrix.
[0087] As shown in Figure 5 based on the above-mentioned user score prediction device based on adaptive latent feature analysis and optimization, the present application further provides a user score prediction method based on adaptive latent feature analysis and optimization, which specifically includes the following steps:
[0088] S1: Obtain user score history data and prediction instructions from a server.
[0089] In this embodiment, the server can send instructions to the device in the following ways: periodically, or according to the notification of the device, or according to the notification of a certain server, and send instructions to the device to extract latent features from known score data.
[0090] S2: Initialize the first process parameter.
[0091] In this embodiment, the first process parameter includes: a user latent feature matrix P, an item latent feature matrix Q (each row of P and Q respectively represents the characteristics of a user u and an item i, and the spatial dimension of each row is f), a linear bias term b and c, a genetic algorithm population size N, a probability r of executing a genetic algorithm mutation operator, a matrix update iteration control variable L, a maximum number of matrix update iterations L max , a regularization penalty term factor λ, and an iteration convergence termination threshold τ.
[0092] Among them:
[0093] The hidden feature space dimension f is a fixed integer of the dimension of the output hidden feature, and the initial value is a positive integer, such as 10 or 20.
[0094] The user hidden feature matrix P is an M-row and f-column matrix established according to the number M of users in the rating matrix R and f, and each row represents a user f-dimensional feature vector, wherein each element parameter is initialized as a random number in the open interval (0, 0.05).
[0095] The item hidden feature matrix Q is a V-row and f-column matrix established according to the number V of items in the rating matrix R and f, and each row represents an item f-dimensional feature vector, wherein each element parameter is initialized as a random number in the open interval (0, 0.05).
[0096] The linear bias term b is an M-dimensional vector established according to the number M of users in the rating matrix R, and each element parameter is initialized as a random number in the open interval (0, 0.05).
[0097] The linear bias term c is a V-dimensional vector established according to the number V of items in the rating matrix R, and each element parameter is initialized as a random number in the open interval (0, 0.05).
[0098] The genetic algorithm population size N is the number of particles participating in the genetic algorithm search solution space, and the parameter is initialized as a fixed integer, such as 10.
[0099] The probability r of executing the genetic algorithm mutation operator is initialized as a decimal less than 1, generally less than or equal to 0.1.
[0100] The parameter initialization iteration control variable L is a variable for controlling the extraction iteration process, and is initialized as 1.
[0101] The upper limit L of iteration max is a variable for controlling the upper limit of the number of iterations in the extraction iteration process, and is initialized as a positive integer, such as 100.
[0102] The regularization penalty term factor λ is a constant for controlling the regularization effect of the regularization term corresponding to the elements of P and Q in the extraction iteration process, and is initialized as a positive number less than 0.1, such as 0.03.
[0103] The iteration convergence termination threshold τ is a threshold parameter for judging whether the extraction iteration process has converged, and is initialized as a very small positive number, such as 0.004.
[0104] S3: According to the first process parameter and the rating history data, a first loss function ε is constructed, and a first rating prediction data is output.
[0105] S3-1: According to the difference between the true rating data and the rating history data, a first objective function ε is constructed:
[0106]
[0107] In machine learning, training data often comes with some noise data. In order to improve the generalization ability of the model, Tikhonov regularization is usually used to avoid overfitting the training data. In addition, in order to prevent the influence of user preferences and the characteristics of items on the prediction, a bias term is introduced to further improve the accuracy of the score prediction, and the objective function is improved as follows:
[0108]
[0109] In formulas (1) and (2), P represents the first user implicit feature matrix; Q represents the first item implicit feature matrix; b and c represent linear bias terms; r u,i represents the value of the u-th row and the i-th column in the known score matrix R Λ . represents the predicted score of user u to item i, and its value is p u ·q i T ; p u,k represents the value of the u-th row and the k-th column in the user implicit feature matrix P; q k,i represents the value of the k-th row and the i-th column in the item implicit feature matrix Q; b u represents the bias term corresponding to the vector of user u; c i represents the bias term corresponding to the vector of item i; λ represents the regularization penalty factor; is part of the regularization term, which is used to limit the value of the feature matrix to prevent overfitting of the model, and represents the complexity of the user vector and the feature vector; R Λ represents the known score matrix.
[0110] In this embodiment, the regularization penalty factor λ is used to constrain the optimization process; the linear bias terms b and c are added to help the model adjust the prediction to reflect the specific characteristics of individual users and items.
[0111] S3-2: The device calculates the objective function value corresponding to the learning rate individual initialized by genetic algorithm, selects the optimal result corresponding to the learning rate, and adjusts the implicit feature matrix by combining gradient descent method to minimize the value of ε corresponding to it, and the training iteration formula is as follows:
[0112]
[0113] In formula (3), represents the updated value of the u-th row and the k-th column in the user implicit feature matrix P in the τ-th iteration; Pukτ-1denotes the updated value of the u-th row and the k-th column in the implicit feature matrix P in the τ-1-th iteration; η τ-1 λ denotes the regularization penalty factor; η r denotes the real rating u,i and the predicted value of difference; Qkiτdenotes the updated value of the k-th row and the i-th column in the implicit feature matrix Q in the τ-th iteration; Qkiτ-1denotes the updated value of the k-th row and the i-th column in the implicit feature matrix Q in the τ-1-th iteration; biτdenotes the updated value of the bias item corresponding to the vector of the user u in the τ-th iteration; biτdenotes the updated value of the bias item corresponding to the vector of the item i in the τ-th iteration.
[0114] S3-3: Using genetic algorithm to find the learning rate η suitable for the next round of updating matrix τ : initialize the learning rate search population with the size of N as the initial parent population P η {P1,…,P N}, where each particle represents a learning rate η. The individual traverses each parent individual as parent1, and selects any other parent individual as parent2, and generates a new learning rate as the child population P ηkid {kid1,…kid N} according to the learning rate information in the parent population. The algorithm is as follows:
[0115] Crossover operator: kid i = 0.8 * parent1 + 0.2 * parent2 (4)
[0116] Mutation operator: kid i = rand(η min ,η max ) if rand0,1)<r (5)
[0117] In formula (4), (5), kid i denotes the i-th child individual, parent1 denotes the first parent individual, parent2 denotes the second parent individual, rand(0,1) denotes a random number generated in the range of (0,1); r denotes the probability of executing the mutation operator; η min denotes the lower bound of the learning rate empirical value; η max denotes the upper bound of the learning rate empirical value.
[0118] If the random number is less than the probability r of executing the mutation operator, kid iThe assignment is any value in the learning rate value range, so as to increase the diversity of the search population and prevent the search for the learning rate from falling into a local optimal solution.
[0119]
[0120] In formula (6), F RMSE (η j ) represents the first objective function value corresponding to the parent individual and the child individual, that is, the mean square error of the true value and the predicted value calculated on the verification set Ω; |Ω| represents the total number of samples contained in the verification set Ω; the smaller the objective function value is, the smaller the prediction error is, and the better the prediction effect is.
[0121] The individual with the smallest first objective function value is selected as the learning rate η of the updated P and Q matrices in this round, and the first objective function values are arranged from small to large, and the individuals corresponding to the first N objective function values are selected as the parent individuals of the next generation of genetic algorithm to continue searching for the optimal learning rate of the updated feature matrix in the next round;
[0122] S3-4: Iteratively optimize the first objective function according to the updated learning rate, and determine whether the iteration control variable L has reached the upper limit L max .
[0123] In this step, the device first adds 1 to the extracted iteration control variable L, and then determines whether the extracted iteration control variable L is greater than the extracted iteration upper limit L max ; if yes, the iteration is stopped, and if no, the iteration is continued until the iteration control variable L reaches the upper limit L max .
[0124] S3-5: Determine whether the iteration process of the first objective function ε is convergent, if yes, terminate the iteration, and if no, continue the iteration.
[0125] In this step, the iteration termination condition is: whether the difference between the prediction errors of the adjacent two iterations before the current iteration is started is less than the convergence determination threshold τ; if yes, it is determined that the iteration has converged and the iteration is terminated; if no, it is determined that the iteration has not converged, and the iteration is continued.
[0126] S3-6: When the iteration of the first objective function is stopped, the first user implicit feature matrix P, the first item implicit feature matrix Q, and the corresponding first user implicit feature matrix bias vector b and the first item implicit feature matrix bias vector c are trained when the first objective function reaches the minimum value.
[0127] S4: Initialize the second process parameters.
[0128] The second process parameters include: the first user implicit feature matrix P, the first item implicit feature matrix Q, the genetic algorithm population size N, the genetic algorithm disturbance amplitude β for generating new vector individuals based on the optimized vector, the probability r of executing the genetic algorithm mutation operator, the matrix update iteration control variable L, the maximum value of the matrix update iteration number L max , the single vector update iteration control variable T, and the maximum value of the single vector update iteration number T max , the regularization penalty term factor λ, and the iteration convergence termination threshold τ.
[0129] Wherein:
[0130] The first user implicit feature matrix P and the first item implicit feature matrix Q are obtained from the adaptive parameter adjustment implicit feature analysis module.
[0131] The genetic algorithm disturbance amplitude β for generating new vector individuals based on the optimized vector should not be too large, otherwise the search solution space will be too large, affecting the algorithm efficiency, and generally takes a small number less than 0.1, such as 0.04.
[0132] The single vector update iteration control variable T is a variable for controlling the vector optimization process, and the initial value is 1.
[0133] T max is a variable for controlling the upper limit of the iteration number in the optimization iteration process, and the parameter is initialized as a positive integer, such as 100.
[0134] The remaining variables all adopt the values of the first process parameters.
[0135] S5: Construct a second target function according to the second process parameters and the first rating prediction data, and optimize the first rating prediction data to output second rating prediction data.
[0136] S5-1: According to the second process parameters and the first user implicit feature matrix P and the first item implicit feature matrix Q, the corresponding second loss function or the third loss function
[0137]
[0138] In formulas (7) and (8), P represents the first user implicit feature matrix; Q represents the first item implicit feature matrix; b and c represent linear bias terms; R Λ represents the known rating matrix; r u,i represents the value of the u-th row and the i-th column in the known rating matrix R Λ , i.e. the known rating of user u to item i; p u,k represents the value of the u-th row and the k-th column in the first user implicit feature matrix P; and q k,irepresents the value of the kth row and ith column in the first item latent feature matrix Q; represents the predicted rating of user u to item i b u represents the bias term corresponding to the vector of user u, c i represents the bias term corresponding to the vector of item i; λ represents a regularization constant to prevent overfitting during the training process;
[0139] S5-2: Use the genetic algorithm to optimize the first user latent feature matrix P and the first item latent feature matrix Q row by row respectively:
[0140] First, optimize the first user latent feature matrix P and then optimize the first item latent feature matrix Q. The feature matrix is optimized row by row, and N new vectors are generated by random disturbance within a certain range for the row vector traversed to serve as the parent population P vector {P1,…,P N} for searching for better row vectors.
[0141] The initial population P vector {P1,…,P N} generated by the genetic algorithm when optimizing each row vector is based on the vector being optimized h u , h i (h u , h i consisting of the user and item vectors being optimized and their corresponding bias terms), u represents the user number, i represents the item number, and the user vector h u is optimized as an example:
[0142]
[0143] In formula (9), P i represents the ith initial solution individual; U represents a uniformly distributed random number generation function, and indicates that the initial vector particle is disturbed based on h u , and takes a random value within the disturbance range; N represents the population size of the genetic algorithm.
[0144] According to formula (7) or (8) (formula (7) is used for optimizing the user feature matrix, and formula (8) is used for optimizing the item feature matrix), the fitness value corresponding to each parent individual is calculated, and the individual with the minimum fitness value is recorded as gbest; make the gbest individual as parent1 and any other parent individual as parent2 to generate the child population P vctorkid {kid1,…,kid N}:
[0145] Crossover operator: kid i= 0.8 * parent1 + 0.2 * parent2 (10)
[0146] Mutation operator: kid i,e = rand(a, d) if rand(0, 1) < r (11)
[0147] In formula (10), (11), kid i represents the i-th offspring individual; parent1 represents the first parent individual; parent2 represents the second parent individual; rand(a, d) represents any value within the range of the vector value; r represents the probability of executing the mutation operator; e represents the e-th dimension of the vector of the i-th offspring individual kid i ; rand(0, 1) represents generating a random number within the range of (0, 1), and if the random number is less than the probability r of executing the mutation operator, kid i the e-th dimension of the vector is assigned to any value within the range of the vector value, so as to increase the diversity of the search population and prevent the search of the vector from falling into a local optimal solution;
[0148] According to formula (7) or (8), the second objective function value corresponding to the parent individual and the offspring individual is calculated (formula (7) is used for optimizing the user feature matrix, and formula (8) is used for optimizing the item feature matrix), and the smaller the second objective function value is, the more accurate the feature vector representation is. The second objective function values are arranged from small to large, and the individuals corresponding to the first M second objective function values are selected as the parent individuals of the next generation of the genetic algorithm. After the final genetic algorithm iteration ends, the optimal vector individual is selected to replace the original vector;
[0149] The number of updates of the entire genetic algorithm is controlled by the variable T, and the iteration is stopped after reaching the upper limit T max , and the next vector to be optimized is continued to be traversed.
[0150] S5-3: After the iteration of the second objective function ends, the second user implicit feature matrix P * , the second item implicit feature matrix Q * , and the corresponding second user implicit feature matrix bias vector b * , the second item implicit feature matrix bias vector c * are obtained by optimization when the second objective function reaches the minimum value. The second rating prediction data, i.e., the user rating prediction data, is calculated:
[0151]
[0152] In formula (12), F prediction represents the rating prediction data of the user u to the item i; f represents the dimension of the implicit feature space; represents the second user implicit feature matrix P *the value in the u-th row and the k-th column of R; denotes the second item implicit feature matrix Q * the value in the k-th row and the i-th column of R.
[0153] In order to verify the adaptive implicit feature analysis and further optimize the performance of the implicit feature device and method, the device is installed on a server (configuration: Intel Xeon E5-2630 v4, 2.2GHz processor, 256G memory), and simulation experiments are run for instance analysis. In the instance analysis, the score data used is derived from a classic data set publicly available on the network. The instance analysis uses the root mean square error RMSE as an evaluation index for the accuracy of the implicit feature extraction of the score data, and the lower the RMSE, the higher the accuracy of the implicit feature.
[0154]
[0155] formula (13), r u,i denotes the known score matrix R Λ the value in the u-th row and the i-th column of R; denotes the predicted score of user u on item i; |S| denotes the total number of samples contained in the test set S. F RMSE The smaller the value, the smaller the prediction error, and the better the prediction effect.
[0156] Figure 6 In order to compare the accuracy of the implicit feature extraction of the score data before and after the application of the embodiment of the present application, refer to Figure 6 After the application of the embodiment of the present application, the adaptive adjustment of the learning rate and the further optimization of the implicit feature will bring good optimization effect to the extraction accuracy. The first case represents the implicit feature extraction result with fixed learning rate self-adaption, and the second case represents the adaptive selection of the best implicit feature extraction result after the application of the embodiment of the present application.
[0157] From the above technical solutions, it can be seen that the present application is specially used in the recommendation system, can extract effective and high-accuracy implicit features from the existing scores, and can solve the problems existing in the modern recommendation system to a certain extent.
[0158] The present application also provides an electronic device, which comprises a processor for running a computer program stored in a memory to enable the electronic device to implement the steps of the user score method based on adaptive implicit feature analysis and optimization in the above embodiments.
[0159] The present application also provides a computer readable storage medium, which stores a computer program that implements the steps of the user score method based on adaptive implicit feature analysis and optimization in the above embodiments when running on a processor.
[0160] A computer program includes computer program code, which can be in source code, object code, executable code, or some intermediate form. The computer readable medium can include at least any entity or device capable of carrying the computer program code, a recording medium, a computer memory, a Read-Only Memory (ROM), a Random Access Memory (RAM), an electric carrier signal, a telecommunications signal, and a software distribution package, such as a compact disc, a DVD, a USB flash drive, or a memory card. In some jurisdictions, depending on the legislation and patent practice, a computer readable medium can not be an electric carrier signal and a telecommunications signal.
[0161] It is to be understood that the above-described embodiments are merely illustrative of the principles of the application, and that numerous and various modifications can be effected thereto by those skilled in the art without departing from the spirit and scope of the application.
Claims
1. A user rating prediction method based on adaptive latent feature analysis and optimization, characterized in that, The specific steps include: S1: Obtain user rating history data and prediction instructions from the server; S2: Initialize the first process parameters; S3: Constructing a first objective function based on the first process parameter and the historical rating data, and outputting a first user latent feature matrix and a first item latent feature matrix; The S3 includes: S3-1: Construct the first objective function ε based on the difference between the real rating data and the historical rating data: In formula (1), P represents the first user's implicit feature matrix; Q represents the first item latent feature matrix; b, c represent linear bias terms; r u,i represents the rating matrix R Λ represents the value of the u-th row and the i-th column in the rating matrix R Λ represents the known rating matrix; represents the predicted rating of the user u to the item i; p u,k represents the value of the k-th dimension of the latent feature vector of the u-th user in the first user latent feature matrix P; q k,i represents the value of the k-th dimension of the latent feature vector of the i-th item in the first item latent feature matrix Q; b u represents the bias term corresponding to the vector of the user u, c u represents the bias term corresponding to the vector of the item i; λ represents the regularization constant; is part of the regularization term, used to limit the value of the feature matrix to prevent model overfitting, represents the complexity of the user vector, the feature vector; S3-2: According to the first objective function ε, iteratively update the P and Q matrices to minimize the objective function value. The training iteration formula is as follows: In formula (2), represents the updated value of the u-th row and the k-th column in the first user implicit feature matrix P in the τ-th iteration; represents the updated value of the u-th row and the k-th column in the first user implicit feature matrix P in the (τ-1)-th iteration; τ-1 represents the learning rate obtained by S3-5 in the τ-th generation update; λ represents a regularization penalty term factor; represents the difference between the real score r u,i and the predicted value . represents the updated value of the k-th row and the i-th column in the first item implicit feature matrix Q in the τ-th generation; represents the updated value of the k-th row and the i-th column in the first item implicit feature matrix Q in the (τ-1)-th iteration; represents the updated value of the bias item corresponding to the vector of user u in the τ-th generation; represents the updated value of the bias item corresponding to the vector of item i in the τ-th generation; S3-3: Use genetic algorithm to find a learning rate η that fits the next round of update matrix τ : Initialize a learning rate search population of size N as initial parent population P η {P1,…,P N N}, where each particle represents a learning rate η; traverse the parent population, each parent individual as parent1, and select any other parent individual as parent2, generate a new learning rate as the child population P ηkid {kid1,…kid N N} according to the learning rate information in the parent population, the algorithm is as follows: Crossover operator: kid i = 0.8 * parent1 + 0.2 * parent2 (3) Mutation operator: kid i = rand(η min , η max ) if rand(0, 1) < r (4) In formulas (3), (4), kid i represents the i-th offspring individual, parent1 represents the first parent individual, parent2 represents the second parent individual, rand(0,1) represents a random number generated in the range of (0,1); r represents the probability of executing the mutation operator; If the random number is less than the probability r of the mutation operator execution, the kid i is assigned an arbitrary value in the learning rate value range; In formula (5), F RMASE (η j ) represents the first objective function value corresponding to the parent individual and the child individual, that is, the mean square error of calculating the true value and the predicted value on the verification set Ω; |Ω| represents the total number of samples contained in the verification set Ω; S3-4: iteratively optimize the first objective function according to the updated learning rate, and determine whether the iteration control variable L has reached the upper limit L max ; if yes, terminate the iteration, and if no, continue the iteration; S3-5: Determine whether the iterative process of the first objective function converges, if so, terminate the iteration, otherwise continue the iteration; S3-6: When the first objective function is iterated to the end and the first objective function reaches a minimum value, the first user latent feature matrix P and the first item latent feature matrix Q are output; S4: Initialize the second process parameters; S5: Construct a second objective function according to the second process parameter, and use a genetic algorithm to optimize the first user implicit feature matrix and the first item implicit feature matrix to obtain the second user implicit feature matrix and the second item implicit feature matrix, thereby outputting user rating prediction data.
2. The user rating prediction method based on adaptive eigen-feature analysis and optimization as claimed in claim 1, wherein, The first process parameter in the S2 includes: user potential feature matrix P, item potential feature matrix Q matrix, linear bias term b, c, genetic algorithm population size N, genetic algorithm initial solution individual about learning rate, probability r of executing genetic algorithm mutation operator, matrix update iteration control variable L, maximum iteration number of matrix update L max , regularization penalty term factor λ, iteration convergence termination threshold τ, and learning rate η value range [η min , η max ].
3. The user rating prediction method based on adaptive eigen-feature analysis and optimization as claimed in claim 1, wherein, In the S4, the second process parameters include: a first user hidden feature matrix P, a first item hidden feature matrix Q, a genetic algorithm population size N, a disturbance amplitude β for generating a new vector individual based on an optimized vector, an initial solution individual generated when optimizing each row of the vector, a probability r for executing a genetic algorithm mutation operator, a matrix update iteration control variable L, a maximum value of the matrix update iteration number L max , a single vector update iteration control variable T, a maximum value of the single vector update iteration number T max , a regularization penalty term factor λ, and an iteration convergence termination threshold τ.
4. The user rating prediction method based on adaptive eigenfeature analysis and optimization as claimed in claim 1, wherein, The S5 includes: S5-1: constructing a corresponding second objective function according to the second process parameter and the first user implicit feature matrix P and the first item implicit feature matrix Q or In formula (6), P represents a first user latent feature matrix; Q represents a first item latent feature matrix; b, c represent linear bias terms; R Λ represents a known rating matrix; r u,i represents a known rating matrix R Λ represents a value in the u-th row and the i-th column in the known rating matrix R, i.e., a rating of the user u to the item i; p u,k represents a value in the u-th row and the k-th column in the first user latent feature matrix P; q k,i represents a value in the k-th row and the i-th column in the first item latent feature matrix Q; represents the predicted rating of user u for item i b u represents the bias term corresponding to the vector of user u, c u represents the bias term corresponding to the vector of item i; λ represents a regularization constant to prevent overfitting during training S5-2: Use the genetic algorithm to optimize the first user implicit feature matrix P and the first project implicit feature matrix Q row by row: First, the first user implicit feature matrix P is optimized, and then the first item implicit feature matrix Q is optimized; the feature matrix is traversed row by row, the row vector traversed is randomly disturbed, N new vectors are generated as the parent population P of the genetic algorithm vector {P1,…,P N} for searching for a better row vector; the fitness value corresponding to each parent individual is calculated according to formula (6), and the individual with the minimum fitness value is recorded as gbest; Then the gbest individual is chosen as parent1 and any other parent individual as parent2 to generate the offspring population P vctorkid {kid1,..., kid N}; Crossover operator: kid i = 0.8 * parent1 + 0.2 * parent2 (7) Mutation operator: kid i,e = rand(a,d) if rand(0,1) < r (8) In the formulas (7) and (8), kid i represents the ith offspring individual, parent1 represents the first parent individual, parent2 represents the second parent individual, rand(a, d) represents any value in the range of (a, d); r represents the probability of executing the mutation operator; e represents the e-th dimension of the vector; rand(0, 1) represents generating a random number in the range of (0, 1); if the random number is less than the probability r of executing the mutation operator, kid i represents the e-th dimension of the vector; rand(0, 1) represents generating a random number in the range of (0, 1); if the random number is less than the probability r of executing the mutation operator, kid i represents the e-th dimension of the vector; rand(0, 1) represents generating a random number in the range of (0, 1); if the random number is less than the probability r of executing the mutation operator, kid According to formula (6), the second objective function values corresponding to the parent individuals and the offspring individuals are calculated, the second objective function values are arranged from small to large, and the individuals corresponding to the first M second objective function values are selected as the parent individuals of the next generation of the genetic algorithm. Finally, after the genetic algorithm iteration is completed, the optimal vector individual is selected to replace the original vector; S5-3: When the second objective function iteration is terminated, the second user implicit feature matrix P is optimized by using the second objective function to reach a minimum value * , the second item implicit feature matrix Q * , the user rating prediction data is calculated: Equation (7), F prediction represents the rating prediction data of the user u for the item i; f represents the dimension of the latent feature space; represents the second user latent feature matrix P * in the u-th row and the k-th column; represents the second item latent feature matrix Q * in the k-th row and the i-th column.
5. An adaptive latent feature analysis and optimization based user rating prediction apparatus based on the method of any of claims 1-4, characterized in that, Specifically, it includes a data receiving module (110), a data storage module (120), an adaptive parameter adjustment latent feature analysis module (130) and an output module (140); The data receiving module (110) is used to receive historical data of user ratings of projects; The data storage module (120) is used to store the rating history data sent by the data receiving module (110) and the user rating prediction data output by the output module (140); The adaptive parameter adjustment latent feature analysis module (130) is used to adaptively learn and optimize user latent features and project latent features based on the rating history data, and output a first user latent feature matrix and a first project latent feature matrix; The output module (140) is used to optimize the first user latent feature matrix and the first item latent feature matrix to obtain the second user latent feature matrix and the second item latent feature matrix, thereby outputting user rating prediction data.
6. The user rating prediction apparatus based on adaptive eigenfeature analysis and optimization as claimed in claim 5, wherein, The data storage module (120) comprises a first storage unit (1201) and a second storage unit (1202); the first storage unit (1201) is used for storing the score history data sent by the data receiving module (110); the second storage unit (1202) is used for storing the first user implicit feature matrix, the first item implicit feature matrix output by the adaptive parameter adjustment implicit feature analysis module (130), and the user score prediction data output by the output module (140).
7. The user rating prediction apparatus based on adaptive eigenfeature analysis and optimization as claimed in claim 5, wherein, The adaptive parameter adjustment implicit feature analysis module (130) comprises a first initialization unit (1301), a first iteration unit (1302), a first optimization unit (1303) and a first iteration result output unit (1304); The first initialization unit (1301) is used for initializing the first process parameter; The first iteration unit (1302) is used for obtaining the first user implicit feature and the first item implicit feature by performing implicit feature analysis according to the score history data and the first process parameter; The first optimization unit (1303) is used for updating the learning rate by using a genetic algorithm; The first iteration result output unit (1304) is used for outputting the first user implicit feature matrix and the first item implicit feature matrix.
8. The user rating prediction apparatus based on adaptive eigenfeature analysis and optimization as claimed in claim 5, wherein, The output module (140) comprises a second initialization unit (1401), a second iteration unit (1402) and a second iteration result output unit (1403); The second initialization unit (1401) is used for initializing the second process parameter in the optimization process; The second iteration unit (1402) is used for performing row-by-row iteration optimization on the first user implicit feature matrix and the first item implicit feature matrix by using a genetic algorithm to obtain the second user implicit feature matrix and the second item implicit feature matrix; The second iteration result output unit (1403) is used for outputting the user score prediction data according to the second user implicit feature matrix and the second item implicit feature matrix.
Citation Information
Patent Citations
Intelligent pediatric diet prediction method and device based on particle swarm optimization
CN111564201A