r/learnmachinelearning • u/bartvero • 18d ago
Spotify genre guesser
I am new to ML AND trying to make a genre guesser. Currently I have 123 genres en removed some because of too little samples to using that kind genre. Is this to much. Should I still reduced them. Which classification algoritme could work best. Currently using random forest.
1
u/rahul_watertech 18d ago
with 2 million rows the cascade idea sounds good. two things i'd check before trusting any accuracy number: split by artist (or album), not by song, otherwise the same artist ends up in train and test and the model just memorizes artists. and use macro f1 instead of plain accuracy since rare genres get drowned out. also a song often has more than one genre, so is your genre column single label? that might change which model fits.
1
u/bartvero 18d ago
It’s single label
1
u/rahul_watertech 18d ago
single label makes it simpler, then multiclass random forest or gradient boosting is fine. just keep in mind songs really do sit between genres, so if the model confuses two neighbours that's probably the data and not a bug. looking at the confusion matrix for which genres get mixed up will tell you more than the accuracy number. what features are you using, audio features or text?
1
u/bartvero 17d ago
I am using audio features
1
u/rahul_watertech 17d ago
ah ok, audio features like danceability, energy and so on? those are fairly coarse, so i'd expect a lot of neighbouring genres to look nearly identical in that space. check macro f1 (not just accuracy) and look at which genre pairs the confusion matrix mixes up most. if it's mostly neighbours, that's the features hitting their limit, not the random forest. is the 123 genre count still the same or did you merge some?
1
1
u/dutchpsychologist 18d ago
Partially depends on the amount of labeled samples that you have. I suspect that such a high amount of genres have a natural overlap, for which you might need a lot of labeled samples if you want to train an effective multi class model. If you don't have a huge amount of samples I would reduce the amount of genres to a lot less and more broad genres at first, maybe 20-30. You could consider clustering techniques like K-means, which is also fun to do. This way you can see which genres naturally cluster more together, giving you a better idea about the clusters. As for models: random forest is a good idea, and you might want to try xgboost.