←All projects

Deep Learning for DJs

Supervised deep learning to auto-classify DJ tracks into playlists.

LibrosaPyTorchXGBoostScikit-LearnNLTKPlotlyOpenAI Embeddings

Data Collection & Feature Extraction

Audio features are first extracted using Librosa and NumPy: Mel-Frequency Cepstral Coefficients, Zero Cross Rates, Root Mean Squares, Spectral Rolloffs, and Chromagram values across each 10-second chunk of an audio sample, along with their means and variances.

TinyTag extracts metadata from downloaded files, which is used to pull lyrics for each song through the LyricsGenius API. Lyrics are cleaned (stopwords and irrelevant punctuation removed) and vectorized using the OpenAI Large Embeddings model into a final stored data frame.

Audio Exploratory Data Analysis

Central tendencies of key audio features are calculated to identify differences, with Kernel Density Estimate graphs plotted per feature and separated by playlist to visualize density differences.

Correlation heat maps identify covariances between key audio features to inform feature engineering, and a principal component analysis visualizes distinctions between playlists in terms of audio features.

Textual Exploratory Data Analysis

A t-SNE is conducted on 3 principal components of the lyrical features across the Dance, Hindi, and Latin playlists. Distinctions are observed, particularly between Hindi, Dance, and Rap music.

Supervised Learning Approaches

Playlists are label-encoded, train/test splits are created, and each feature is scaled to prevent unfair influence.

Logistic Regression classifies audio features with better-than-random results; Gradient Boosted Trees are tuned across learning rates to reduce overfitting and increase test accuracy.

Final Supervised Model Design

A 7-layer neural network is built in PyTorch, trained with cross-entropy loss, ReLU activation, and a 0.3 dropout rate, using an Adam optimizer and class-weighted batches for fair evaluation.

Early stopping prevents overfitting; results are evaluated playlist-wise and via a confusion matrix.

Unsupervised Approaches

Gaussian Mixture Models explore whether the corpus clusters differently than its supervised categorization. Clusters prove less distinct than expected, with songs from different playlists grouped together.

Conclusions & Next Steps

Given the model's high F1-score, it successfully classifies songs into genres based on specific DJ preferences, saving substantial time spent analyzing and categorizing songs. The implementation was limited by available data and compute.

Open questions: which additional features cause unsupervised clustering to diverge from supervised categories? Can the algorithm decide which songs to download in the first place? Can it recommend which tracks to mix, not just classify them?