Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

MusicMood - Machine Learning in Automatic Music Mood Prediction Based on Song Lyrics

11 747 vues

Publié le

In this talk, I present a machine learning approach to build a music recommendation system that can identify happy songs in a music library based on song lyrics. Also, this presentation covers a general introduction to predictive modeling, naive Bayes classification, and text classification.

Publié dans : Données & analyses
  • Identifiez-vous pour voir les commentaires

MusicMood - Machine Learning in Automatic Music Mood Prediction Based on Song Lyrics

  1. 1. MusicMood Machine Learning in Automatic Music Mood Prediction Based on Song Lyrics Sebastian Raschka December 10, 2014
  2. 2. Music Mood Prediction • We like to listen to music [1][2] • Digital music libraries are growing • Recommendation system for happy music (clinics, restaurants ...) & genre selection [1] Thomas Schaefer, Peter Sedlmeier, Christine Sta ̈dtler, and David Huron. The psychological functions of music listening. Frontiers in psychology, 4, 2013. [2] Daniel Vaestfjaell. Emotion induction through music: A review of the musical mood induction procedure. Musicae Scientiae, 5(1 suppl):173–211, 2002.
  3. 3. Predictive Modeling Unsupervised learning Supervised learning Clustering Classification Regression Reinforcement learning Hidden Ranking Markov models DBSCAN on a toy dataset Naive Bayes on Iris (after LDA)
  4. 4. Supervised Learning In a Nutshell
  5. 5. Feature Extraction Feature Selection Normalization Dimensionality Reduction Raw Data Collection Pre-processing Sampling Supervised Learning - A Quick Overview Pre-processing Test Dataset New Data Training Dataset Training Learning Algorithms Post-Processing Cross Validation Final Classification/ Regression Model Refinement Prediction Split Supervised Learning Sebastian Raschka 2014 Missing Data Prediction-error Metrics Model Selection Hyperparameter optimization This work is licensed under a Creative Commons Attribution 4.0 International License.
  6. 6. MusicMood - The Plan
  7. 7. The Dataset http://labrosa.ee.columbia.edu/millionsong/
  8. 8. Sampling Lyrics available? Lyrics in English? 1000 songs for training 200 songs for validation http://lyrics.wikia.com/Lyrics_Wiki Python NLTK
  9. 9. Mood Labels Downloading mood labels from Last.fm Manual labeling based on lyrics and listening sad if ... • Dark topic (killing, war, complaints about politics, ...) • Artist in sorrow (lost love, ...)
  10. 10. Word Clouds happy: sad:
  11. 11. A Short Introduction to Naive Bayes Classification
  12. 12. Naive Bayes - Why? • Small sample size, can outperform the more powerful alternatives [1] • "Eager learner" (on-line learning vs. batch learning) • Fast for classification and re-training • Success in Spam Filtering [2] • High accuracy for predicting positive and negative classes in a sentiment analysis of Twitter data [3] [1] Pedro Domingos and Michael Pazzani. On the optimality of the simple bayesian classifier under zero-one loss. Machine learning, 29(2-3):103–130, 1997. [2] Mehran Sahami, Susan Dumais, David Heckerman, and Eric Horvitz. A bayesian approach to filtering junk e-mail. In Learning for Text Categorization: Papers from the 1998 workshop, volume 62, pages 98–105, 1998. [3] Alec Go, Richa Bhayani, and Lei Huang. Twitter sentiment classification using distant supervision. CS224N Project Report, Stanford, pages 1–12, 2009.
  13. 13. Bayes Classifiers It’s All About Posterior Probabilities objective function: maximize the posterior probability
  14. 14. The Prior Probability Maximum Likelihood Estimate (MLE)
  15. 15. The Effect of Priors on the Decision Boundary
  16. 16. Class-Conditional Probability Maximum Likelihood Estimate (MLE) "chance of observing feature given that it belongs to class " "
  17. 17. Evidence just a normalization factor, can be omitted in decision rule:
  18. 18. Naive Bayes Models Gaussian Naive Bayes for continuous variables
  19. 19. Naive Bayes Models Multi-variate Bernoulli Naive Bayes for binary features
  20. 20. Naive Bayes Models Multinomial Naive Bayes
  21. 21. Naive Bayes and Text Classification
  22. 22. Feature Vectors The Bag of Words Model
  23. 23. Tokenization and N-grams “a swimmer likes swimming thus he swims”
  24. 24. Stemming and Lemmatization Porter Stemming Lemmatization
  25. 25. Stop Word Removal
  26. 26. Term and Frequency
  27. 27. Term Frequency - Inverse Document Frequency (Tf-idf)
  28. 28. Grid Search and 10-fold Cross Validation to Optimize F1 • TP = true positive (happy predicted as happy) • FP = false positive (sad predicted as happy) • FN = false negative (happy predicted as sad)
  29. 29. K-Fold Cross Validation
  30. 30. 10-Fold Cross Validation After Grid Search (final model)
  31. 31. 10-fold Cross Validation (mean ROC) Multinomial vs Multi-variate Bernoulli Naive Bayes
  32. 32. 10-fold Cross Validation (mean ROC) Multinomial Naive Bayes & Hyperparameter Alpha
  33. 33. 10-fold Cross Validation (mean ROC) Multinomial Naive Bayes & Vocabulary Size
  34. 34. 10-fold Cross Validation (mean ROC) Multinomial Naive Bayes & Document Frequency Cut-off
  35. 35. 10-fold Cross Validation (mean ROC) Multinomial Naive Bayes & N-gram Sequence Length
  36. 36. Contingency Tables of the Final Model training test
  37. 37. Live Demo http://sebastianraschka.com/ Webapps/musicmood.html
  38. 38. Future Plans • Growing a list of mood labels (majority rule). • Performance comparisons of different machine learning algorithms. • Genre prediction and selection based on sound.
  39. 39. Thank you!