## 3 Modeling the Time Effect on Music Recommendations
### Time-Aware Music Recommendation Method
#### 3.2.1 Modeling the Evolution of Preferences
\[r_{i,j}=4\Bigg{(}1-\sum_{k=1}^{k-1}dPlayF_{k}(u_{i})\Bigg{)} \tag{13}\]  
The ratings calculated from the frequency of decay plays reflect the evolution over time of user preferences. For users who suffer from the cold-start problem because they have recently joined the system, this evolution will be reflected to a lesser extent and the decay ratings calculated for them will be similar to the ratings provided. ```
1:Input : \(U=\{u_{1},u_{2},\ldots,u_{n}\}\)
2:\(S=\{s_{1},s_{2},\ldots,s_{m}\}\)
3:\(t_{i,j,p}\ \forall\ i,j,p\ \Big{|}\ i=1,\ldots,\ n\ \wedge\ j=1,\ldots,m\ \wedge\ p=1,\ldots,\ n_{p}\Big{(}u_{i},\ s_{j}\Big{)}\)
4:\(\lambda\), \(T_{u}\)
5:Output : \(R\), \(DT\) // \(R\): Rating matrix, \(DT\): Vector of average time of day for every user \(u_{i}\)
6:\(R:=r_{i,j}\), \(R\ \epsilon\ M_{norm}(\mathbb{N})\)
7:\(DT:=dTavg_{i}\), \(DT\ \epsilon\ M_{m\times 1}(\mathbb{N})\)
8:\(t_{max}:=\max\{t_{i,j,p}\}\)
9:for\(i=1\ to\ n\)do
10:\(dPlayFDem(u_{i})\ \gets 0\)
11:for\(j=1\ to\ m\)do
12:\(dPlayFNum\left(u_{i},s_{j}\right)\ \gets 0\)
13:\(NP(u_{i})=0\)
14:for\(p=1\ to\ n_{p}\Big{(}u_{i},\ s_{j}\Big{)}\)do
15:\(dPlay(i,\ j):=e^{-\lambda(t_{max}-t_{i,j,p})/T_{u}}\)
16:\(dPlayFNum\left(u_{i},s_{j}\right)\ \leftarrow\ dPlayFNum\left(u_{i},s_{j}\right)+dPlay(i,j,\ p)\)
17:endfor
18:\(dPlayFDem(u_{i})\ \leftarrow\ dPlayFDem(u_{i})+dPlayFNum\left(u_{i},s_{j}\right)\)
19:\(NP(u_{i})\ \leftarrow\ NP(u_{i})+n_{p}\Big{(}u_{i},\ s_{j}\Big{)}\)
20:endfor
21:endfor
22:for\(i=1\ to\ n\)do
23:for\(j=1\ to\ m\)do
24:\(dPlayFNum\left(u_{i},s_{j}\right)\ \leftarrow\ dPlayFNum\left(u_{i},s_{j}\right)/\ dPlayFDem(u_{i})\)
25:endfor
26:endfor
27:endfor
28:for\(i=1\ to\ n\)do
29:\(s_{j}\ \leftarrow\ sideset{{}^{\prime}}



listening to music, which can be taken into account to improve recommender models. Context-aware recommendation methods are based on these general patterns of user behavior. They are used to manage situations in which time is a contextual variable, since user preferences may depend on this. Subsequently, the day is divided into time intervals and different recommendations are generated for each of these time windows. As previously mentioned, this can cause the problem of sparsity, which is even worse in the music domain, where implicit ratings are computed from the number of plays due to the need for additional intervals. In the experimental study carried out in this work, in which the previously described method is tested, only two contextual time intervals, morning and evening, are considered as a way to minimize this problem. Additionally, the pre-filtering approach has been applied to generate recommendations for every period. Considering a tridimensional data space \(D\) where the ratings in set \(D\) depend on users, items and time context, the contextual pre-filtering reduces the space from three to two dimensions by setting the time to a value \(t\), as seen in Equation (14), or a range of values \(S_{t}\), as seen in Equation (15). \[R_{U\times U\times T}^{D} \rightarrow R_{U\times I}^{D\ [T=t]} \tag{14}\]

\[R_{U\times U\times T}^{D} \rightarrow R_{U\times I}^{D\ [T\in S_{t}]} \tag{15}\]

where \(U\) is the set of users, \(I\) is the set of items and \(T\) is the set of time values when ratings are given to the items. When the context of time is introduced, \(T\) is usually restricted to a specific interval \(S_{t}\), called the contextual segment. After reducing the space to two dimensions, traditional CF methods can be applied to every contextual segment. For instance, the recommendation of songs to be played in the morning only use data belonging to the morning contextual segment. #### Modeling User Listening Behavior

In addition to establishing contextual time intervals, we also analyze the listening habits of users throughout the day. In this case, we focus on the individual behavior patterns of each user to achieve a greater customization of the recommendations. This data analysis reveals very different behaviors among users.