# Dirichlet Matrix Factorization: A Reliable Classification-Based Recommender System
## 2 Proposed Model
### Running Example  
Here we describe a running example of the DirMF model using a synthetic dataset with three users and five items. For the sake of simplicity, the set of possible ratings is \(\mathcal{S}=\{\mathbf{\bigvee},\mathbf{\bigtimes}\}\), that is, like and dislike. The original rating matrix used for this example can be checked in Table 1.  
Given the ratings, we can build the softmax of every rating \(R_{i,i}^{s}\) (i.e., like, dislike) according to Equation (2), as shown in Table 2.  
The parameters of the model are the latent factors for both users and items for every possible rating: \(P^{\mathbf{\bigvee}},P^{\mathbf{\bigtimes}},Q^{\mathbf{\bigvee}},Q^{\mathbf{\bigtimes}}\). For the sake of simplicity, we fixed the number of latent factors to \(K=3\). The random initialization of the parameters for this running example is shown in Table 3.  
The optimization of the parameters is performed by a gradient descent algorithm, so the update rules defined by Equations (4) and (5) are applied on each \(m\) iteration step. For instance, the update rule for the second latent factor \(k_{2}\) of item \(i_{3}\) and dislike rating (\(\mathbf{\bigtimes}\)) is:  
\[\Delta Q^{\mathbf{\bigtimes}}_{i_{3},k_{2}}=P^{\mathbf{\bigtimes}}_{u_{1},k_{2}}\cdot \omega^{\prime}(P^{\mathbf{\bigtimes}}_{u_{1}}\cdot Q^{\mathbf{\bigtimes}}_{i_{3}}) \Bigg{[}\psi\Big{(}\omega(P^{\mathbf{\bigtimes}}_{u_{1}}\cdot Q^{\mathbf{\bigtimes}}_{ i_{3}})\Big{)}-\psi\Bigg{(}\sum_{s\in\mathcal{S}}\omega\Big{(}P^{s}_{u_{1}} \cdot Q^{s}_{i_{3}}\Big{)}\Bigg{)}-\log(R^{\mathbf{\bigtimes}}_{u_{1},i_{3}}) \Bigg{]},\]  
hence we should update that hidden factor as follows:  
\[Q^{\mathbf{\bigtimes}}_{i_{3},k_{2}}\gets Q^{\mathbf{\bigtimes}}_{i_{3},k_{2}}- \gamma\Big{(}\Delta Q^{\mathbf{\bigtimes}}_{i_{3},k_{2}}+\eta Q^{\mathbf{\bigtimes}}_ {i_{3},k_{2}}\Big{)},\]  
with \(\gamma\) and \(\eta\) being the learning rate and regularization, respectively. Table 4 contains the latent factors after one iteration using regularization \(\eta=0.01\) and learning rate \(\gamma=0.1\). \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \(R_{u,i}\) & \(i_{1}\) & \(i_{2}\) & \(i_{3}\) & \(i_{4}\) & \(i_{5}\) \\ \hline \(u_{1}\) & \(\mathbf{\bigtimes}\) & & & & \(\mathbf{\bigvee}\) & \\ \(u_{2}\) & \(\mathbf{\bigvee}\) & & & & \(\mathbf{\bigvee}\) & \\ \(u_{3}\) & \(\mathbf{\bigtimes}\) & & & & \(\mathbf{\bigvee}\) & \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Rating matrix used in the running example. Rating values are: like \(\mathbf{\bigvee}\)and dislike \(\mathbf{\bigtimes}\). \begin{table}
\begin{tabular}{c c c c c|c c c c} \hline \hline \(R_{u,i}^{\mathbf{\bigvee}}\) & \(i_{1}\) & \(i_{2}\) & \(i_{3}\) & \(i_{4}\) & \(i_{5}\) & \(R_{u,i}^{\mathbf{\bigtimes}}\) & \(i_{1}\) & \(i_{2}\) & \(i_{3}\) & \(i_{4}\) & \(i_{5}\) \\ \hline \(u_{1}\) & 0.27 & & 0.73 & 0.73 & & \(u_{1}\) & 0.73 & 0.27 & 0.27 & \\ \(u_{2}\) & 0.73 & & 0.73 & 0.27 & \(u_{2}\) & 0.27 & & & 0.27 & 0.73 \\ \(u_{3}\) & 0.27 & 0.73 & & 0.73 & & \(u_{3}\) & 0.73 & 0.27 & & 0.27 & \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Softmax-normalized ratings. Note that only known ratings are normalized. and recommendations. Baselines were chosen to provide a diverse representation of all the known MF models. The selected baselines and their resulting outputs are:  
* **Bernoulli Matrix Factorization (BeMF)**[18], which provides both prediction and recommendation reliability;
* **PMF**[10], which provides predictions but no reliability;
* **GMF**[11], which provides predictions only;
* **NCF**[11], which provides predictions but no reliability. Several hyperparameters in both the specified baselines and our model must be tweaked. By executing a grid search optimization that minimizes the mean absolute prediction error, we evaluated the prediction error of baseline models with varied values of these hyperparameters.