maharshipandya/spotify-tracks-dataset
Viewer • Updated • 114k • 6.19k • 121
A small neural content-based recommender that classifies Spotify tracks into 114 genres using audio features.
maharshipandya/spotify-tracks-datasetdanceability, energy, valence, tempo, acousticness, instrumentalness, liveness, speechiness, loudness, key, mode, popularity, duration_ms, time_signature, explicit| Metric | Score |
|---|---|
| Top-1 Accuracy | 31.6% |
| Top-3 Accuracy | 54.2% |
| Top-5 Accuracy | 65.1% |
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)
This model repository was generated by ML Intern, an agent for machine learning research and development on the Hugging Face Hub.