/Song_recommender

Primary LanguageJupyter Notebook

logo_ironhack_blue 7

Lab | Clustering songs

## Introduction

Now it's time to cluster the songs of the hot_songs and not_hot_songs databases according to the song's audio features. For this purpose, you need to consider the following questions:

  • Are you going to use all the audio features? If not, which ones do you think that makes more sense to be used?
  • What is the optimal number of clusters (for methods that need to know this beforehand)?
  • What is the best distance to use?
  • What clustering method provides better results?
  • Does the clustering method need a transformer?

Considerations

Be aware that this process is extremely time-consuming!!! (it might take several hours in your laptop). Therefore, when testing different options, save the models into your disk in order to be able to use the best model later. You don't want to retrain the best model again when you know what are the optimal parameters for each. To determine which clustering method performs best, you need to be practical and think how many clusters you might want to have alongside with a clustering metric to evaluate how good or bad the songs were clustered. If the number of clusters is small, each cluster will be too big and generic. On the other hand, if the number of clusters is too big then each cluster it will be too specific and it will be poorly populated (this it also depend on how heterogeneous is your dataset).

On the other hand, when you train your clustering model make sure to concatenate both databases together (ie: hot_songs and not_hot_songs) before. If you don't combine both datasets, the clusters obtained with the hot_songs will be different than the ones obtained with the not_hot_songs database even though they might have the same label because they will contain different songs. However, after this you will not know to which original dataframe belongs each song. To prevent this problem, you can add a new column named "dataset" with a "flag" to remind yourself in which dataset was included each song.

Finally, add new column to the full dataset for each clustering method with the cluster membership of each song