## 3 Modeling the Time Effect on Music Recommendations
### Time-Aware Music Recommendation Method
#### 3.2.1 Modeling the Evolution of Preferences
The data were divided before carrying out the rating computation, so that the ratings and the decay ratings could be computed, respectively, from the number of plays and decay plays in each subset separately by means of Equation (13). Their values were in the range (0, 4). The same procedure was used when contextual periods were considered, computing both types of ratings separately for each training and test set for each contextual period. This is the most suitable way of validating recency-based models [33]. Each record in the datasets consists of the user ID, song ID and either the calculated rating or decay rating for the pair user-song, depending on the approach being evaluated. Therefore, the ground truth used to calculate the error metrics for ratings and decay ratings only varies in these implicit ratings, while the user-song pairs were the same. In addition, the test set records containing user-song pairs, which were also contained in the training set records, were removed. This is done because the recommendation list cannot contain songs that have been previously played by the user, as stated in CF. We used the same datasets for both the rating prediction and top-N recommendations. The validation strategy followed for top-N recommendation is AllItems [76], in which the entire set of items except those rated by the user in the training set, is used to make the recommendation list. This is considered a suitable strategy to compare the performance of the algorithms. TestRatings is an alternative method that only considers the items in the test set that have ratings of the target user to generate the top-N list for that user. Therefore, the evaluation is only performed over a reduced number of items of known relevance, which in practice is not a realistic scenario. AllItems adds some items to the list which were non-relevant since they have no rating for a given user in the test set. Thus, it can give lower precision values than TestRatings but it is expected that this fact will similarly affect all recommendation algorithms. Consequently, this procedure is more suitable for comparing algorithms since it reflects a more realistic scenario [76]. ### Validation Metrics

The proposed method is validated for both rating predictions and top-N recommendations. The metrics used to evaluate the rating prediction reliability were the MAE (mean absolute error), RMSE (root-mean-square error) and NMAE (normalized mean absolute error) [77]. For top-N recommendations, the following ranking specific metrics were used: AUC (area under the receiver operating characteristics (ROC) curve), NDCG (normalized discounted cumulative gain), MAP (mean average precision), and precision for the first 5, 10 and 15 items of the top-N list (prec@5, prec@10 and prec@15). Most of these measures are defined in the information retrieval area [78]. The metrics used in the validation are defined below:

MAE is the average of the absolute error or difference between the actual rating (\(r\)) and the predicted rating (\(pr\)). \[\text{MAE}=\frac{1}{n}\ \sum_{i=1}^{n}|r_{i}-pr_{i}| \tag{18}\]

where \(n\) is the number of predictions, \(r_{i}\) is the actual rating and \(pr_{i}\) is the predicted rating. The NMAE is obtained by normalizing the MAE with respect to the range of rating values. Thus, it is independent of the evaluation range. \[\text{NMAE}=\frac{\text{MAE}}{r_{max}-r_{min}} \tag{19}\]

The RMSE is a good measure to compare the errors of different predictive models. It represents the sample standard deviation of the differences between the predicted values and observed values. \[\text{RMSE}=\sqrt{\frac{1}{n}\ \sum_{i=1}^{n}(r_{i}-pr_{i})^{2}} \tag{20}\]

The metrics used in the validation of the top-N recommendations are described below. The AUC is a metric obtained from the representation of correct and incorrect prediction rates, in particular, the true positive rate (\(TPR\)) and false positive rate (\(FPR\)).