# A Biased Proportional-Integral-Derivative-Incorporated Latent Factor Analysis Model
## 4 Materials and Methods
### Algorithm Description  
According to [26; 27; 28; 29], it can be concluded that both the PSL model and the biased SVD model help improve the effectiveness of the recommendation system. Therefore, this paper presents a new model combining the PSL model with the biased SVD model to test whether it can provide better recommendation result. In this method, the instantaneous error, i.e., the difference between the true value and the predicted value, is derived from the biased SVD formula, and the error is then fed into the PSL model for an iterative solution.  
The calculation formula of the predicted value is the same as that of the biased SVD model (7). Then the instantaneous error value is brought into the PID controller to gain the adjusted error for iteration to obtain the final predicted value. In this way, the advantages of rapid convergence and fewer iterations of the PSL model can be combined with the advantage of high accuracy of the biased SVD model. Substituting the above predicted formula into the PSL model can obtain the formula (15).  
\[\tau_{u,j}=r_{u,i}-\sum_{k=1}^{K}p_{u,k}q_{i,k}-\mu-b_{i}-b_{u}. \tag{15}\]Then \(\tilde{\tau}_{u,i}\) is calculated by Formula (12) and substituted into the following objective function (16). The regularization term is also changed because of the addition of \(b_{u}\) and \(b_{i}\).  
\[\min_{Q^{*},P^{*}}\sum_{(u,i)\in R}\tilde{\tau}_{u,j}^{2}+\lambda(\|Q_{i}\|^{2}+ \|P_{u}\|^{2}+\|b_{u}\|^{2}+\|b_{i}\|^{2}). \tag{16}\]  
the formulas in (17) are the iterative formula of \(b_{u}\) and \(b_{i}\) obtained based on the objective function. The iterative formulas of P and Q are the same as that of the PSL model.  
\[\left\{\begin{array}{l}b_{u}^{t+1}=b_{u}^{t+1}+\alpha(\tilde{\tau}_{u,i}- \lambda b_{u}^{t}),\\ \\ b_{i}^{t+1}=b_{i}^{t+1}+\alpha(\tilde{\tau}_{u,i}-\lambda b_{i}^{t}).\end{array}\right. \tag{17}\]  
The pseudocode of the algorithm is shown in Algorithm 1.  
```
0:\(U\), \(I\), \(R\), \(K\), \(\lambda\), \(\alpha\), \(K_{P}\), \(K_{I}\), \(K_{D}\), \(S\),\(\mu\)
0:\(P\), \(Q\)
0:init\(P_{|U|\approx K}\), \(Q_{|I|\approx K}\) with random numbers in \([-0.01,0.01]\)
0:init\(b_{u}\), \(b_{i}\) with 0
0:init\(\mathbf{Y}\), \(\mathbf{Y}\) with size \(|\,\mathbf{R}|\)
0:for each\(\tau_{u,i}\) in \(\mathbf{R}\)do
0:init\(\mathbf{\tilde{\tau}}_{u,i}=0\),Y\({}_{u,i}=0\) endfor while not converge and n \(\leq\) Sdo for\(r_{u,i}\) in \(\mathbf{R}\)do fetch\(\mathbf{\tilde{\tau}}_{u,i}\) from \(\mathbf{\tilde{\tau}}\) and Y\({}_{u,i}\) from Y \(\mathbf{\tilde{\tau}}_{u,i}=\sum_{k=1}^{K}p_{u,k}q_{i,k}+\mu+b_{i}+b_{u}\) \(\tau_{u,i}=r_{u,i}\) \(\mathbf{\tilde{\tau}}_{u,i}=\mathbf{\tilde{\tau}}_{u,i}+\tau_{u,i}\) \(\mathbf{\tilde{\tau}}=K_{P}\)\({}^{*}\)\(\mathbf{\tilde{\tau}}_{u,i}+K_{I}\)\(\mathbf{\tilde{\tau}}_{u,i}+K_{D}\)\({}^{*}\)(\(\tau_{u,i}\) - Y\({}_{u,i}\) ) \(\mathbf{Y}_{u,i}=\tau_{u,i}\) \(b_{u}=b_{u}+\alpha(\mathbf{\tilde{\tau}}-\lambda b_{u})\) \(b_{i}=b_{i}+\alpha(\mathbf{\tilde{\tau}}-\lambda b_{i})\) for\(\mathbf{k}=1\) to K do \(p_{u,k}=p_{u,k}+\alpha(\mathbf{\tilde{\tau}}q_{i,k}-\lambda p_{u,k})\) \(q_{i,k}=q_{i,k}+\alpha(\mathbf{\tilde{\tau}}p_{u,k}-\lambda q_{i,k})\) endfor endfor n = n + 1 endwhile
```  
**Algorithm 1**_Bias-PSLSVD_.