## 4 EPMRS Mathematical Model
### Weighted Feature Extraction  
The WFE approach uses the weighted matrix factorization technique [22]. The WFE approach extracts the latent features from user-to-song relationships presented in the user's data. A record in the user's data contains these elements: \(<\)UID, SID, ET, TD, LOC, PC, ER, IR, OI\(>\), where the UID is the user identification, the SID is the song identification, ET is the user emotion type, the TD is time of the day when the user listens to the song, LOC is the user's current location, the PC is the play count of the song, the ER is the explicit rating, the IR is the implicit rating, and the OI is the overall interest with respect to a user for the song, respectively. Notice that the ET element we consider in the EPMRS has four user emotion types: happy, normal, sad, and surprised. The types of TD we consider in the system are morning, noon, afternoon, evening, and midnight. The classes of LOC we consider are home, work place, and others. Let \(p_{t}(u,s)\) denote the number of times the user \(u\) has listened to the song \(s\) at time \(t\). If the user \(u\) listens to the song \(s\), we have \(p_{t+1}(u,s)=p_{t}(u,s)+1\). For getting the feedback from user to the songs, we consider two rating mechanisms: the explicit rating mechanism and the implicit rating mechanism. In the explicit rating mechanism, a user rates the song after listening to the song in the form of like and dislike. Let \(e_{t}(u,s)=\{0,1,2,3,4,5\}\) denote the explicit rating (i.e., dislike (0) or like (1 to 5 stars) given by a user \(u\) to a song \(s\) at time \(t\). The \(e_{t}(u,s)\) represents the ER element of the user's data record. If the user does not provide any explicit rating to a song after listening to a song, then the EPMRS will provide an implicit rating to the song. Let \(i_{t}(u,s)\) denote the implicit rating given by the EPMRS to a song on behalf of user \(u\) at time \(t\). If the user \(u\) listens to more than half of the duration of \(s\), then the EPMRS considers that the user likes the song. We have \(i_{t+1}(u,s)=i_{t}(u,s)+1\) if the listening time is more than the half of the duration of \(s\). At the beginning of learning a user's preference on music, the values of \(e_{t}(u,s)\) and \(i_{t}(u,s)\) may be equal to zero. It may lead to two confusing situations: either the user \(u\) is not aware of the song \(s\) or the user \(u\) is not interested in listening to the song \(s\). To remove this confusion, we introduce an overall user's interest variable. The overall user's interest variable \(o_{t}(u,s)\) calculates how much the user \(u\) will be interested to listen the song \(s\) at time \(t\). The value of \(o_{t}(u,s)\) can be obtained by  
\[o_{t}(u,s)=\frac{p_{t}(u,s)+i_{t}(u,s)}{2}+e_{t}(u,s). \tag{1}\]  
The EPMRS stores the user's data as a part of the user data in the database. Let \(U=\{u_{1},u_{2},\ldots,u_{n}\}\) denote the set of \(n\) users and \(|U|=n\) is the size of \(U\). Let \(S=\{s_{1},s_{2},\ldots,s_{m}\}\) denote the set of \(m\) songs and \(F=\{f_{1},f_{2},\ldots,f_{v}\}\) denote the set of \(v\) features of each song in \(S\). Let \(N~{}=~{}(n_{i,j})\in\mathbf{Z}^{+n\times m}\) denote the user-to-song interest matrix of size \(|U|\times|S|\). The value of each element of matrix \(N\), \((n_{i,j})\), is the value of \(o_{t}(u,s)\). In order to better understand the working process of the EPMRS, we take an example of six users and five songs to illustrate our method. In the example, the interest matrix \(N\) is shown as  
\[N= \begin{array}{cccc}&s_{1}&s_{2}&s_{3}&s_{4}&s_{5}\\ &u_{1}\\ &u_{2}\\ &4&-&2&2&5\\ &-&3&-&1&-\\ &4&1&-&5&3\\ &u_{6}&2&-&4&-&5\end{array} ,\]  
where the '-' symbol indicates a null value. Please notice that all values shown in the matrix are made up by the authors for illustration. In practice, each value in \(N\) is obtained by Equation (1). Please notice that the null value implies that a user \(u_{i}\) has not listened to a song \(s_{j}\) or the song \(s_{j}\) is a new song.