Data preprocessing and model training

Sparks's inbuilt function to train a model takes a dataframe of 'implicit preferences' given by users to some products. userID ~ user_id, productID ~ recording_id and preference ~ transformed count as represented by rows in playcounts dataframe.

Playcounts dataframe is loaded from HDFS in 0.00 mins and is of the form:

user_id recording_id playcount transformed_listencount

Here, playcount is the actual listen count whereas the transformed_listencount was calculated by applying the following function on playcounts.

No transformation applied to listen counts

Preprocessing of playcounts dataframe takes 0.00 mins. The preprocessed data divided the data into training and test data, in 5 : 1. The model was then trained on the training data using K-Folds Cross Validation with 5 folds. From the models trained, the one with least RMSE is selected to generate recommendations.

Of all the trained models, the model with the least RMSE value is chosen to generate recommendations. The model will be referred to as "best model".

Best model parameters are as follows:

Best model ID Best model rank Best model lmbda Best model iteration Best model alpha Best model RMSE
listenbrainz-recommendation-model-66b3ec5e-63ef-4ee1-8830-a538627ae959 120 0.1 10 3.0 11.683

Test RMSE for the best model is 16.544

Total time lapsed in data preprocessing and model training: 3.73 hours

Best Model saved in 0.12 mins

All the models trained in 3.73 hours

The following table gives information about all the models trained

model id rank lmbda iterations alpha RMSE
listenbrainz-recommendation-model-9b15c9f6-db3e-4e91-bc4a-a58fc1441e35 100 0.1 5 3.0 11.688
listenbrainz-recommendation-model-7aac2011-7b46-4796-8d53-d290a6758f9f 100 0.1 10 3.0 11.683
listenbrainz-recommendation-model-5419140b-b753-49ba-911b-7631f995d144 100 10.0 5 3.0 11.733
listenbrainz-recommendation-model-818e5f4a-4825-4d67-85eb-ad98b6ec1f0c 100 10.0 10 3.0 11.732
listenbrainz-recommendation-model-3e0abb45-5856-40e0-884d-29033327ab05 120 0.1 5 3.0 11.688
listenbrainz-recommendation-model-66b3ec5e-63ef-4ee1-8830-a538627ae959 120 0.1 10 3.0 11.683
listenbrainz-recommendation-model-2e5e48c7-1b9d-450d-9ec1-b70c47b2b2ed 120 10.0 5 3.0 11.733
listenbrainz-recommendation-model-f73b04e7-69d5-48da-a954-a7314eaa0f16 120 10.0 10 3.0 11.732

Following are the parameters required to train the model

The Mean Squared Error (MSE) is a direct measure of the reconstruction error of the user-item rating matrix. It is defined as the sum of the squared errors divided by the number of observations. The squared error, in turn, is the square of the difference between the predicted rating for a given user-item pair and the actual rating.

Ratings are predicted for all the (user_id, recording_id) pairs in validation data, the predicted ratings are then subtracted with actual ratings and RMSE is calculated.

Note: Number of rows in a dataframe or number of elements in a dataframe (count information) is not included because it leads to unnecessary computation time.