Next Article in Journal
Optimization of the Antifungal Property in a Composite of Polyurethane and Silver Nanoparticles against the Trichophyton rubrum Fungus
Previous Article in Journal
A Secret Key Classification Framework of Symmetric Encryption Algorithm Based on Deep Transfer Learning
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

The Recommendation Algorithm Based on Improved Conditional Variational Autoencoder and Constrained Probabilistic Matrix Factorization

1
School of Information Engineering, East China University of Technology, Nanchang 330013, China
2
School of Software, East China University of Technology, Nanchang 330013, China
*
Author to whom correspondence should be addressed.
Appl. Sci. 2023, 13(21), 12027; https://doi.org/10.3390/app132112027
Submission received: 4 September 2023 / Revised: 19 October 2023 / Accepted: 2 November 2023 / Published: 4 November 2023

Abstract

:
An improved recommendation algorithm based on Conditional Variational Autoencoder (CVAE) and Constrained Probabilistic Matrix Factorization (CPMF) is proposed to address the issues of poor recommendation performance in traditional user-based collaborative filtering algorithms caused by data sparsity and suboptimal feature extraction. Firstly, in the data preprocessing stage, a hidden layer is added to CVAE, and random noise is introduced into the hidden layer to constrain the data features, thereby obtaining more accurate latent features and improving the model’s robustness and generative capability. Secondly, the category of items is incorporated as auxiliary information in CVAE to supervise the encoding and decoding of item data. By learning the distribution characteristics of the data, missing values in the rating data can be effectively reconstructed, thereby reducing the sparsity of the rating matrix. Subsequently, the reconstructed data is processed using CPMF, which optimizes the feature extraction performance by imposing constraints on user features. Finally, the prediction rating of a user for an item can be obtained through the matrix product of user and item feature matrices. Experimental results on the MovieLens-100K and MovieLens-1M datasets demonstrate the effectiveness and superiority of the proposed algorithm over four comparative algorithms, as it exhibits significant advantages in terms of root mean square error and mean absolute error metrics.

1. Introduction

In the current era of exponential growth in internet information, the volume of available data has increased geometrically. As users search for information, it has become challenging to efficiently and accurately access desired content. Personalized recommendation algorithms [1] leverage user behavioral data to assist users in rapidly obtaining relevant content amidst data overload [2]. Presently, personalized recommendation algorithms can be broadly categorized into three types: content-based recommendation algorithms, collaborative filtering recommendation algorithms, and hybrid recommendation algorithms. Among these, collaborative filtering recommendation algorithms, as the most widely applied recommendation technique, primarily focus on prediction and recommendation. Collaborative filtering recommendation algorithms can be further divided into item-based collaborative filtering recommendation algorithms and user-based collaborative filtering recommendation algorithms. In the item-based approach, similar items are identified and tagged, and recommendations are made to users based on items similar to those they prefer. The user-based collaborative filtering recommendation algorithm operates by recommending based on groups of similar users [3]. Leveraging historical user behavioral data features, it groups users with high similarity into clusters, enabling prediction of ratings [4].
With the rapid expansion of the user base, traditional user-based collaborative filtering recommendation algorithms have encountered challenges such as data sparsity and suboptimal feature extraction, which hinder the ability to thoroughly and comprehensively uncover user interests [5]. As a result, scholars both domestically and internationally have begun conducting research to address these issues. Salakhutdinov et al. [6] were among the first to propose a recommendation algorithm based on deep learning models. They employed a restricted Boltzmann machine model to characterize rating data. Wang et al. [7] introduced a recommendation algorithm based on deep belief networks and Probabilistic Matrix Factorization, combining learned latent features with collaborative filtering and applying them to music recommendation. Zhang et al. [8] introduced a recommendation algorithm based on deep variational matrix factorization, utilizing deep nonlinear structures to independently capture latent features of both users and items. Fo et al. [9] devised a matrix factorization algorithm based on Bernoulli distribution, leveraging the binary nature of model distribution to enhance recommendation accuracy and reliability. Chen et al. [10] proposed a joint matrix factorization algorithm based on transfer learning, which could improve the effectiveness of similarity measurement by mining latent features of users. Ma et al. [11] introduced a biased deep matrix factorization model that employed neural networks to enhance matrix factorization. Rong et al. [12] put forth a regularized least squares optimization algorithm with case-weighting, leading to improved collaborative filtering recommendation performance.
While the aforementioned recommendation algorithms have to some extent alleviated the issues of data sparsity and suboptimal feature extraction, they primarily analyze the associations between users and items based solely on user behavior information, without considering auxiliary item information [13,14,15]. Consequently, they may fall short of fully capturing users’ genuine preferences. To address this limitation, this paper introduces a recommendation algorithm based on an improved Conditional Variational Autoencoder (CVAE) and Constrained Probabilistic Matrix Factorization (CPMF). Firstly, enhancements are made to the CVAE by adding latent layers and introducing random noise to these layers, thereby constraining the data features. This augmentation improves the model’s robustness against interference and enhances its generative capabilities. Secondly, the CVAE incorporates item categories as auxiliary information for supervising the encoding and decoding of item data. By learning the distribution characteristics of data, it reconstructs missing values in rating data, effectively reducing data sparsity. Subsequently, the CPMF algorithm constrains user features, optimizing the feature extraction process. The stochastic gradient descent algorithm is employed for parameter updates. Finally, the product of user and item feature matrices yields predicted ratings.
The experimental results indicate that the proposed algorithm effectively addresses the challenges of data sparsity and suboptimal feature extraction, leading to a significant improvement in recommendation performance.
The main contributions of this paper are as follows:
(1)
Proposing a recommendation algorithm based on an improved CVAE and CPMF, which effectively addresses the issues of poor recommendation performance in traditional user-based collaborative filtering recommendation algorithms due to data rating sparsity and suboptimal feature extraction.
(2)
Enhancements are made to the CVAE. In addition to the existing structure, latent layers are incorporated, and random noise is introduced into these layers. Processing input data through these latent layers yields more precise implicit features, thereby enhancing the model’s resilience to interference and its generative capabilities. Furthermore, the CVAE incorporates item categories as auxiliary information for supervising the encoding and decoding of item data. By learning the distribution characteristics of data, it effectively reconstructs missing values in rating data, reducing data sparsity. The reconstructed data is subsequently subjected to CPMF to extract implicit rating features of users and items, optimizing the feature extraction process.
(3)
MovieLens-100K and MovieLens-1M datasets are selected for experimental evaluation. Four comparative algorithms are chosen, and the proposed algorithm is compared to them using the same dataset. The comparison results reveal that the proposed algorithm reduces the Root Mean Square Error (RMSE) by 2.26%, 3.30%, 2.57%, and 5.12%, and the Mean Absolute Error (MAE) by 2.63%, 3.66%, 2.53%, and 5.33% respectively. In the MovieLens-1M dataset, RMSE is reduced by 4.39%, 5.49%, 4.22%, and 5.99%, and MAE is reduced by 3.28%, 4.17%, 3.08%, and 5.97%, respectively.

2. Correlation Algorithm

2.1. User-Based Collaborative Filtering Recommendation

User-based collaborative filtering is a prevalent recommendation algorithm within the field of recommender systems. This approach aims to predict items of potential interest to a user by leveraging the historical behaviors and preferences of other users who exhibit similar interests. The fundamental principle revolves around the notion that if two users have demonstrated similar preferences or purchases for items in the past, they are likely to share similar preferences for other items in the future [16].
The algorithm entails the following key steps:
(1)
Construction of User-Item Matrix
The establishment of a rating matrix can be initiated through the historical ratings provided by users. Assuming a set of users as U = {u1, u2, …, um}, and a set of items as I = {i1, i2, …, in}, the rating matrix is denoted as Rm,n, as illustrated in Equation (1), where ri,j represents the rating given by customer i to item j.
R m , n = [ r 1 , 1 r 1 , 2 r 1 , j r 1 , n r 2 , 1 r 2 , 2 r 2 , j r 2 , n r i , 1 r i , 2 r i , j r i , n r m , 1 r m , 2 r m , j r m , n ]
(2)
Calculation of User Similarity
The user-based collaborative filtering (U-CF) approach recommends items among users with similar historical ratings by analyzing the extent of their similarity. It employs the Pearson correlation coefficient as the metric for assessing similarity, which is used to delineate the likeness between users. Let ru denote the rating vector of user u, defined as ru = {ru,1, ru,2, …, ru,n}. The Pearson correlation coefficient between users u and v is depicted by Equation (2):
s i m ( u , v ) = i S ( r u , i r ¯ u ) ( r v , i r ¯ v ) i S ( r u , i r ¯ u ) 2 i S ( r v , i r ¯ v ) 2
where S represents the set of items for which both users u and v have given ratings. The variables ru,i and rv,i, respectively, denote the ratings provided by users u and v for item i, while r ¯ u and r ¯ v indicate the average ratings given by users u and v.
(3)
Identifying Nearest Neighbors
For the target user, calculate the similarity with other users using Equation (2), and subsequently select users with higher similarity scores as the nearest neighbors.
(4)
Predict Ratings and Generate Recommendations
Compute the final predicted ratings based on the nearest neighbors and the target user’s ratings, and generate recommendations according to the obtained predicted ratings. The formula for calculating predicted ratings is as follows:
P u , i = r ¯ u + n N u s i m ( u , n ) × ( r n , u r ¯ n ) n N u s i m ( u , n )
where Nu denotes the nearest neighbors of user u, r ¯ u represents the rating mean of user u, and rn signifies the rating mean of the nearest neighbors of user u.

2.2. Autoencoder

The autoencoder [17,18,19,20] is an unsupervised learning neural network. It leverages the backpropagation algorithm along with optimization techniques like gradient descent to learn the mapping between input x and its corresponding reconstructed output x′.
This model consists of two primary components: the encoder and the decoder. The encoder converts high-dimensional input data x into latent space variables h, which are encoded representations. The decoder reconstructs the latent space variables h back into the original dimensions of the output x′, which is an approximation of the input. A well-performing autoencoder will yield a reconstructed output x′ that closely resembles the original input x. The principle is illustrated in Figure 1.
The objective of an autoencoder is to train a network to learn data features and reproduce the original input as faithfully as possible. Leveraging this characteristic, autoencoders can be applied to rating prediction within recommendation systems. Consider a scenario with a sparse rating matrix R. Treating R as the input, it undergoes encoding to transform it into a latent space representation. The transition from the hidden layer to the output layer is executed by the decoder, which reconstructs the input from the latent space representation. Notably, autoencoders possess the property of having input and output dimensions equal, and they learn to reconstruct a user’s ratings using the acquired latent space representation.
This utilization of autoencoders proves beneficial in tackling the issue of sparse data in recommendation systems, as they can effectively learn meaningful latent representations from the input data and aid in accurate rating predictions.
The basic form of an autoencoder is as follows; where f(x) represents the encoding function and g(x) represents the decoding function:
x f ( x ) h g ( x ) x
During the training process, the constraint conditions are:
x x
To ensure that the input and output of the autoencoder closely match, it is imperative to define a loss function:
x = g ( f ( x ) )

2.3. Matrix Factorization

Matrix factorization [21,22,23,24,25] is based on the concept of introducing implicit features onto the foundation of a “co-occurrence matrix”. It translates the user-item rating matrix into implicit user ratings and implicit item ratings, ultimately yielding the final rating through a combination of these implicit ratings. This approach enhances the capability to handle data sparsity effectively.
The fundamental principle of matrix factorization algorithms involves transforming the rating matrix into two sparsely interacting low-dimensional matrices, corresponding to latent rating features of users and items, represented as M = UTV. Where M, U, and V, respectively, denote the rating matrix, implicit user rating matrix, and implicit item rating matrix. The matrix factorization model diagram is depicted in Figure 2.
The prediction of a user’s rating for a specific item is derived from the interaction between the user’s latent rating features and the latent rating features of the corresponding item. For instance, consider that the latent rating vector for user u after factorization is u = [1, 1, 2], and the latent rating vector for item v is v = [1, 0, 1]T. The three features of the user u signify preferences for action, romance, and comedy genres, respectively. The item vector v indicates that the movie has an action component of magnitude 1, no romance component (magnitude 0), and a comedy component of magnitude 1. The user’s predicted rating for the item is obtained by taking the inner product of these vectors, that is, u·v = 2.
Utilizing the feature vectors of users and items for rating prediction enables the attainment of enhanced prediction accuracy and concurrently mitigates the adverse impact of data sparsity.

3. Methodology

This paper introduces a recommendation algorithm based on an improved Conditional Variational Autoencoder and Constrained Probabilistic Matrix Factorization. The recommendation process is shown in Figure 3.
Firstly, enhancements are made to the CVAE. A hidden layer is added on top of the CVAE architecture, and random noise is introduced into the hidden layer to provide constraints. This serves to enhance both the model’s resilience against interference and its generative capabilities.
Secondly, CVAE incorporates item categories as auxiliary information to supervise the encoding and decoding of project data. This utilization of category information enables the reconstruction of missing values in the rating data, effectively reducing the sparsity of the rating matrix.
Subsequently, the reconstructed data is subjected to the CPMF algorithm. This step involves mining the latent implicit rating features of users and items, thus optimizing the process of feature extraction.
Finally, the multiplication of user and item feature matrices yields the predicted ratings for users and projects, thereby accomplishing the objective of project recommendation.

3.1. Improved Data Reconstruction for CVAE

The Improved CVAE introduces external auxiliary information into the encoding and decoding layers of the Variational Autoencoder (VAE) to supervise the encoding and decoding of item data. By reconstructing missing values in the rating data, it effectively reduces the sparsity of the rating matrix. The processing through latent layers enhances the efficiency of guiding sample outputs. The improved CVAE model is illustrated in Figure 4.
In the description provided:
X represents the original input data.
hhid represents the newly added latent layer.
Y represents the data processed through the latent layers.
hinf represents the inference neural network of the encoding stage’s latent space.
μ and ρ represent the mean and variance of the latent space distribution.
z represents the implicit representation of input data in the latent space layer.
hgen represents the neural network guiding the output of new samples in the decoding stage.
Y′ represents the output data processed by the model.
c represents the auxiliary information of selecting item categories to guide the encoding and decoding networks.
In this study, a latent layer is introduced before the encoding layer of the CVAE, and random noise is injected into the latent layer to enhance the model’s resistance to interference. By processing input data through this latent layer, more accurate implicit features can be obtained, thereby further improving the model’s generative capabilities. Assuming the input variable is denoted as x and xX, the transformed data y is obtained through processing x in the latent layer. Formula (7) represents the processing function of the latent layer:
J θ ( y | x ) = f ( y ; x , θ )
where f represents the sigmoid non-linear transformation function, and θ stands for the parameters of the encoder, representing random noise.
During the training phase of CVAE, q ϕ ( z y , c ) denotes the probability distribution of z in the learned latent space, while p θ ( z y , c ) represents the implicit probability distribution of z in CVAE, referred to as the “posterior probability.” The Kullback-Leibler (KL) divergence is employed as a metric to quantify the similarity between the two distributions, which can be expressed as follows:
D K L ( q ϕ ( z | y , c ) | | p θ ( z | y , c ) ) = E q ρ ( z | y , c ) log q ϕ ( z | y , c ) p θ ( z | y , c ) = E q ρ ( z | y , c ) log q ϕ ( z | y , c ) p θ ( z , y , c ) + E q ρ ( z | y , c ) log p θ ( y , c ) = E q ρ ( z | y , c ) ( log q ϕ ( z | y , c ) p θ ( z , y , c ) + log p θ ( y , c ) )
where D K L q ϕ ( z y , c ) p θ ( z y , c ) represents the relative entropy between the approximate distribution and the posterior probability. D K L q ϕ ( z y , c ) p θ ( z y , c ) smaller relative entropy indicates a closer approximation between the distribution q ϕ ( z y , c ) and posterior probability p θ ( z y , c ) . To generate authentic samples, it is necessary to maximize the probability of output samples and minimize the relative entropy. Therefore, the following conditions apply:
L ( θ , ϕ , y , c ) = E q ρ ( z | y , c ) log q ϕ ( z | y , c ) p θ ( z , y , c ) = E q ρ ( z | y , c ) log p θ ( z , y , c ) E q ϕ ( z | y , c ) log q ϕ ( z | y , c ) = E q ρ ( z | y , c ) log p θ ( y | z , c ) + E q ϕ ( z | y , c ) log p θ ( z , c ) E q ρ ( z | y , c ) log q ϕ ( z | y , c ) = E q θ ( z | y , c ) log p θ ( y | z , c ) D K L ( q ϕ ( z | y , c ) | | p θ ( z , c ) )
where L ( θ , ϕ , y , c ) represents the variational lower bound of CVAE. When the variational lower bound is maximized, the value of D K L q ϕ ( z y , c ) p θ ( z y , c ) is minimized. Therefore, L ( θ , ϕ , y , c ) is utilized as the optimization objective for training CVAE.

3.2. CPMF

When dealing with sparse rating matrices, the features of users with fewer ratings tend to approach the prior mean, resulting in predicted ratings gravitating toward the average value. Therefore, in this study, CPMF is employed to handle sparse matrices and impose constraints on users with fewer ratings. This approach effectively enhances prediction accuracy and optimizes feature extraction outcomes. The model diagram of CPMF is illustrated in Figure 5.
Where:
M represents the interaction matrix generated between users and items.
U signifies the matrix of implicit space features for users.
V signifies the matrix of implicit space features for items.
W is the user constraint matrix.
I represents user rating information.
Y signifies the user compensation matrix.
Initially, the constraint matrix W enforces constraints on user features based on user rating information. This is followed by the combination, with the compensation matrix Y to derive the matrix of implicit space features for users, U. Ultimately, the user’s implicit space feature matrix U, and the item’s implicit space feature matrix V, collaborate to generate the interaction matrix M between users and items.
Given N users and G items, along with the interaction matrix M~N × G, with user and item implicit rating dimensions of D, M = UTV represents the inner product of users and items in the implicit space. The latent space feature vector for user i can be represented as:
U i = Y i + k = 1 G I i k W k k = 1 G I i k
where Iik is the indicator function, taking the value 1 when user i has rated item k, and 0 otherwise.
Assuming the observation matrix M and the approximate rating matrix M′ follow Gaussian distributions with a mean of 0, the conditional distribution of the rating matrix is given by:
p ( M | Y , V , W , σ 2 ) = i = 1 N j = 1 G [ N ( M i j | g ( [ Y i + k = 1 G I i k W k k = 1 G I i k ] T V j , σ 2 ) ] I i j
Assuming that the latent feature vectors of an item, user compensation matrices, and user constraint matrix also follow Gaussian distributions with a mean of 0, we have:
p ( V | σ V 2 ) = j = 1 G N ( V j | 0 , σ j 2 I )
p ( Y | σ Y 2 ) = i = 1 N N ( Y i | 0 , σ i 2 I )
p ( W | σ W 2 ) = k = 1 G N ( W k | 0 , σ k 2 I )
Based on the objective function formula of Probabilistic Matrix Factorization [26], the loss function of CPMF can be derived as follows:
J = 1 2 i = 1 N j = 1 G I i j ( M i j g ( [ Y i + k = 1 G I i k W k k = 1 G I i k ] T V j ) ) 2 + λ Y 2 i = 1 N | | Y i | | F r o 2 + λ V 2 j = 1 G | | V j | | F r o 2 + λ W 2 k = 1 G | | W k | | F r o 2
where g(x) = 1/(1 + ex), λY = σ2/ σ Y 2 , λV = σ2/ σ V 2 , λW = σ2/ σ W 2 , Fro representative | | x | | Fro 2  = XTX.
Training is carried out using the stochastic gradient descent optimization algorithm [27] until convergence or reaching the maximum number of training iterations. The process is outlined as follows:
First, compute the negative gradient of the loss function:
J Y i = ( M i j g i j ) g i j V j + λ Y Y i   = e i j g i j V j + λ Y Y i
J V j = ( M i j g i j ) g i j U i + λ Q V j   = e i j g i j U i + λ Q V j
J W k = ( M i j g i j ) g i j k = 1 G I i k V j + λ W W k     = e i j g i j k = 1 G I i k V j + λ W W k
where U i = Y i + k = 1 G I i k W k k = 1 G I i k , g i j = g U i T V j . Then, update the variables based on the change in the negative gradient:
Y i = Y i η J Y i = Y i + η ( e i j g i j V j λ Y Y i )
V j = V j η J V j = V j + η ( e i j g i j U i λ Q V j )
W k = W k η J W k = W k + η ( e i j g i j k = 1 G I i k Y j λ W W k )
where η denotes the learning rate. The assessment of the user-item matrix is accomplished by forecasting scores using the matrix product formulation M = UTV.

3.3. Algorithm Flow

The algorithm presented in this study takes raw user ratings as input and generates predicted ratings as output. The detailed algorithmic steps are described as follows:
Input: Target user i, user rating matrix M.
Output: Predicted ratings for target user i.
Step 1: Incorporate the rating variable x from matrix M into the hidden layer processing of Equation (7), introducing random noise for constraint. This yields transformed data y.
Step 2: Introduce the category of items, denoted as c, as auxiliary information in CVAE. This supervises the encoding and decoding of item data. Input the transformed data y into the improved encoding part of CVAE for training. Obtain the probability distribution of latent space z and express its Kullback-Leibler (KL) divergence with the posterior probability using Equation (8). To maximize the output sample probability and minimize KL divergence, the modified CVAE training loss function is derived, as shown in Equation (9).
Step 3: Decode through the decoding part of CVAE to reconstruct missing values of rating data, ultimately obtaining the reconstructed rating matrix M2.
Step 4: Initialize the user compensation matrix Y, constraint matrix W, and project latent space feature matrix V based on the reconstructed matrix M2.
Step 5: Assuming that the observed matrix M2 and the approximated rating matrix M2′ follow Gaussian distributions with mean 0, the conditional distribution of the rating matrix is expressed in Equation (11).
Step 6: Based on the objective function of Probabilistic Matrix Factorization [26], the loss function of CPMF is derived, as presented in Equation (15).
Step 7: Employ stochastic gradient optimization algorithm for training. First, compute the negative gradient of the loss function according to Equations (16)–(18). Then, update the variables based on the gradient change, as depicted in Equations (19)–(21).
Step 8: Halt training when the maximum number of iterations is reached or the loss function value stabilizes. Ultimately, derive user latent space feature matrix U and item latent space feature matrix V. Output the final user-item rating matrix M3 using the formulation M = UTV.

4. Experiment and Analysis

4.1. Experimental Data

The methodology presented in this study is evaluated using the MovieLens-100K and MovieLens-1M datasets. MovieLens-100K dataset comprises 100,000 ratings provided by 943 users for 1682 movies. MovieLens-1M dataset comprises 993,482 ratings provided by 6040 users for 3544 movies. The training and testing sets are divided into an 8:2 ratio. The movie data includes movie IDs, titles, and categories such as Action, Adventure, and others. The ratings in the dataset range from 1 to 5. Table 1 presents pertinent details about the dataset.

4.2. Evaluation Index

This study employs the Root Mean Square Error (RMSE) and Mean Absolute Error (MAE) metrics to assess the quality of the recommendation effectiveness. Both metrics are utilized to quantify the disparities between predicted ratings and actual ratings. Lower MAE and RMSE values indicate better recommendation performance. Assuming the user’s actual ratings are denoted as Q = {q1, q2, …, qn} and the predicted ratings are R = {r1, r2, …, rn}, the formulas for calculating MAE and RMSE are as follows:
M A E = 1 N i = 1 N | q i r i |
R M S E = 1 N i = 1 N ( q i r i ) 2

4.3. Experimental Results and Analysis

Initially, the parameters required for the improved CVAE are selected. Figure 6 and Figure 7 illustrate the curve of RMSE results for different epochs (training iterations) during the training process in MovieLens-100K and MovieLens-1M datasets.
Where epoch stands for the number of iterations, it is observed that as the number of epochs increases, the RMSE of the improved CVAE gradually decreases. The optimal performance is achieved when the epoch reaches 180 in MovieLens-100K. However, 140 achieves the optimum in MovieLens-1M. Therefore, the optimal number of epochs for the improved CVAE model is determined to be 180 and 140.
Upon obtaining the reconstructed matrix using the improved CVAE, the CPMF matrix factorization is applied. Initially, various numbers of implicit rating factors are chosen to train the model. Figure 8, Figure 9, Figure 10 and Figure 11 display the RMSE and MAE values for different numbers of implicit rating factors in different datasets.
From Figure 8 and Figure 10, implicit factors represent the dimensions of the matrix factorization, it can be inferred that as the number of implicit factors increases, the training outcomes stabilize. The optimal points for both RMSE and MAE are found to be 40 in MovieLens-100K. However, it can be seen from Figure 9 and Figure 11 that the optimal point is 15 in MovieLens-1M.
Then, the RMSE and MAE values of the algorithm were tested under different λY, λV, and λW. λY, λV, λW represent the regularization parameters of CPMF.
Figure 12, Figure 13, Figure 14 and Figure 15 show that the RMSE and MAE curves gradually decrease as λ increases and reach the optimal value after reaching 10 in both datasets. Thus, it is determined that the optimal values of λY, λV, and λW are all 10, which indicates the best experimental performance.
Lastly, to demonstrate the effectiveness of the proposed model in this study, four comparative algorithms are selected for evaluation: the Probabilistic Matrix Factorization (PMF) model proposed by Salakhutdinov et al. [26], Collaborative Deep Learning (CDL) recommended by Wang et al. [28], the Hybrid Deep Probabilistic Model (PHD) introduced by Liu et al. [29], and the Collaborative Topic Regression (CTR) model combining PMF proposed by Wang et al. [30]. These algorithms are compared against the proposed model using the MovieLens-100K and MovieLens-1M datasets. The experimental results are presented in Figure 16, Figure 17, Figure 18 and Figure 19. Several experiments were performed and the average value was taken as the final result of RMSE and MAE, as shown in Table 2 and Table 3.
It is evident that in MovieLens-100K, the proposed model in this study reaches convergence at an epoch of 20. Compared to CDL, CTR, PHD, and PMF, the proposed model achieves reductions of 2.26%, 3.30%, 2.57%, and 5.12% in RMSE, respectively. Additionally, the proposed model achieves reductions of 2.63%, 3.66%, 2.53%, and 5.33% in MAE, respectively. In MovieLens-1M, the proposed model reaches convergence at 30 iterations. Compared with CDL, CTR, PHD, and PMF, the RMSE of the proposed model is reduced by 4.39%, 5.49%, 4.22%, and 5.99%, respectively. MAE decreased by 3.28%, 4.17%, 3.08%, and 5.97%, respectively. The final convergence results for RMSE and MAE indicate that the proposed model outperforms other algorithms significantly.
Experimental results show that compared with the selected algorithms, the proposed model has significant improvement in RMSE and MAE values, which can effectively improve the recommendation performance.

5. Conclusions

This paper introduces a recommendation algorithm based on an improved Conditional Variational Autoencoder (CVAE) and Constrained Probabilistic Matrix Factorization (CPMF). In this algorithm, a hidden layer is added on top of the CVAE architecture, and random noise is introduced into the hidden layer to enhance the model’s robustness against interference. The processing of item data through the hidden layer further enhances the model’s generative capability. Additionally, CVAE incorporates item categories as auxiliary information to supervise the encoding and decoding of project data. By learning the distribution features of the data, the algorithm reconstructs missing values in the rating data, effectively mitigating data sparsity.
Furthermore, the reconstructed data is subjected to the CPMF algorithm to optimize feature extraction by mining the latent implicit rating features of users and items. Finally, the predicted ratings are obtained through the multiplication of user and item feature matrices. Experimental validation is conducted on the MovieLens-100K and MovieLens-1M datasets, and a comparison is made against four alternative algorithms. The experimental results demonstrate the superior recommendation performance of the proposed algorithm. This indicates that the proposed algorithm effectively addresses the issues of poor recommendation performance often encountered in traditional user-based collaborative filtering algorithms due to data sparsity and suboptimal feature extraction.
However, it is worth noting that the current algorithm utilizes a singular auxiliary information source to guide item outputs. In future research, the incorporation of multiple auxiliary information sources, such as knowledge graphs, attention mechanisms, and social networks, could be explored to enhance user and item features and further elevate recommendation performance.

Author Contributions

Writing—original draft, Y.Z.; Writing—review & editing, H.X. and X.Y. All authors have read and agreed to the published version of the manuscript.

Funding

This work is supported by the Fuzhou Talent Program of Jiangxi Province (2021ED008), and Jiangxi Key Laboratory of Cyberspace Security Intelligent Perception (JKLCIP202202).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Publicly available datasets were analyzed in this study. This data can be found here: [https://grouplens.org/datasets/movielens/].

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Wu, Z.; Tang, Y.; Liu, H. Survey of personalized learning recommendation. J. Front. Comput. Sci. Technol. 2022, 16, 21. [Google Scholar]
  2. Awan, M.J.; Khan, R.A.; Nobanee, H.; Yasin, A.; Anwar, S.M.; Naseem, U.; Singh, V.P. A recommendation engine for predicting movie ratings using a big data approach. Electronics 2021, 10, 1215. [Google Scholar] [CrossRef]
  3. Yimu, J.; Ke, L.; Shangdong, L.; Qiang, L.; Haichang, Y.; Kui, L. Collaborative filtering recommendation algorithm based on interactive data classification. J. China Univ. Posts Telecommun. 2020, 27, 1. [Google Scholar]
  4. Goyani, M.; Chaurasiya, N. A review of movie recommendation system: Limitations, Survey and Challenges. ELCVIA Electron. Lett. Comput. Vis. Image Anal. 2020, 19, 0018–0037. [Google Scholar]
  5. Qian, Z.; Yang, J.; Li, D.; Ye, Z. Event Recommendation Strategy Combining User Long-Short Term Interest and Event Influence. J. Comput. Res. Dev. 2022, 59, 2803–2815. [Google Scholar]
  6. Salakhutdinov, R.; Mnih, A.; Hinton, G. Restricted Boltzmann machines for collaborative filtering. In Proceedings of the 24th International Conference on Machine Learning, Corvalis, OR, USA, 20–24 June 2007; ACM: New York, NY, USA, 2007; pp. 791–798. [Google Scholar]
  7. Wang, X.; Wang, Y. Improving content-based and hybrid music recommendation using deep learning. In Proceedings of the 22nd ACM International Conference on Multimedia, Kaohsiung, Taiwan, 8–10 December 2014; ACM: New York, NY, USA, 2014; pp. 627–636. [Google Scholar]
  8. Zhang, W.; Zhang, X.; Wang, H.; Chen, D. A deep variational matrix factorization method for recommendation on large scale sparse dataset. Neurocomputing 2019, 334, 206–218. [Google Scholar] [CrossRef]
  9. Ortega, F.; Lara-Cabrera, R.; González-Prieto, Á.; Bobadilla, J. Providing reliability in recommender systems through Bernoulli matrix factorization. Inf. Sci. 2021, 553, 110–128. [Google Scholar] [CrossRef]
  10. Chen, J.; Zhu, Y.; Zhou, G.; Cui, L.; Wu, S. Collaborative filtering recommendation based on transfer learning and joint matrix decomposition. J. Sichuan Univ. (Nat. Sci. Ed.) 2020, 57, 1096–1102. [Google Scholar]
  11. Ma, C.; Li, J.; Pan, P.; Li, G.; Du, J. BDMF: A Biased Deep Matrix Factorization Model for Recommendation. In Proceedings of the 2019 IEEE SmartWorld, Ubiquitous Intelligence & Computing, Advanced & Trusted Computing, Scalable Computing & Communications, Cloud & Big Data Computing, Internet of People and Smart City Innovation (SmartWorld/SCALCOM/UIC/ATC/CBDCom/IOP/SCI), Leicester, UK, 19–23 August 2019; IEEE: Piscataway, NJ, USA, 2019; pp. 1039–1045. [Google Scholar]
  12. Rong, P.; Zhou, Y.; Cao, B.; Liu, N.N.; Lukose, R.; Scholz, M.; Yang, Q. One-class collaborative filtering. In Proceedings of the 2008 Eighth IEEE International Conference on Data Mining, Pisa, Italy, 15–19 December 2008; IEEE: Piscataway, NJ, USA, 2008; pp. 502–511. [Google Scholar]
  13. Wu, Y.; Dubois, C.; Zheng, A.X.; Ester, M. Collaborative Denoising Auto-Encoders for Top-N Recommender Systems. In Proceedings of the Ninth ACM International Conference on Web Search and Data Mining, San Francisco, CA, USA, 22–25 February 2016; ACM: New York, NY, USA, 2016; pp. 153–162. [Google Scholar]
  14. Li, X.; She, J. Collaborative variational autoencoder for recommender systems. In Proceedings of the 23rd ACM SIGKDD Internationalconference on Knowledge Discovery and Data Mining, Halifax, NS, Canada, 13–17 August 2017; ACM: New York, NY, USA, 2017; pp. 305–314. [Google Scholar]
  15. Chen, Y.; Rijke, M.D. Top-N Recommendation with High-Dimensional Side Information via Locality Preserving Projection. In Proceedings of the 40th International ACM SIGIR Conference on Research and Development in Information Retrieval, Tokyo, Japan, 7–11 August 2017; ACM: New York, NY, USA, 2017; pp. 985–988. [Google Scholar]
  16. Na, L.; Ming-Xia, L.; Hai-Yang, Q.; Hao-Long, S. A hybrid user-based collaborative filtering algorithm with topic model. Appl. Intell. 2021, 51, 7946–7959. [Google Scholar] [CrossRef]
  17. Bank, D.; Koenigstein, N.; Giryes, R. Autoencoders. In Machine Learning for Data Science Handbook: Data Mining and Knowledge Discovery Handbook; Springer: Berlin/Heidelberg, Germany, 2023; pp. 353–374. [Google Scholar]
  18. Pan, Y.; He, F.; Yu, H. Learning social representations with deep autoencoder for recommender system. World Wide Web 2020, 23, 2259–2279. [Google Scholar] [CrossRef]
  19. Niu, Y.; Su, Y.; Li, S.; Wan, S.; Cao, X. Deep adversarial autoencoder recommendation algorithm based on group influence. Inf. Fusion 2023, 100, 101903. [Google Scholar] [CrossRef]
  20. Tahmasebi, H.; Ravanmehr, R.; Mohamadrezaei, R. Social movie recommender system based on deep autoencoder network using Twitter data. Neural Comput. Appl. 2021, 33, 1607–1623. [Google Scholar] [CrossRef]
  21. Wang, H.; Hong, Z.; Hong, M. Research on product recommendation based on matrix factorization models fusing user reviews. Appl. Soft Comput. 2022, 123, 108971. [Google Scholar] [CrossRef]
  22. Liu, N.; Zhao, J. Recommendation system based on deep sentiment analysis and matrix factorization. IEEE Access 2023, 11, 16994–17001. [Google Scholar] [CrossRef]
  23. Zheng, X.; Guan, M.; Jia, X.; Guo, L.; Luo, Y. A Matrix Factorization Recommendation System-Based Local Differential Privacy for Protecting Users’ Sensitive Data. IEEE Trans. Comput. Soc. Syst. 2022, 10, 1189–1198. [Google Scholar] [CrossRef]
  24. Bin, S.; Sun, G. Matrix factorization recommendation algorithm based on multiple social relationships. Math. Probl. Eng. 2021, 2021, 6610645. [Google Scholar] [CrossRef]
  25. Zhang, H.; Ganchev, I.; Nikolov, N.S.; Ji, Z.; O’Droma, M. FeatureMF: An item feature enriched matrix factorization model for item recommendation. IEEE Access 2021, 9, 65266–65276. [Google Scholar] [CrossRef]
  26. Salakhutdinov, R.; Mnih, A. Probabilistic matrix factorization. Adv. Neural Inf. Process. Syst. 2008, 1257-1264. [Google Scholar]
  27. Shi, J.; Wang, D.; Shang, F.; Zhang, H.Y. Research Advances on Stochastic Gradient Descent Algorithms. Acta Autom. Sin. 2021, 47, 2103–2119. [Google Scholar]
  28. Wang, H.; Wang, N.; Yeung, D.Y. Collaborative deep learning for recommender systems. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, Sydney, Australia, 10–13 August 2015; ACM: New York, NY, USA, 2015; pp. 1235–1244. [Google Scholar]
  29. Liu, J.; Wang, D.; Ding, Y. PHD: A Probabilistic Model of Hybrid Deep Collaborative Filtering for Recommender Systems. In Proceedings of the Asian Conference on Machine Learning, Seoul, Republic of Korea, 15–17 November 2017; PMLR: New York, NY, USA, 2017; pp. 224–239. [Google Scholar]
  30. Wang, C.; Blei, D.M. Collaborative Topic Modeling for Recommending Scientific Articles. In Proceedings of the 17th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Diego, CA, USA, 21–24 August 2011; ACM: New York, NY, USA, 2011; pp. 448–456. [Google Scholar]
Figure 1. Autoencoder model.
Figure 1. Autoencoder model.
Applsci 13 12027 g001
Figure 2. Matrix factorization model.
Figure 2. Matrix factorization model.
Applsci 13 12027 g002
Figure 3. Recommendation process.
Figure 3. Recommendation process.
Applsci 13 12027 g003
Figure 4. Improved CVAE model.
Figure 4. Improved CVAE model.
Applsci 13 12027 g004
Figure 5. CPMF model.
Figure 5. CPMF model.
Applsci 13 12027 g005
Figure 6. RMSE values under different epochs in MovieLens-100K.
Figure 6. RMSE values under different epochs in MovieLens-100K.
Applsci 13 12027 g006
Figure 7. RMSE values under different epochs in MovieLens-1M.
Figure 7. RMSE values under different epochs in MovieLens-1M.
Applsci 13 12027 g007
Figure 8. RMSE values for different numbers of implicit factors in MovieLens-100K.
Figure 8. RMSE values for different numbers of implicit factors in MovieLens-100K.
Applsci 13 12027 g008
Figure 9. RMSE values for different numbers of implicit factors in MovieLens-1M.
Figure 9. RMSE values for different numbers of implicit factors in MovieLens-1M.
Applsci 13 12027 g009
Figure 10. MAE values for different numbers of implicit factors in MovieLens-100K.
Figure 10. MAE values for different numbers of implicit factors in MovieLens-100K.
Applsci 13 12027 g010
Figure 11. MAE values for different numbers of implicit factors in MovieLens-1M.
Figure 11. MAE values for different numbers of implicit factors in MovieLens-1M.
Applsci 13 12027 g011
Figure 12. RMSE values for different values of λ in MovieLens-100K.
Figure 12. RMSE values for different values of λ in MovieLens-100K.
Applsci 13 12027 g012
Figure 13. RMSE values for different values of λ in MovieLens-1M.
Figure 13. RMSE values for different values of λ in MovieLens-1M.
Applsci 13 12027 g013
Figure 14. MAE values for different values of λ in MovieLens-100K.
Figure 14. MAE values for different values of λ in MovieLens-100K.
Applsci 13 12027 g014
Figure 15. MAE values for different values of λ in MovieLens-1M.
Figure 15. MAE values for different values of λ in MovieLens-1M.
Applsci 13 12027 g015
Figure 16. RMSE values of each algorithm in different epochs in MovieLens-100K.
Figure 16. RMSE values of each algorithm in different epochs in MovieLens-100K.
Applsci 13 12027 g016
Figure 17. RMSE values of each algorithm in different epochs in MovieLens-1M.
Figure 17. RMSE values of each algorithm in different epochs in MovieLens-1M.
Applsci 13 12027 g017
Figure 18. MAE values of each algorithm in different epochs in MovieLens-100K.
Figure 18. MAE values of each algorithm in different epochs in MovieLens-100K.
Applsci 13 12027 g018
Figure 19. MAE values of each algorithm in different epochs in MovieLens-1M.
Figure 19. MAE values of each algorithm in different epochs in MovieLens-1M.
Applsci 13 12027 g019
Table 1. MovieLens100K and MovieLens-1M datasets.
Table 1. MovieLens100K and MovieLens-1M datasets.
Dataset InformationMovieLens-100KMovieLens-1M
Number of users9436040
Number of movies16823544
Movie Categoriesunknown|Action|Adventure|Animation|Children’s|Comedy|Crime|Documentary…
Range of ratings1~5
Rating items100,000993,482
Table 2. Results of Different Methods in MovieLens-100K.
Table 2. Results of Different Methods in MovieLens-100K.
Comparison MethodRMSEMAE
CDL0.92340.7485
CTR0.93380.7588
PHD0.92650.7475
PMF0.95200.7755
This Paper0.90080.7222
Table 3. Results of Different Methods in MovieLens-1M.
Table 3. Results of Different Methods in MovieLens-1M.
Comparison MethodRMSEMAE
CDL0.89220.7183
CTR0.90320.7272
PHD0.89050.7163
PMF0.90820.7452
This Paper0.84830.6855
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Zhang, Y.; Xu, H.; Yu, X. The Recommendation Algorithm Based on Improved Conditional Variational Autoencoder and Constrained Probabilistic Matrix Factorization. Appl. Sci. 2023, 13, 12027. https://doi.org/10.3390/app132112027

AMA Style

Zhang Y, Xu H, Yu X. The Recommendation Algorithm Based on Improved Conditional Variational Autoencoder and Constrained Probabilistic Matrix Factorization. Applied Sciences. 2023; 13(21):12027. https://doi.org/10.3390/app132112027

Chicago/Turabian Style

Zhang, Yunfei, Hongzhen Xu, and Xiaojun Yu. 2023. "The Recommendation Algorithm Based on Improved Conditional Variational Autoencoder and Constrained Probabilistic Matrix Factorization" Applied Sciences 13, no. 21: 12027. https://doi.org/10.3390/app132112027

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop