# An Improved Collaborative Filtering Recommendation Algorithm Based on Retroactive Inhibition Theory
## 3 Proposed Model: RICF
### Preference Prediction  
RICF improved the traditional itemCF algorithm based on the idea of retroactive inhibition to take user preference evolution into consideration, and it introduced baseline rating as well as adjusted methods to calculate the similarity between items directly on the item embeddings obtained from the previous training. The experiment results are shown in the next section.  
Definition 2 Embedding Similarity  
Based on the items for which the embeddings have been trained, this paper uses the Cosine method to calculate the similarity between the two embeddings  
\(\mathbf{Vec}(\mathbf{O_{x}})=\ \{\mathbf{x_{1}},\mathbf{x_{2}}\cdots,\mathbf{x_{n}}\}\) and \(\mathbf{Vec}(\mathbf{O_{y}})=\ \{\mathbf{y_{1}},\mathbf{y_{2}}\cdots\mathbf{y_{n}}\}\). The original Cosine is used to calculate the angle \(\mathbf{\theta}\) between two vectors \(\mathbf{Vec}(\mathbf{O_{x}})\) and \(\mathbf{Vec}(\mathbf{O_{y}})\), ranging from \(-1\) to \(1\), as defined in Equation (4). The proposed RICF uses the normalized Cosine method to measure the similarity between two embedding vectors, as shown in Equation (5).  
\[\mathbf{\cos}(\mathbf{\theta})_{xy}\ =\ \frac{\mathbf{Vec}(\mathbf{O_{x}})\times\mathbf{Vec}(\mathbf{O_{y}} )}{\left|\mathbf{Vec}(\mathbf{O_{x}})\times\mathbf{Vec}(\mathbf{O_{y}})\right|}\ =\ \frac{\sum_{i = 1}^{n}\mathbf{x_{i}}\mathbf{y_{i}}}{\sqrt{\sum_{i = 1}^{n}\mathbf{x_{i}}^{2}}\times\sqrt{\sum_{i = 1}^{n}\mathbf{y_{i}}^{2}}}, \tag{4}\]  
\[\mathbf{Sim_{xy}}\ =\ \frac{\mathbf{1}+\mathbf{\cos}(\mathbf{\theta})_{xy}}{\mathbf{2}}, \tag{5}\]  
Consequently, this paper derives the RICF algorithm as follows, to predict user \(\mathbf{u_{i}}\)'s preference for item \(\mathbf{o_{j}}\).  
Figure 6: Preferences change over retroactive inhibition (RI)-strength for three different decay functions.  
\[\mathbf{p}_{uj}\ =\ \mathbf{\rho}\times\big{(}\overline{\mathbf{U}}+\mathbf{b}_{u}+\mathbf{b}_{j} \big{)}+(\mathbf{1}-\mathbf{\rho})\times(\frac{\sum_{i\in\mathbb{N}_{j}^{k}(\mathbf{u})} \mathbf{Sim}_{ij}\times(\mathbf{r}_{ui}-\mathbf{b}_{ui})\times\mathbf{Decay}\big{(}\mathbf{RI}_{ui \to uj}\big{)}}{\sum_{i\in\mathbb{N}_{j}^{k}(\mathbf{u})}\mathbf{Sim}_{ij}}+\mathbf{b}_{uj} \big{)} \tag{6}\]  
where \(\mathbf{\rho}\) is the heuristic parameter which we chose by stochastic selection strategy. Part 1 of this equation is the baseline rating, where \(\overline{\mathbf{U}}\) is the mean rating for all users. \(\mathbf{b}_{u}\) and \(\mathbf{b}_{j}\) are the rating bias of user \(\mathbf{u}_{i}\) and item \(\mathbf{o}_{j}\), as defined in Equations (7) and (8), respectively. Moreover, in Equations (7) and (8), \(N(\mathbf{u})(N(j))\) represents all rating records associated with user \(\mathbf{u}\)(item \(\mathbf{o}_{j}\)), \(\overline{\mathbf{r}}_{i}(\overline{\mathbf{r}_{u}})\) represents the mean rating of item \(\mathbf{o}_{i}\)(user \(\mathbf{u}\)). Part 2 of Equation (6) is an improved itemCF algorithm that introduces embedding similarity \(\mathbf{Sim}_{ij}\) to calculate the similarity between item \(\mathbf{o}_{i}\) and item \(\mathbf{o}_{j}\), as shown in Definition 2, and introduces preference decay factor \(\mathbf{Decay}\big{(}\mathbf{RI}_{ui\to uj}\big{)}\) to calculate the decay degree of user \(\mathbf{u}\)'s preference on older items \(\mathbf{o}_{i}\) when user \(\mathbf{u}\) is going to rate newer item \(\mathbf{o}_{j}\), as seen in Section 3.4. Meanwhile, \(\mathbf{b}_{ui}\) (\(\mathbf{b}_{uj}\)) is the simplified base rating prediction for item \(\mathbf{o}_{i}\) (\(\mathbf{o}_{j}\)), which equals \(\overline{\mathbf{r}_{u}}+\mathbf{b}_{i}(\overline{\mathbf{r}_{u}}+\mathbf{b}_{j})\). What is more, the KNN part in Equation (6) chooses \(\mathbb{N}_{j}^{k}(\mathbf{u})\), which selects k items most similar to item \(\mathbf{o}_{j}\) from the rating history of user \(\mathbf{u}\).  
\[\mathbf{b}_{u} = \frac{\sum_{i\in N(\mathbf{u})}\mathbf{r}_{ui}-\overline{\mathbf{r}_{i}}}{|N (\mathbf{u})|} \tag{7}\] \[\mathbf{b}_{j} = \frac{\sum_{j\in N(j)}\mathbf{r}_{uj}-\overline{\mathbf{r}_{u}}}{|N(j)|} \tag{8}\]