Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Get Recommendations returns songs that don't fit the parameters requested.

Get Recommendations returns songs that don't fit the parameters requested.

Country

USA

 

My Question or Issue

Making a simple request to recommendations (using Spotipy) returns empty or inaccurate songs. My goal is to create a playlist filled with songs whose audio_features are as similar to the request as possible.

 

However, you will see below that this fails.

 

Proposed solutions:

  • use recursion to build the playlist, expanding on quantitative parameters incrementally and seed_artist/track/genre params using something like artist_related_artist...
  • something on Spotify's side

 

Code

I made requests with max energy and target energy. Max returns nothing, even with few parameters. Target returns the correct number of songs but they are way off from the targeted state.

 

Attempt with max_energy

parameters = {'target_valence': 0.5, 'max_energy': 0.2, 'seed_artists':  'spotify:artist:0FVj4JuzTyudaXAwfqDQ20']}

current_user.recommendations(limit=20, **parameters)
 
Response is empty.
 
Attempt with target_energy
parameters = {'target_valence': 0.5, 'target_danceability': 0.1, 'target_energy': 0.1, 'target_speechiness': 0.1, 'target_loudness': 0.1, 'seed_tracks': [], 'seed_artists': ['spotify:artist:0FVj4JuzTyudaXAwfqDQ20'], 'seed_genres': []}
 
current_user.recommendations(limit=20, **parameters)
...
uris = # a list built from the response above
 
import pandas as pd
df = pd.DataFrame(current_user.audio_features(tracks=uris))
df['energy'].describe()
 
Response:
this is the .describe of the dataframe built from the audio_features of the songs that were recommended.
 
           energy
mean  0.469231
std 0.126320
min 0.268000
25%  0.395000
50%  0.469000
75% 0.537000
max  0.698000
 
Observations: mean, min, and max are all quite high.
Reply
0 Replies

Suggested posts