# Deep Learning-Based Context-Aware Recommender System Considering Contextual Features
## 3 Proposed Model
### Deep Learning  
Basically, our motivation is to capture the contextual features to improve the recommender system with neural networks. The newly proposed framework is illustrated in Figure 2.  
The proposed model is formed by connecting multiple AEs and NN. The input data include multiple feature vectors. The input and output data for the autoencoder (discussed in Section 3.1) include user vectors, item vectors and context vectors. The neural network is trained by using score as targets from the hidden layer in the middle. When the dataset has n (x, y) pairs, x represents the data record containing users, items and contextual dimension, and y represents the score given by the user. Each field of x is expressed as a binary vector with one-hot encoding. This is similar to that of factorization machine. In Figure 2, \(y_{uic}\) is the actual score obtained from the evaluation of item \(i\) by user \(u\) in the context \(c\), while \(\hat{y}_{uic}\) is the predicted score.  
\[\hat{y}_{uic}=\sigma\Big{(}wx^{k/2}+b\Big{)} \tag{4}\]  
Assuming the total number of layers is \(k\), then \(\hat{y}_{uic}\) can be obtained from layer \(k/2\). Also, \(x^{k/2}\) can be obtained from formula (2). To train the proposed model, there are two processes one must go through. First, as shown in Figure 2, it must minimize the difference between output's \(v_{u}^{\prime}\), \(v_{i}^{\prime}\), and \(v_{c}^{\prime}\) and input's \(v_{u}\), \(v_{i}\) and \(v_{c}\) where context which is the input data is separated as the context dimension. This process can be illustrated by formula (5).  
\[L_{AE}=\underset{\theta}{min}\ \sum_{v\in V}\|X-X^{\prime}\|^{2}+\alpha\sum_{ l}\Big{(}\|w_{AE}\|^{2}+\|b_{AE}\|^{2}\Big{)} \tag{5}\]  
To prevent overfitting, regularization terms are added in Formula (1).  
Second, using the feature obtained from formula (5), \(\hat{y}_{uic}\) is obtained. Training is performed to minimize the difference between \(y_{uic}\) and \(\hat{y}_{uic}\), as expressed as Formula (6).  
\[L_{NN}=\underset{\theta}{min}\ \sum_{y\in Y}(y_{uic}-\hat{y}_{uic})^{2}+\beta \sum_{l}\Big{(}\|w_{NN}\|^{2}+\|b_{NN}\|^{2}\Big{)} \tag{6}\]  
The newly proposed model learns by applying Formulas (5) and (6) at the same time as well as Adaptive Moment Estimation (Adam). Adam is one of the most frequently used optimization methods. The Algorithm 1 is summarized based on the above derivation.  
Figure 2: Neural Context-aware Recommender Systems.  
```
Input: User vector \(U\), Item vector \(l\), Context vector \(\mathsf{C}_{n}\), Learning rate \(N\), number of iterations \(k\) Output: parameter \(w_{AE}\), \(w_{NN},b_{AE}\), \(b_{NN}\), Rating vector \(Y\)  Randomly initialize parameters \(w_{AE}\), \(w_{NN},b_{AE}\), \(b_{NN}\) for\(i=1\) to \(k\)do for\(u\ \in\ U\)do  Update \(w_{AE}\),\(b_{AE}\) using \(L_{AE}\),  Update \(w_{NN}\), \(b_{NN}\) using \(L_{NN}\) endfor endfor
```  
**Algorithm 1** Algorithm of Proposed Model  
It is necessary to verify whether our newly proposed method, which includes both autoencoder and neural network, is better than the existing method, which using either autoencoder or neural network. Therefore, to compare the proposed and existing model, Section 4 measures the performance of a context-aware recommender system that uses neural network and compares it to the context-aware recommender system that excludes the steps in Formula (5). The input data is those shown in Figure 2. The only output data is \(\hat{y}_{nic}\), which is learned by using Formula (6).