Spotify Genre Recommender

A small neural content-based recommender that classifies Spotify tracks into 114 genres using audio features.

Dataset

  • Source: maharshipandya/spotify-tracks-dataset
  • Size: 114,000 tracks, 114 genres (1,000 tracks per genre)
  • Features: 15 numerical/audio features including danceability, energy, valence, tempo, acousticness, instrumentalness, liveness, speechiness, loudness, key, mode, popularity, duration_ms, time_signature, explicit

Architecture

  • Small 2-layer MLP with BatchNorm and Dropout
  • Hidden dimension: 256
  • ~60K parameters
  • Trained with CrossEntropyLoss + AdamW + ReduceLROnPlateau

Results

Metric Score
Top-1 Accuracy 31.6%
Top-3 Accuracy 54.2%
Top-5 Accuracy 65.1%

Usage

import torch, joblib, json
from model import SmallGenreMLP

model = SmallGenreMLP(input_dim=15, hidden_dim=256, num_classes=114)
model.load_state_dict(torch.load("model.pt", map_location="cpu"))
scaler = joblib.load("scaler.joblib")

# Features: [popularity, duration_ms, danceability, energy, key, loudness, mode,
#            speechiness, acousticness, instrumentalness, liveness, valence,
#            tempo, time_signature, explicit]
x = scaler.transform([[...]])
logits = model(torch.tensor(x, dtype=torch.float32))
probs = torch.softmax(logits, dim=1)

Generated by ML Intern

This model repository was generated by ML Intern, an agent for machine learning research and development on the Hugging Face Hub.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train zyan1de/spotify-genre-recommender