whoami πŸ‘€

Dovydas Gulbinas GitHub: Megamorphf

  • Former: Python (ODOO) developer
  • Current: Oracle, Java developer with strong love for DevOPS 😍

about_the_project πŸ—£

Decluterfy

  • A command line tool for tidying your Spotify playlists
  • It learns your playlists and uses machine learning to make decisions
  • Its written in Python and can be easily adapted to be a web app

demo_time 🚨


export SPOTIPY_CLIENT_ID="dc484d124a6d49d08309f06ecc0162dc"
export SPOTIPY_CLIENT_SECRET="6d97a73b081644889ada30c66128b8df"
export SPOTIPY_REDIRECT_URI="https://megamorphf.github.io/"
source activate decluterfy
python main.py

stack πŸ”

Python

import spotipy
import sklearn # I used import tree
from spotipy_client import MLearnipy
from ml_items import DatasetFormer

"Q. but where you got the song features from πŸ€” ?"

"A. from Spotify api"


selected_features = [
    "id",
    "duration_ms",
    "acousticness",
    "tempo",
    "speechiness",
    "mode",
    "danceability",
    "liveness",
    "instrumentalness",
    "loudness",
    "time_signature",
    "energy",
    "valence",
    "key"
]

how_i_strucutred_all_the_songs ?

# All playlists go here except the target one
# Each child of json object is a playlist

{
  {
    "id": [1,2, ... xSongs],
    "duration_ms": [1,2, ... xSongs],
    "danceability": [1,2, ... xSongs],
    ...
  },
  {
    "id": [1,2, ... ySongs],
    "duration_ms": [1,2, ... ySongs],
    "danceability": [1,2, ... ySongs],
    ...
  }
}

Q. But Where is all the Machine learning 😑?

A. in 4 lines of python 🐍


decision_tree_classifier = tree.DecisionTreeClassifier()

...

# the 3 lines of magic

decision_tree_classifier.fit(songs_not_in_unsorted_playlist, playlists_for_sorted_songs)
incorrectly_sorted_songs = incorrectly_sorted_set.data
playlists_for_unsorted_songs = decision_tree_classifier.predict(incorrectly_sorted_songs)

# what is going on?

[song_id1, song_id2 ... song_idn] -> [playlist_id1, playlist_id2]