High newspaper school recommendation method based on mixed ALS alternating least square method and MLP algorithm
By adopting hybrid ALS alternating least squares method and MLP algorithm in the college entrance examination recommendation system, combined with BiLSTM sentiment analysis and dropout regularization, the problem of insufficient efficiency and accuracy of existing systems in large-scale data processing and personalized recommendations is solved, and more efficient and accurate recommendation results are achieved.
Patent Information
- Application Number
- CN202411888650.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-22
AI Technical Summary
The existing college entrance examination recommendation system is insufficient in efficiency and accuracy when dealing with large-scale data sets, especially in personalized recommendations and handling user cold start and data sparseness issues.
The recommended method of high-level schools based on hybrid ALS alternating least squares method and MLP algorithm is adopted. Sentiment analysis is performed through the BiLSTM model, ALS alternating least squares method is used for matrix dimensionality reduction, and the MLP algorithm is used for nonlinear processing. Combined with dropout regularization and AdamW optimizer, the number of hidden layers is adjusted to improve model performance.
It improves the efficiency and accuracy of the recommendation system on large-scale data sets, reduces user cold start and data sparsity problems, improves the accuracy and personalization of recommendations, is suitable for personalized recommendation scenarios, and enhances the company's marketing recommendation strategy and user satisfaction.
Smart Images

Figure CN119862319A_ABST
Abstract
Description
Technical Field
[0001] This patent belongs to the field of recommendation algorithm technology, and specifically relates to a method for recommending highly reported schools based on a hybrid ALS alternating least squares method and MLP algorithm. Background Art
[0002] In the field of college entrance examinations, the continuous reform and adjustment of the national and local governments' education policies, enrollment policies, and college entrance examination systems, such as changes in examination subjects, updates to admission standards, and revisions to bonus policies, will directly have a profound impact on the college entrance examination ecosystem. These changes not only require students and schools to flexibly adjust their preparation and teaching strategies, but also make college entrance examination related information more complex and changeable. Therefore, the establishment of an intelligent personalized recommendation system has become an inevitable trend in the development of the college entrance examination field. It can provide accurate and timely high-reporting school recommendation services based on the actual situation and needs of users. In response to the current research status and challenges in the field of college entrance examinations, in this patent, we propose a high-reporting school recommendation method based on a hybrid ALS alternating least squares method and MLP algorithm. This method will deeply integrate user emotional information and provide users with high-reporting school recommendations that are more in line with their needs and expectations through advanced algorithms and technical means. We verified the proposed method on the captured data set. Compared with many recommendation algorithms, our high-reporting school recommendation technology achieves a higher accuracy rate. Summary of the invention
[0003] The present invention aims to provide a method for recommending highly reported schools based on a hybrid ALS alternating least squares method and an MLP algorithm, thereby improving the traditional recommendation algorithm and enhancing the recommendation accuracy and adaptability.
[0004] In order to achieve the above object, the technical solution adopted by the present invention is: a method for recommending high-ranking schools based on a hybrid ALS alternating least squares method and an MLP algorithm, the steps of which are:
[0005] 1) Use the BiLSTM model to perform sentiment analysis on the collected text dataset;
[0006] The BiLSTM model is used to perform sentiment analysis on the collected user comment text dataset. The constructed model includes input layer, embedding layer, forward and reverse LSTM, connection layer and output layer, which fully captures the context information in the sequence and forms a rich feature representation.
[0007] The BiLSTM model performs sentiment classification on the collected comment texts and outputs the sentiment categories of the comment texts. Based on these sentiment categories, each text is assigned a corresponding score to express its sentiment intensity or attitude in a quantitative manner. The score matrix results of each text are then stored in the user rating dataset to provide solid data support for subsequent recommendation algorithms.
[0008] 2) Use scripts to clean the captured data set; use scripts in Python using the pandas library to clean user, university, and rating data.
[0009] 3) Use the ALS alternating least squares method to reduce the dimension of the user rating matrix;
[0010] The sparse user rating matrix is decomposed into two low-order matrix products to optimize the recommendation performance and computational efficiency. Suppose m users have n item rating matrices Will The matrix is decomposed into two matrices, P and Q. The calculation formula is as follows:
[0011]
[0012] User u's rating for item i is The formula is as follows:
[0013]
[0014] To prevent overfitting, a regular term is introduced to regulate the model variance. When training the user and item factor matrices, the mean square error (RMSE) is used as the evaluation criterion to minimize the error between the predicted and actual values. The loss function is defined as follows:
[0015]
[0016] where r ui represents the algorithm's prediction of the rating of user u for item i, p u represents the implicit feature factor vector of user u, q i is the implicit feature factor vector of item i, λ represents the regularization term coefficient used to prevent overfitting of the model;
[0017] Use the least squares method to solve, then perform alternating iterations, fix one of the matrices, and calculate the loss function C(p, q) for p u ,q i The partial derivative is equal to 0, and the formula is as follows:
[0018] p u =(Q T Q+λE) -1 +Q T r u
[0019] q i =(O T P+λE) -1 +O T r i
[0020] Where E is the identity matrix of f*f. The original matrix Q is initialized, and P and Q are calculated respectively. The iteration is repeated until the specified number of iterations is reached or the RMSE is optimal.
[0021] 4) The processed data is imported into the MLP recommendation algorithm for training, with the binary classification of positive and negative examples as the output mechanism, and the output result is between 0 and 1, so as to make recommendations.
[0022] 4.1) Input the data into the multi-layer perceptron MLP for linear and nonlinear processing through multiple fully connected layers. The formula is as follows:
[0023] z (l) =W (l) x (l-1) +b (l)
[0024] The linear transformation result is then transformed nonlinearly through the tanh activation function, and nonlinearity is introduced through the activation function. The calculation formula is as follows:
[0025] x (l) =tanh(W (l) ·x (l-1) +b (l) )
[0026] 4.2) Use BCELoss to calculate the loss, which is a key indicator for evaluating model performance and guiding parameter optimization. It is used to quantify the inconsistency or error between the model prediction output and the actual label. The formula is as follows:
[0027] Loss(p,y)=-ylog(p)-(1-y)log(1-p)
[0028] 4.3) Use the back-propagation algorithm to calculate the gradient according to the loss function and adjust the weights and biases of the model:
[0029] There are two formulas for calculating the error term. (l) The error term of the current layer is calculated by back-propagating the error term of the next layer to the current layer. These two formulas together form the basis of the back-propagation algorithm in the neural network. By calculating the error term of each layer, the partial derivative of the loss function with respect to the network parameters can be calculated later. The formula is as follows:
[0030] δ (l) =(a (l) -y)·σ′(z (l) )
[0031] δ (l) =((W (l+1) ) Tδ( l+1 ))·σ′(z (l) )
[0032] According to the error terms of the above two formulas, the gradients of weights and biases are obtained, the weight formula W(l) and the bias b (l) The partial derivative formula of is as follows:
[0033]
[0034] The gradient is used by the Adam algorithm to update the parameters of the network to minimize the loss function;
[0035] 4.4) Use the AdamW optimizer to update the weights and apply the dropout regularization algorithm to reduce overfitting. AdamW introduces a regularization term for weight decay and calculates the first-order momentum. The calculation formula is as follows:
[0036] m=betal*m+(1-betal)*grad
[0037] Calculate the second-order momentum (Velocity), the calculation formula is as follows:
[0038] v=beta2*v+(1-beta2)*(grad**2)
[0039] Then the weight is attenuated, and the calculation formula is as follows:
[0040] theta=theta-learning_rate*(m / (sqrt(v)+epsilon))-weight_decay*theta
[0041] Among them, theta represents the weight parameter of the model, learning_rate represents the learning rate, epsilon is a small constant used to prevent the denominator from being zero, and weight_decay is the weight decay coefficient;
[0042] The dropout algorithm formula is as follows:
[0043]
[0044] where r i It is an independent random variable. Its value 1 means retaining the input, and its value 0 means discarding the input. The original data element is changed to 0 with probability p, that is, the data is discarded; the original data element is enlarged with probability 1-p, and the more important data is purified. The default value of p is 0.5;
[0045] 4.5) For the constructed hybrid recommendation model, adjust the number of hidden layers, and find the optimal number of hidden layers based on the data set. The improved mathematical formula of the fully connected layer is as follows:
[0046] out=σ(W4tanh(W3tanh(W2tanh(W1x))))
[0047] A dropout regularization function is added between each hidden layer to reduce the risk of overfitting. The output of the last hidden layer is used as the input of the output layer. The sigmoid normalization function is used for normalization, and the output value is mapped to the range of [0, 1] to make accurate recommendations based on the user's preference probability.
[0048] The beneficial effects created by the present invention are as follows: the present invention can improve the efficiency and accuracy of the recommendation system when processing large-scale data sets, and is particularly suitable for personalized recommendation scenarios, reducing user cold start and data sparsity problems; the present invention, by combining the ALS and MLP algorithms, can efficiently capture the nonlinear characteristics in user behavior and improve the accuracy and personalization level of recommendations; the present invention can help enterprises optimize marketing recommendation strategies, provide more targeted and efficient product recommendations, and improve user satisfaction and conversion rates; the present invention can be widely used in multiple industries, including e-commerce, finance, online education and entertainment, to provide users with personalized recommendation services and enhance corporate competitiveness. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 is a flow chart of the ALS-MLP recommendation algorithm of the present invention;
[0050] Figure 2 This is the BiLSTM structure diagram;
[0051] Figure 3 It is a graph of the hybrid improved ALS-MLP recommendation model;
[0052] Figure 4 It is a fully connected layer model diagram;
[0053] Figure 5 It is the regularization flowchart of the dropout algorithm;
[0054] Figure 6 Comparison of recommendation accuracy of different hidden layer mechanisms without dropout regularization algorithm;
[0055] Figure 7 Comparison of recommendation accuracy using different hidden layer mechanisms of the dropout regularization algorithm.
[0056] Figure 8 Experimental diagram comparing the accuracy of different optimization algorithms;
[0057] Fig. 9 Experimental chart comparing the accuracy of different recommendation algorithms. DETAILED DESCRIPTION
[0058] The specific implementation of the present invention is described in detail below with reference to examples and drawings.
[0059] The present invention provides a method for recommending high-reporting schools based on a hybrid ALS alternating least squares method and an MLP algorithm. The intrusion detection method flow chart of the present invention is as follows: Figure 1 As shown, the following steps are included:
[0060] (1) Training process:
[0061] First, the BiLSTM model is used to perform sentiment analysis on the collected user comment text dataset. The constructed model includes input layer, embedding layer, forward and reverse LSTM, connection layer and output layer. Figure 2 As shown, it can fully capture the contextual information in the sequence and form a rich feature representation.
[0062] In LSTM, f t It is called the forget gate, indicating that C t-1 Needed to calculate C t Features; Represents the most important gate mechanism in LSTM; W f is the weight of the forget gate; b f is the bias of the forget gate. The mathematical formula used here is as follows:
[0063] f t =σ(W f ·[h t-1 , x t ]+b f )
[0064] The function of input gate i is to control the influence of input x and current computing state on memory unit update. The corresponding mathematical representation is as follows:
[0065] i t =σ(W i ·[h t-1 , x t ]+b i )
[0066] i t Can control some features of Ct to update C t With f t The calculation formula is as follows:
[0067]
[0068] Among them, the relevant mathematical expression of the output layer principle is as follows:
[0069] o t =σ(W o ·[h t-1 , x t ]+b o )
[0070] The calculation formula for the hidden state update is as follows:
[0071] h t =o t tanh(C t )
[0072] Based on the above LSTM calculation, the reverse LSTM is then calculated, which is similar to the forward LSTM, except that its calculation order starts from the last time step of the sequence and goes back to the previous time step. and the output of the reverse LSTM The splicing will be performed at each practice section t, and the formula is as follows:
[0073]
[0074] Finally, a fully connected layer will be constructed to receive the concatenated hidden state And predict the sentiment category, the formula is as follows:
[0075]
[0076] The BiLSTM model will classify the collected comment texts and output the emotional categories of the comment texts, such as positive, negative or neutral, etc. Based on these emotional categories, each text is assigned a corresponding score to express its emotional intensity or attitude in a quantitative way. The score matrix results of each text are then stored in the user rating dataset to provide solid data support for subsequent recommendation algorithms.
[0077] Then, a script is used in Python to use the pandas library to clean the user, university, and rating data.
[0078] The cleaned classification results will be used as the input of the hybrid improved ALS-MLP recommendation model. The overall recommendation model is as follows Figure 3As shown in Figure 1, the original data is often full of useless information, duplicates, and erroneous data, and the user-item rating matrix is usually large-scale and sparse. Therefore, the ALS alternating least squares method is used to achieve matrix dimensionality reduction, that is, to decompose the sparse user rating matrix into two low-order matrix products to optimize the recommendation performance and computational efficiency. Suppose that the rating matrix of m users for n items is Will The matrix is decomposed into two matrices, P and Q. The calculation formula is as follows:
[0079]
[0080] Where P∈R f*m , Q∈R f*n .
[0081] User u's rating for item i is The formula is as follows:
[0082]
[0083] To prevent overfitting, a regularization term is introduced to regulate the model variance. When training the user and item factor matrices, the mean square error (RMSE) is used as the evaluation criterion to minimize the error between the predicted and actual values to ensure that the model is accurate and has strong generalization capabilities. At this point, the loss function can be defined, and its formula is as follows:
[0084]
[0085] where r ui represents the algorithm's prediction of the rating of user u for item i, p u represents the implicit feature factor vector of user u, q i is the implicit feature factor vector of item i. λ represents the regularization term coefficient used to prevent overfitting of the model. When λ is small, the model is more inclined to fit the training data, which may increase the risk of overfitting. When λ is large, the model is more inclined to choose a simple solution, which may increase the risk of underfitting. Therefore, the adjustment of λ is crucial.
[0086] The least squares method can be used to solve it. The next step is the alternating iterative process. Fix one of the matrices, such as Q first, and calculate the loss function C(p, q) for p u The partial derivative is equal to 0, and the formula is as follows:
[0087] p u =(Q T Q+λE) -1 +Q T r u ,
[0088] Similarly, fix P and continue to calculate C(p, q) versus q i The partial derivative is equal to 0, and the formula is:
[0089] q i =(O T O+λE) -1 +O T r i
[0090] Among them, E is the identity matrix of f*f. The original matrix Q is initialized, and then P is calculated. Q is calculated by the user. It is iterated repeatedly until the specified number of iterations is reached or the RMSE is optimal.
[0091] The data is then fed into a multi-layer perceptron (MLP) for linear and nonlinear processing. This step is done through multiple dense layers, as shown in Figure 4 As shown, the formula is as follows:
[0092] z (l) =W (l) x (l-1) +b (l)
[0093] The weight matrix of the lth layer is W (l) , the bias vector is b (l) , the output of the previous layer is x (l-1) , z (l) represents the input of the lth layer, that is, the result after linear transformation. Then the linear transformation result is transformed nonlinearly through the tanh activation function, and nonlinearity is introduced through the activation function. The calculation formula is as follows:
[0094] x (l) =tanh(W (l) ·x (l-1) +b (l) )
[0095] Where W (l) ·x (l-1) +b (l) It is the output result of the linear change of matrix multiplication. It is used as the input of the nonlinear change and is calculated according to the tanh activation function to obtain the nonlinear result of the current hidden layer.
[0096] Secondly, BCELoss (Binary Cross Entropy Loss) is used to calculate the loss, which is a key indicator for evaluating model performance and guiding parameter optimization. It is used to quantify the inconsistency or error between the model prediction output and the actual label. The formula is as follows:
[0097] Loss(p,y)=-ylog(p)-(1-y)log(1-p)
[0098] y is the true value, which is 0 or 1. p is the predicted value of the model output, which ranges from (0, 1). When the true value y is 1, the first part -y log(p) contributes to the overall loss. When the true value y is 0, the second part -(1-y)log(1-p) contributes to the overall loss.
[0099] Again, use the backpropagation algorithm to calculate the gradient according to the loss function and adjust the weights and bias of the model. The steps are as follows:
[0100] There are two formulas for calculating the error term, and the formula for the last layer of error terms is as follows:
[0101] δ (l) =(a (l) -y)·σ′(z (l) )
[0102] where δ (l) is the error term of the lth layer. (l) is the output of the output layer. y is the true label. · represents element-by-element multiplication. σ′ is the derivative of the activation function, based on the partial derivative of the loss function with respect to the output layer activation value and the chain rule. It measures the difference between the activation value of each neuron in the output layer and the target value, and adjusts this difference through the derivative of the activation function. The formula for the hidden layer error term is as follows:
[0103] δ (l) =((W (l+1) ) T δ (l+1) )·σ′(z (l) )
[0104] Among them, δ (L) : Error term of the lth layer (hidden layer). (W (l+1) ) T : The transpose of the weight matrix of the l+1th layer. δ (l+1) : The error term of the l+1th layer, σ′(z (l) ): The derivative of the activation function of the lth layer, at z (l) The error term of the current layer is calculated by back-propagating the error term of the next layer to the current layer. The error term of the next layer is propagated to the current layer through the transpose of the weight matrix and adjusted by the derivative of the activation function of the current layer. These two formulas together form the basis of the back-propagation algorithm in neural networks. They calculate the error term of each layer, making it possible to subsequently calculate the partial derivatives of the loss function with respect to the network parameters.
[0105] According to the error terms of the above two formulas, the gradients of weights and biases can be obtained. The weight formula W (l) The partial derivative (gradient) formula is as follows:
[0106]
[0107] Among them, δ (l+1) : The error term of the l+1th layer, which is a vector whose elements represent the contribution of each neuron in this layer to the final loss. (l) : The activation value (output) of the lth layer, also a vector. (a (l) ) T :a (l) The transpose of δ converts the row vector into a column vector for easy comparison with δ (l+1) Perform matrix multiplication. The result value represents the partial derivative of the loss function C with respect to the weight matrix W(l), and the result is a matrix.
[0108] Bias b (l) The partial derivative (gradient) formula is as follows:
[0109]
[0110] δ (l+1) : It also represents the error term of the 1+1 layer. The result value represents the loss function C with respect to the bias vector b (l) The partial derivative of , the result is a vector.
[0111] These two formulas provide a way to calculate the gradients of the weights and biases in a neural network with respect to the loss function, which are then used by the Adam algorithm to update the parameters of the network to minimize the loss function.
[0112] Next, use the AdamW optimizer to update the weights. AdamW introduces a regularization term for weight decay. The steps are as follows:
[0113] First, calculate the first-order momentum. The calculation formula is as follows:
[0114] m=beta1*m+(1-beta1)*grad
[0115] Where m is the estimated value of the first-order momentum, beta1 is the decay rate of the first-order momentum, and grad is the gradient of the current step.
[0116] Then calculate the second-order momentum (Velocity), the calculation formula is as follows:
[0117] v=beta2*v+(1-beta2)*(grad**2)
[0118] Where v is the estimated value of the second-order momentum, beta2 is the decay rate of the second-order momentum, and ** represents the exponential operator.
[0119] Then the weight is attenuated, and the calculation formula is as follows:
[0120] theta=theta-learning_rate*(m / (sqrt(v)+epsilon))-weight_decay*theta
[0121] Among them, theta represents the weight parameter of the model, learning_rate represents the learning rate, epsilon is a small constant used to prevent the denominator from being zero, and weight_decay is the weight decay coefficient.
[0122] The dropout algorithm is mainly used for regularization, which helps to reduce overfitting. The algorithm formula is as follows:
[0123]
[0124] where r i is an independent random variable. Its value 1 means retaining the input, and its value 0 means discarding the input. The original data element is changed to 0 with probability p, that is, the data is discarded; the original data element is enlarged with probability 1-p, which can purify the more important data. p is 0.5 by default, and can be dynamically adjusted according to the amount of data, as shown in Figure 5 shown.
[0125] At the same time, in some complex tasks, a single hidden layer MLP may not be able to fully capture the high-order features or nonlinear relationships in the data, which can lead to performance limitations. In order to solve this problem, the expressiveness of the model is improved by increasing the number of hidden layers or using a more complex network structure. For the hybrid recommendation model constructed in this paper, the number of hidden layers is innovatively adjusted, and based on the dataset of this paper, the optimal number of hidden layers is successfully found, which significantly improves the performance of the model and achieves the maximum effect.
[0126] The improved mathematical formula of the fully connected layer is as follows:
[0127] out=σ(W4 tanh(W3 tanh(W2 tanh(W1x))))
[0128] In this formula, the feature vector x is first multiplied by the weight matrix W, and then processed by the tanh nonlinear activation function, forming a recursive nested pattern. Each multiplication of the weight W and the feature vector x is equivalent to a full connection operation in the model. With the help of the loss function, gradient calculation, gradient transfer, and dynamic parameter adjustment of the fully connected layer, the optimizer and optimization algorithm on the fully connected layer are used to effectively adjust the learning rate of the algorithm, significantly improving the training efficiency of the model. Finally, the sigmoid normalization function is used to control the result within the range of 0 to 1 for recommendation, and then it is displayed to the user through the page.
[0129] The training process of the model is controlled by setting the number of cycles (epochs) and the number of hidden layers. If the conditions are met, the next epoch is entered, otherwise the training ends. The trained and optimized model returns the prediction results to the user and performs Sigmoid normalization. The final output is the school recommendation result set.
[0130] (2) Detection process:
[0131] 2.1) Train the model and test the model multiple times to prove that the model is better than other comparison models in terms of accuracy.
[0132] The detection results of the entire test sample can be obtained through the recommendation detection classification module. We can compare the predicted results of the recommendation classification module with the actual type of the test sample to obtain evaluation indicators of the recommendation system such as accuracy and time consumption, and adjust the above steps and parameters according to the results.
[0133] The experimental results of comparing the recommendation accuracy of different hidden layer mechanisms without combining the dropout regularization algorithm are as follows: Figure 6 As shown. Comparative analysis shows that the ALS-MLP model with two hidden layers (ALS-MLP_2) shows higher recommendation accuracy. This model does not use a regularization algorithm, so its performance improvement is mainly due to its ability to better capture complex nonlinear relationships rather than being affected by overfitting. In contrast, the negative effects of overfitting in the models with three and four hidden layers exceed the improvement of the model on accuracy, resulting in a decline in overall accuracy. This observation shows that the model with two hidden layers can more effectively capture nonlinear features during the data collection stage, thereby avoiding overfitting while maintaining high accuracy.
[0134] The experimental results of comparing the recommendation accuracy of different hidden layer mechanisms combined with the dropout regularization algorithm are as follows: Figure 7As shown. For this experiment, the four curves represent the accuracy changes of the ALS-MLP recommendation model with one, two, three, and four hidden layers. It is obvious that ALS-MLP_4 (i.e., the model with four hidden layers) significantly surpasses the one-layer, two-layer, and three-layer versions in recommendation accuracy. This finding strongly supports the hypothesis of this article: by adding hidden layers, the model can extract deeper nonlinear feature relationships. At the same time, the effective use of the dropout algorithm also significantly reduces the risk of overfitting.
[0135] The experimental results of comparing the accuracy of different optimization algorithms are as follows Figure 8 As shown in the figure. Through comparative experiments, it is found that when using the improved AdamW optimization algorithm, the accuracy of the recommendation model is significantly higher. This result proves that during the optimization process, the AdamW algorithm effectively optimizes the entire recommendation model by adding weight decay terms, especially stabilizing the convergence of the model during the training process and improving the final recommendation accuracy.
[0136] The experimental results of comparing the ALS-MLP recommendation model proposed in this paper with the traditional recommendation algorithm are as follows: Fig. 9 As shown. From the experimental results, it can be observed that the ALS-MLP recommendation model of the present invention is significantly better than the user-based collaborative filtering recommendation algorithm and the item-based collaborative filtering recommendation algorithm in terms of accuracy. This significant performance improvement shows that the ALS-MLP recommendation model has higher efficiency than the traditional collaborative filtering method, especially when processing high-dimensional feature vectors. This further verifies the effectiveness and importance of incorporating high-dimensional feature vector information into the recommendation model.
[0137] In all the above experiments, this method uses the standard recommendation system evaluation indicator - NDCG (Normalized Discounted Cumulative Gain) to evaluate the performance of the model. NDCG not only considers the accuracy of the recommendation results, but also gives higher weight to the relevance of high-ranking items, thus better reflecting the ranking quality and recommendation quality of the model.
[0138] The above invention is a method for recommending highly reported schools based on a hybrid ALS alternating least squares method and an MLP algorithm. However, for those skilled in the art, without departing from the concept of the invention, with the continuous deepening of the research on the MLP neural network, the optimization algorithm and model will become an important work direction in the future. Through continuous improvement and optimization, it is expected to continuously improve the accuracy and applicability of the ALS-MLP recommendation model, and bring users a more accurate and personalized recommendation experience. In addition, for the present invention, several improvements and variations can be made to the method for other application scenarios.
Claims
1. A method for recommending highly-rated schools based on a hybrid ALS alternating least squares method and MLP algorithm, characterized in that: The steps are: 1) Use the BiLSTM model to perform sentiment analysis on the collected text dataset; 2) Use scripts to perform data cleaning operations on the captured overall data set; 3) Use the ALS alternating least squares method to reduce the dimension of the user rating matrix; 4) The processed data is imported into the MLP recommendation algorithm for training, with the binary classification of positive and negative examples as the output mechanism, and the output result is between 0 and 1, so as to make recommendations.
2. The method for recommending high-ranking schools based on a hybrid ALS alternating least squares method and MLP algorithm according to claim 1, characterized in that: In the above 1), the specific method is: The BiLSTM model is used to perform sentiment analysis on the collected user comment text dataset. The constructed model includes input layer, embedding layer, forward and reverse LSTM, connection layer and output layer, which fully captures the context information in the sequence and forms a rich feature representation. The BiLSTM model performs sentiment classification on the collected comment texts and outputs the sentiment categories of the comment texts. Based on these sentiment categories, each text is assigned a corresponding score to express its sentiment intensity or attitude in a quantitative manner. The score matrix results of each text are then stored in the user rating dataset to provide solid data support for subsequent recommendation algorithms.
3. The method for recommending high-ranking schools based on a hybrid ALS alternating least squares method and MLP algorithm according to claim 1, characterized in that: In the above 2), the specific method is: using the pandas library in Python in a scripting manner to clean the user, university, and rating data.
4. The method for recommending high-ranking schools based on a hybrid ALS alternating least squares method and MLP algorithm according to claim 1, characterized in that: In the above 3), the specific method is: The sparse user rating matrix is decomposed into two low-order matrix products to optimize the recommendation performance and computational efficiency. Suppose m users have n item rating matrices Will The matrix is decomposed into two matrices, P and Q. The calculation formula is as follows: User u's rating for item i is The formula is as follows: To prevent overfitting, a regular term is introduced to regulate the model variance. When training the user and item factor matrices, the mean square error (RMSE) is used as the evaluation criterion to minimize the error between the predicted and actual values. The loss function is defined as follows: where r ui represents the algorithm's prediction of the rating of user u for item i, p u represents the implicit feature factor vector of user u, q i is the implicit feature factor vector of item i, λ represents the regularization term coefficient used to prevent overfitting of the model; Use the least squares method to solve, then perform alternating iterations, fix one of the matrices, and calculate the loss function C(p, q) for p u ,q i The partial derivative is equal to 0, and the formula is as follows: p u =(Q T Q+λE) -1 +Q T r u q i =(O T O+λE) -1 +O T r i Where E is the identity matrix of f*f. The original matrix Q is initialized, and P and Q are calculated respectively. The iteration is repeated until the specified number of iterations is reached or the RMSE is optimal.
5. The method for recommending high-ranking schools based on a hybrid ALS alternating least squares method and MLP algorithm according to claim 1, characterized in that: In the above 4), the specific method is: 4.1) Input the data into the multi-layer perceptron MLP for linear and nonlinear processing through multiple fully connected layers denselayers. The formula is as follows: z (l) =W (l) x (l-1) +b (l) The linear transformation result is then transformed nonlinearly through the tanh activation function, and nonlinearity is introduced through the activation function. The calculation formula is as follows: x (l) =tanh(W (l) ·x (l1) +b (l) ) 4.2) Use BCELoss to calculate the loss, which is a key indicator for evaluating model performance and guiding parameter optimization. It is used to quantify the inconsistency or error between the model prediction output and the actual label. The formula is as follows: Loss(p,y)=-ylog(p)-(1-y)log(1-p) 4.3) Use the back-propagation algorithm to calculate the gradient according to the loss function and adjust the weights and biases of the model: There are two formulas for calculating the error term. (l) The error term of the current layer is calculated by back-propagating the error term of the next layer to the current layer. These two formulas together form the basis of the back-propagation algorithm in the neural network. By calculating the error term of each layer, the partial derivative of the loss function with respect to the network parameters can be calculated later. The formula is as follows: d (l) =(a (l) -y)·σ′(z (L) ) d (l) =((W (l+1) ) T d (l+1) )·σ′(z (l) ) According to the error terms of the above two formulas, the gradients of weights and biases are obtained, and the weight formula W(1) and the bias b (l) The partial derivative formula of is as follows: The gradient is used by the Adam algorithm to update the parameters of the network to minimize the loss function; 4.4) Use AdamW optimizer to update weights and apply dropout regularization algorithm to reduce overfitting, where: AdamW introduces a regularization term for weight decay and calculates the first-order momentum. The calculation formula is as follows: m=betal*m+(1-betal)*grad Calculate the second-order momentum (Velocity), the calculation formula is as follows: v=beta2*v+(1-beta2)*(grad**2) Then the weight is attenuated, and the calculation formula is as follows: theta=theta-learning_rate*(m / (sqrt(v)+epsilon))-weight_decay*theta Among them, theta represents the weight parameter of the model, learning_rate represents the learning rate, epsilon is a small constant used to prevent the denominator from being zero, and weight_decay is the weight decay coefficient; The dropout algorithm formula is as follows: where r i It is an independent random variable. Its value 1 means retaining the input, and its value 0 means discarding the input. The original data element is changed to 0 with probability p, that is, the data is discarded; the original data element is enlarged with probability 1-p, and the more important data is purified. The default value of p is 0.5; 4.5) For the constructed hybrid recommendation model, adjust the number of hidden layers, and find the optimal number of hidden layers based on the data set. The improved mathematical formula of the fully connected layer is as follows: out=σ(W4tanh(W3tanh(W2tanh(W1x)))) A dropout regularization function is added between each hidden layer to reduce the risk of overfitting. The output of the last hidden layer is used as the input of the output layer. The sigmoid normalization function is used for normalization, and the output value is mapped to the range of [0, 1] to make accurate recommendations based on the user's preference probability.