# Evolving Matrix-Factorization-Based Collaborative Filtering Using Genetic Programming
## 2 Materials and Methods
### Genetic Programming
The breeding pipeline of EMF is devised in Figure 1.  
Each generational step starts with the selection of those individuals that would generate offspring (i.e., new solutions). The tournament selection randomly chooses two pairs of individuals and selects the one with the best fitness out of the pairs. Each selected individual becomes a parent. Then, new individuals are created with a probability of \(p_{R}=0.5\) by mating the parents. In our approach, we used a single-node crossover, which randomly selects one node of each parent and then exchanges the subtrees whose roots are the selected nodes. During the variation stage, the offspring is mutated \begin{table}
\begin{tabular}{l c c c} \hline \hline
**Operator** & **Arity** & **Function** & **Symbol** \\ \hline Sine & \(1\) & sin\((x)\) & sin \\ Cosine & \(1\) & cos\((x)\) & cos \\ Arctangent & \(1\) & arctan\((x)\) & atan \\ Exponential & \(1\) & exp\((x)\) & exp \\ Logarithm & \(1\) & log\((x)\) & log \\ Inverse & \(1\) & \(\frac{1}{x}\) & inv \\ Sign & \(1\) & \(-x\) & \(-\) \\ Addition & \(2\) & \(x+y\) & \(+\) \\ Subtraction & \(2\) & \(x-y\) & \(-\) \\ Multiplication & \(2\) & \(x\times y\) & \(*\) \\ Power & \(2\) & \(x^{y}\) & pow \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Mathematical operators included in the evolutionary process. with a probability \(p_{V}=0.1\). The mutation of an individual consists of randomly selecting a node within the tree and then replacing it with another randomly selected operator that suits the former node's arity. New individuals are then evaluated and assigned a fitness value. Finally, the algorithm selects which of the individuals should survive to the next generational step. EMF always selects the top two individuals sorted by their fitness values and then completes the size of the new population by selecting the remaining individuals in a random manner. Note that the only stop criterion of our proposal is to reach a maximum number of generations \(MAX_{iter}=150\). The use of evolutionary algorithms along RSs is not new, as it is possible to find many papers that use this kind of algorithm to enhance RSs [17; 18]. However, according to the surveys on that topic, most of the papers from the state of the art are devoted to treat the weights of both the features and the latent models as the individual of the evolutionary process. Those blind optimization methods are very different to EMF, in which the subject of optimization is the aggregated function \(h\) used to guide the matrix factorization method. On the other hand, there are a few papers that use GP to function learning, which is what EMF does. [PERSON] et al. [19] used GP to find ranking functions based on a list of attributes related to metrics of tag relevance. Although the proposal shows promising results, the algorithm subject to optimization is a tag RS, which differs from our approach in that EMF optimizes collaborative filtering RSs. Another use of GP within the RS context can be found in [20]. [PERSON] and [PERSON] proposed the use of GP to derive optimal transformation functions to map ratings to preferences scores while avoiding biases. The main difference, with respect our approach, is that the optimized functionsin the former are used as some kind of preprocessing step. Moreover, although they used CF, the underlying technique is not MF. [PERSON] et al. [21] presented an evolutionary approach based on GP that \"evolves a ranking function that is a combination of measures or (sub-)components of measures commonly used for collaborative filtering, such as the average rating of an item, item popularity, distance of user/item to the k nearest neighbors, among others\". Their approach differs from ours in that the former builds optimized functions from previously aggregated metrics, while ours lets the algorithm to search for these aggregations directly from the features.