This project is divided into two notebooks, each focusing on different approaches to classify song lyrics by genre.
In this notebook, we aimed to test various approaches to classify song lyrics by genres. We conducted three independent experiments, training and testing different models on different subsets of the same dataset.
The dataset consisted of song lyrics labeled by genres that we identified as having the least in common with each other (see EDA for details).
- Model: Transformer
- Data: Unbalanced (different numbers of texts per genre)
- Accuracy: 93.5%
- Observation: The high accuracy might be due to the unbalanced data. Testing with balanced data would be interesting to see if the Transformer model performs similarly.
- Model: LSTM
- Data: Downsampled (1063 texts per genre)
- Accuracy: 78.03%
- Model: Random Forest
- Data:
- Unbalanced: 88.6% accuracy
- Balanced: 85.9% accuracy
- Observation: The decrease in accuracy with balanced data suggests that the Transformer model might also lose accuracy with balanced data.
We successfully classified song lyrics by genre using various methods and learned a lot about different Natural Language Processing (NLP) techniques.
In this notebook, we tested Graph Neural Networks (GNNs) using TF-IDF and cosine similarity with different thresholds, and implemented K-Nearest Neighbors (KNN) in Graph Convolutional Networks (GCNs).
- Thresholds and Accuracies:
- Threshold: 0.5 - Accuracy: 23.5%
- Threshold: 0.1 - Accuracy: 23.4%
- Threshold: 0.001 - Accuracy: 23.38%
- Process:
- Extract TF-IDF features
- Calculate 5-KNN
- Create a graph
- Accuracy: 74.85%
- Process:
- TF-IDF vectorization
- Calculate top 5 similarities with cosine similarity
- Create a graph
- Accuracy: 70.62%
- Process:
- BERT Embeddings
- Adjacency Matrix - top K cosine similarities
- Advantages of BERT:
- Context-aware
- Considers the sequence of words
- Pre-trained knowledge
- Long-range dependencies
- Extensive attention mechanism
- Versatile across various domains
- Easily adaptable
- Robust against polysemy
- Accuracy: 85.55% (20 epochs)
- GAT:
- Requires more computational power
- Provides more interpretability
- Accuracy: 84.84% (20 epochs)
- Observations:
- Smaller dataset
- Missing importance
- Attention mechanism of GATs not significant in this context
- Cosine similarity metric not well-suited for GATs
Through these experiments, we explored various methods to classify song lyrics by genre, comparing traditional models with advanced neural network approaches. Each method provided unique insights and performance metrics, contributing to our understanding of NLP techniques in genre classification.
You can find the data here: https://drive.google.com/drive/folders/1FinCic9UHYrJOJPSlZD9pLFWnlzvlp7d?usp=drive_link