## 3 Methodology
### 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.  
Figure 3: Recommendation process. In the description provided:  
\(X\) represents the original input data. \(h_{hid}\) represents the newly added latent layer. \(Y\) represents the data processed through the latent layers. \(h_{inf}\) represents the inference neural network of the encoding stage's latent space. \(\mu\) and \(\rho\) represent the mean and variance of the latent space distribution. \(z\) represents the implicit representation of input data in the latent space layer. \(h_{gen}\) represents the neural network guiding the output of new samples in the decoding stage. \(Y^{\prime}\) 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 \(x\in X\), the transformed data \(y\) is obtained through processing \(x\) in the latent layer. Formula (7) represents the processing function of the latent layer:  
\[J_{\theta}(y|x)=f(y;x,\theta) \tag{7}\]  
where \(f\) represents the sigmoid non-linear transformation function, and \(\theta\) stands for the parameters of the encoder, representing random noise. During the training phase of CVAE, \(q_{\phi}(z\mid y,c)\) denotes the probability distribution of \(z\) in the learned latent space, while \(p_{\theta}(z\mid 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:  
\[ \begin{split}& D_{KL}(q_{\phi}(z|y,c)|\big{|}p_{\theta}(z|y,c))\\ &=E_{q_{\phi}(z|y,c)}\log\frac{q_{\phi}(z|y,c)}{p_{\theta}(z|y,c) }\\ &=E_{q_{\psi}(z|y,c)}\log\frac{q_{\theta}(z|y,c)}{p_{\theta}(z|y,c )}+E_{q_{\psi}(z|y,c)}\log p_{\theta}(y,c)\\ &=E_{q_{\psi}(z|y,c)}(\log\frac{q_{\psi}(z|y,c)}{p_{\theta}(z|y, c)}+\log p_{\theta}(y,c))\end{split}  \tag{8}\]  
Figure 4: Improved CVAE model. where \(D_{KL}\big{(}q_{\phi}(z\mid y,c)\parallel p_{\theta}(z\mid y,c)\big{)}\) represents the relative entropy between the approximate distribution and the posterior probability. \(D_{KL}\big{(}q_{\phi}(z\mid y,c)\parallel p_{\theta}(z\mid y,c)\big{)}\) smaller relative entropy indicates a closer approximation between the distribution \(q_{\phi}(z\mid y,c)\) and posterior probability \(p_{\theta}(z\mid 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:  
\[ \begin{array}{l}L(\theta,\phi,y,c)=-E_{q_{\rho}(z\mid y,c)}\log\frac{q_{ \phi}(z\mid y,c)}{p_{\theta}(z,y,c)}\\ =E_{q_{\rho}(z\mid y,c)}\log p_{\theta}(z,y,c)-E_{q_{\phi}(z\mid y,c)}\log q_{ \phi}(z\mid y,c)\\ =E_{q_{\rho}(z\mid y,c)}\log p_{\theta}(y\mid z,c)+E_{q_{\phi}(z\mid y,c)}\log p _{\theta}(z,c)-E_{q_{\rho}(z\mid y,c)}\log q_{\phi}(z\mid y,c)\\ =E_{q_{\rho}(z\mid y,c)}\log p_{\theta}(y\mid z,c)-D_{KL}\big{(}q_{\phi}(z\mid y,c)||p_{\theta}(z,c)\big{)}\end{array}  \tag{9}\]  
where \(L(\theta,\phi,y,c)\) represents the variational lower bound of CVAE.