Song Recommendation System

In this article we focused on building recommender systems to find products, music and movies that interest users. We have also built model which compared the simple popularity-based recommendation with a personalized model, and showed the significant improvement provided by personalization.

In this Ipython Notebook we are going to explore the song data and the recommendations made by our model. In this process, we are going to learn how to use one of the most important data manipulation primitives groupby.

import graphlab
# CSV format datasets https://d396qusza40orc.cloudfront.net/phoenixassets/song_data.csv
song_data = graphlab.SFrame('coursera-notebooks/course-1/song_data.gl')
[INFO] This non-commercial license of GraphLab Create is assigned to prashantgonarkar@gmail.com and will expire on February 13, 2017. For commercial licensing options, visit https://dato.com/buy/.

[INFO] Start server at: ipc:///tmp/graphlab_server-1181 - Server binary: /usr/local/lib/python2.7/dist-packages/graphlab/unity_server - Server log: /tmp/graphlab_server_1457246816.log
[INFO] GraphLab Server Version: 1.8

Exploring data

song_data.head()
user_id song_id listen_count title artist
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SOAKIMP12A8C130995 1 The Cove Jack Johnson
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SOBBMDR12A8C13253B 2 Entre Dos Aguas Paco De Lucia
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SOBXHDL12A81C204C0 1 Stronger Kanye West
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SOBYHAJ12A6701BF1D 1 Constellations Jack Johnson
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SODACBL12A8C13C273 1 Learn To Fly Foo Fighters
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SODDNQT12A6D4F5F7E 5 Apuesta Por El Rock 'N'
Roll ...
Héroes del Silencio
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SODXRTY12AB0180F3B 1 Paper Gangsta Lady GaGa
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SOFGUAY12AB017B0A8 1 Stacked Actors Foo Fighters
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SOFRQTD12A81C233C0 1 Sehr kosmisch Harmonia
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SOHQWYZ12A6D4FA701 1 Heaven's gonna burn your
eyes ...
Thievery Corporation
feat. Emiliana Torrini ...
song
The Cove - Jack Johnson
Entre Dos Aguas - Paco De
Lucia ...
Stronger - Kanye West
Constellations - Jack
Johnson ...
Learn To Fly - Foo
Fighters ...
Apuesta Por El Rock 'N'
Roll - Héroes del ...
Paper Gangsta - Lady GaGa
Stacked Actors - Foo
Fighters ...
Sehr kosmisch - Harmonia
Heaven's gonna burn your
eyes - Thievery ...
[10 rows x 6 columns]
len(song_data)
1116609
graphlab.canvas.set_target('ipynb')
song_data['song'].show()

Count number of users

users = song_data['user_id'].unique()
len(users)
66346

Create song recommender

train_data,test_data = song_data.random_split(.8,seed=0)

Simple popularity-based recommender

popularity_model = graphlab.popularity_recommender.create(train_data,
                                                         user_id='user_id',
                                                         item_id='song')
PROGRESS: Recsys training: model = popularity
PROGRESS: Warning: Ignoring columns song_id, listen_count, title, artist;
PROGRESS:     To use one of these as a target column, set target = <column_name>
PROGRESS:     and use a method that allows the use of a target.
PROGRESS: Preparing data set.
PROGRESS:     Data has 893580 observations with 66085 users and 9952 items.
PROGRESS:     Data prepared in: 5.03742s
PROGRESS: 893580 observations to process; with 9952 unique items.

Use popularity model to make some predictions

popularity_model.recommend(users=[users[0]])
user_id song score rank
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Sehr kosmisch - Harmonia 4754.0 1
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Undo - Björk 4227.0 2
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
You're The One - Dwight
Yoakam ...
3781.0 3
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Revelry - Kings Of Leon 3527.0 4
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Horn Concerto No. 4 in E
flat K495: II. Romance ...
3161.0 5
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Secrets - OneRepublic 3148.0 6
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Hey_ Soul Sister - Train 2538.0 7
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Fireflies - Charttraxx
Karaoke ...
2532.0 8
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Tive Sim - Cartola 2521.0 9
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Drop The World - Lil
Wayne / Eminem ...
2053.0 10
[10 rows x 4 columns]
popularity_model.recommend(users=[users[1]])
user_id song score rank
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Sehr kosmisch - Harmonia 4754.0 1
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Undo - Björk 4227.0 2
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
You're The One - Dwight
Yoakam ...
3781.0 3
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Dog Days Are Over (Radio
Edit) - Florence + The ...
3633.0 4
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Revelry - Kings Of Leon 3527.0 5
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Horn Concerto No. 4 in E
flat K495: II. Romance ...
3161.0 6
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Secrets - OneRepublic 3148.0 7
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Fireflies - Charttraxx
Karaoke ...
2532.0 8
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Tive Sim - Cartola 2521.0 9
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Drop The World - Lil
Wayne / Eminem ...
2053.0 10
[10 rows x 4 columns]

Build a song recommender with personalization

personalized_model = graphlab.item_similarity_recommender.create(train_data,
                                                                user_id='user_id',
                                                                item_id='song')
PROGRESS: Recsys training: model = item_similarity
PROGRESS: Warning: Ignoring columns song_id, listen_count, title, artist;
PROGRESS:     To use one of these as a target column, set target = <column_name>
PROGRESS:     and use a method that allows the use of a target.
PROGRESS: Preparing data set.
PROGRESS:     Data has 893580 observations with 66085 users and 9952 items.
PROGRESS:     Data prepared in: 5.44737s
PROGRESS: Computing item similarity statistics:
PROGRESS: Computing most similar items for 9952 items:
PROGRESS: +-----------------+-----------------+
PROGRESS: | Number of items | Elapsed Time    |
PROGRESS: +-----------------+-----------------+
PROGRESS: | 1000            | 2.97569         |
PROGRESS: | 2000            | 3.29291         |
PROGRESS: | 3000            | 3.59487         |
PROGRESS: | 4000            | 3.84412         |
PROGRESS: | 5000            | 4.10858         |
PROGRESS: | 6000            | 4.37963         |
PROGRESS: | 7000            | 4.6265          |
PROGRESS: | 8000            | 4.87737         |
PROGRESS: | 9000            | 5.09781         |
PROGRESS: +-----------------+-----------------+
PROGRESS: Finished training in 7.55179s

Applying personalized model to make song recommendations

personalized_model.recommend(users=[users[0]])
user_id song score rank
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Fantasy - The xx 0.037720015587 1
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Walk In The Park - Beach
House ...
0.02976011994 2
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Lover Of Mine - Beach
House ...
0.0273156899811 3
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Used To Be - Beach House 0.0258316352834 4
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Norway - Beach House 0.0219293953923 5
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Take Care - Beach House 0.021579303806 6
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Paper Gangsta - Lady GaGa 0.0204163968481 7
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Beautiful_ Dirty_ Rich -
Lady GaGa ...
0.0202445750201 8
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Real Love - Beach House 0.0195482216248 9
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Boys Boys Boys - Lady
GaGa ...
0.019074731889 10
[10 rows x 4 columns]
personalized_model.recommend(users=[users[1]])
user_id song score rank
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Cuando Pase El Temblor -
Soda Stereo ...
0.0194504525792 1
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Fireflies - Charttraxx
Karaoke ...
0.014473730789 2
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Love Is A Losing Game -
Amy Winehouse ...
0.0142865986808 3
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Marry Me - Train 0.0141334715267 4
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Secrets - OneRepublic 0.0135916683588 5
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
No Dejes Que... -
Caifanes ...
0.0134191754754 6
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Sehr kosmisch - Harmonia 0.0133987908186 7
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Y solo se me ocurre
amarte (Unplugged) - ...
0.0133210385369 8
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Te Hacen Falta Vitaminas
- Soda Stereo ...
0.0129302853556 9
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
OMG - Usher featuring
will.i.am ...
0.0127778293142 10
[10 rows x 4 columns]
personalized_model.get_similar_items(['The Cove - Jack Johnson'])
PROGRESS: Getting similar items completed in 0.007283
song similar score rank
The Cove - Jack Johnson Moonshine - Jack Johnson 0.179487179487 1
The Cove - Jack Johnson Holes To Heaven - Jack
Johnson ...
0.111969111969 2
The Cove - Jack Johnson Country Road - Jack
Johnson / Paula Fuga ...
0.0839694656489 3
The Cove - Jack Johnson Supposed To Be - Jack
Johnson ...
0.0740740740741 4
The Cove - Jack Johnson Let It Be Sung - Jack
Johnson / Matt Costa / ...
0.0736842105263 5
The Cove - Jack Johnson Wrong Turn - Jack Johnson 0.0709677419355 6
The Cove - Jack Johnson Questions - Jack Johnson 0.0687022900763 7
The Cove - Jack Johnson Rainbow - Jack Johnson /
G. Love ...
0.0649350649351 8
The Cove - Jack Johnson Posters - Jack Johnson 0.0593607305936 9
The Cove - Jack Johnson If I Could - Jack Johnson 0.0588235294118 10
[10 rows x 4 columns]
song_data[0]
{'artist': 'Jack Johnson',
 'listen_count': 1,
 'song': 'The Cove - Jack Johnson',
 'song_id': 'SOAKIMP12A8C130995',
 'title': 'The Cove',
 'user_id': 'b80344d063b5ccb3212f76538f3d9e43d87dca9e'}

Quantitative Comparison between the models

%matplotlib inline
model_performance = graphlab.compare(test_data, [popularity_model, personalized_model], user_sample=0.05)
compare_models: using 2931 users to estimate model performance
PROGRESS: Evaluate model M0
PROGRESS: recommendations finished on 1000/2931 queries. users per second: 1379.31
PROGRESS: recommendations finished on 2000/2931 queries. users per second: 1413.19

Precision and recall summary statistics by cutoff
+--------+-----------------+------------------+
| cutoff |  mean_precision |   mean_recall    |
+--------+-----------------+------------------+
|   1    | 0.0276356192426 | 0.00704457697805 |
|   2    | 0.0274650290003 | 0.0148879287057  |
|   3    | 0.0262708973047 | 0.0220417769804  |
|   4    | 0.0242238143978 | 0.0261965554443  |
|   5    | 0.0219037871034 |  0.029571775887  |
|   6    | 0.0212669168657 | 0.0336708194948  |
|   7    | 0.0201783886533 | 0.0374884100319  |
|   8    | 0.0191487546912 | 0.0406333667849  |
|   9    | 0.0179309299064 | 0.0425615155912  |
|   10   | 0.0172296144661 | 0.0452822737367  |
+--------+-----------------+------------------+
[10 rows x 3 columns]

PROGRESS: Evaluate model M1
PROGRESS: recommendations finished on 1000/2931 queries. users per second: 636.026
PROGRESS: recommendations finished on 2000/2931 queries. users per second: 652.271

Precision and recall summary statistics by cutoff
+--------+-----------------+-----------------+
| cutoff |  mean_precision |   mean_recall   |
+--------+-----------------+-----------------+
|   1    |  0.196178778574 | 0.0624035480612 |
|   2    |  0.165301944729 | 0.0989251209952 |
|   3    |  0.144433071762 |  0.126315233442 |
|   4    |  0.128283862163 |  0.149273539588 |
|   5    |  0.115114295462 |  0.165037712581 |
|   6    |  0.105709086774 |  0.180392416447 |
|   7    | 0.0979675391139 |  0.193083833411 |
|   8    | 0.0907540088707 |  0.202181627936 |
|   9    | 0.0851813942909 |  0.212276173919 |
|   10   | 0.0802115319004 |  0.222459311226 |
+--------+-----------------+-----------------+
[10 rows x 3 columns]

Model compare metric: precision_recall
graphlab.show_comparison(model_performance,[popularity_model, personalized_model])

Counting unique users

users_kanye_west = song_data[song_data['artist'] == 'Kanye West' ]
users_kanye_west.head()
user_id song_id listen_count title artist
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SOBXHDL12A81C204C0 1 Stronger Kanye West
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SOMLMKI12A81C204BC 1 Champion Kanye West
5d5e0142e54c3bb7b69f548c2
ee55066c90700eb ...
SORFASW12A81C22AE7 2 Stronger Kanye West
537340ff896dea11328910013
cfe759413e1eeb3 ...
SOBXHDL12A81C204C0 2 Stronger Kanye West
7dd192c8bd4f27f573cb15e86
56442aadd7a9c01 ...
SOOLPFK12A58A7BDE3 5 Flashing Lights Kanye West
8fce200f3912e9608e3b1463c
db9c3529aab5c08 ...
SOBXHDL12A81C204C0 2 Stronger Kanye West
8fce200f3912e9608e3b1463c
db9c3529aab5c08 ...
SOIBSWV12A6D4F6AB3 1 Through The Wire Kanye West
a56bf59af6edc5ae6c92d61dd
d214989332864e8 ...
SONGNHO12AB0183915 1 Bad News Kanye West
8fa25e588aeedaa539674babb
75729ac9f31f15e ...
SOOLPFK12A58A7BDE3 1 Flashing Lights Kanye West
e8612acfb1572297ea0eaaa1f
27927d55fdcec65 ...
SOIYWPZ12A81C204EF 2 Homecoming Kanye West
song
Stronger - Kanye West
Champion - Kanye West
Stronger - Kanye West
Stronger - Kanye West
Flashing Lights - Kanye
West ...
Stronger - Kanye West
Through The Wire - Kanye
West ...
Bad News - Kanye West
Flashing Lights - Kanye
West ...
Homecoming - Kanye West
[10 rows x 6 columns]
len(users_kanye_west)
3775
unique_users_kanye_west = users_kanye_west['user_id'].unique()
len(unique_users_kanye_west)
2522
users_foo_fighters = song_data[song_data['artist'] == 'Foo Fighters' ]
len(users_foo_fighters)
3429
users_foo_fighters.head()
user_id song_id listen_count title artist
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SODACBL12A8C13C273 1 Learn To Fly Foo Fighters
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SOFGUAY12AB017B0A8 1 Stacked Actors Foo Fighters
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SOMSQJY12A8C138539 1 Breakout Foo Fighters
b80344d063b5ccb3212f76538
f3d9e43d87dca9e ...
SOVHRGF12A8C13852F 1 Generator Foo Fighters
12768858f6a825452e412deb1
df36d2d1d9c6791 ...
SODACBL12A8C13C273 4 Learn To Fly Foo Fighters
12768858f6a825452e412deb1
df36d2d1d9c6791 ...
SOQLUTQ12A8AE48037 2 The Pretender Foo Fighters
f47116f998e030f2dab275b81
fb2a04a9dc06c33 ...
SOLTAEJ12A8C13F793 6 What If I Do? Foo Fighters
5e161b9e14f303a0cef2d3f44
d07dd946549f89f ...
SOLJYEI12A8C13F7B3 2 Friend Of A Friend Foo Fighters
e4c05157f8cebdf3b9d689c44
1ba97c5ed5db05b ...
SOFGUAY12AB017B0A8 1 Stacked Actors Foo Fighters
e4c05157f8cebdf3b9d689c44
1ba97c5ed5db05b ...
SOFZVOT12A8C1408E9 1 Skin And Bones Foo Fighters
song
Learn To Fly - Foo
Fighters ...
Stacked Actors - Foo
Fighters ...
Breakout - Foo Fighters
Generator - Foo Fighters
Learn To Fly - Foo
Fighters ...
The Pretender - Foo
Fighters ...
What If I Do? - Foo
Fighters ...
Friend Of A Friend - Foo
Fighters ...
Stacked Actors - Foo
Fighters ...
Skin And Bones - Foo
Fighters ...
[10 rows x 6 columns]
unique_users_foo_fighters = users_foo_fighters['user_id'].unique()
len(unique_users_foo_fighters)
2055
users_taylor_swift = song_data[song_data['artist'] == 'Taylor Swift' ]
len(users_taylor_swift)
6227
unique_users_taylor_swift = users_taylor_swift['user_id'].unique()
len(unique_users_taylor_swift)
3246
users_lady_gaga = song_data[song_data['artist'] == 'Lady GaGa' ]
len(users_lady_gaga)
4129
unique_users_lady_gaga = users_lady_gaga['user_id'].unique()
len(unique_users_lady_gaga)
2928

Using groupby-aggregate to find the most popular and least popular artist

total_listen_count = song_data.groupby(key_columns='artist', operations={'total_count': graphlab.aggregate.SUM('listen_count')})
total_listen_count.head()
artist total_count
The Dells 274
Tag Team 314
Danger Doom 561
Rata Blanca 714
The Pogues 141
Diana Ross 302
Kurtis Blow 239
Uniikki 429
Make the Girl Dance 378
Jorge Gonzalez 682
[10 rows x 2 columns]
total_listen_count.sort('total_count',ascending=False)
artist total_count
Kings Of Leon 43218
Dwight Yoakam 40619
Björk 38889
Coldplay 35362
Florence + The Machine 33387
Justin Bieber 29715
Alliance Ethnik 26689
OneRepublic 25754
Train 25402
The Black Keys 22184
[3375 rows x 2 columns]
Note: Only the head of the SFrame is printed.
You can use print_rows(num_rows=m, num_columns=n) to print more rows and columns.
sorted_total_listen_count =  total_listen_count.sort('total_count',ascending=False)
sorted_total_listen_count.head()
artist total_count
Kings Of Leon 43218
Dwight Yoakam 40619
Björk 38889
Coldplay 35362
Florence + The Machine 33387
Justin Bieber 29715
Alliance Ethnik 26689
OneRepublic 25754
Train 25402
The Black Keys 22184
[10 rows x 2 columns]
sorted_total_listen_count[0]
{'artist': 'Kings Of Leon', 'total_count': 43218}
sorted_total_listen_count[-1]
{'artist': 'William Tabbert', 'total_count': 14}
sorted_total_listen_count[-2]
{'artist': 'Reel Feelings', 'total_count': 24}
len(sorted_total_listen_count)
3375
sorted_total_listen_count[3374]
{'artist': 'William Tabbert', 'total_count': 14}

Using groupby-aggregate to find the most recommended songs

train_data,test_data = song_data.random_split(.8,seed=0)
personalized_model_problem = graphlab.item_similarity_recommender.create(train_data,
                                                                user_id='user_id',
                                                                item_id='song')
PROGRESS: Recsys training: model = item_similarity
PROGRESS: Warning: Ignoring columns song_id, listen_count, title, artist;
PROGRESS:     To use one of these as a target column, set target = <column_name>
PROGRESS:     and use a method that allows the use of a target.
PROGRESS: Preparing data set.
PROGRESS:     Data has 893580 observations with 66085 users and 9952 items.
PROGRESS:     Data prepared in: 2.44033s
PROGRESS: Computing item similarity statistics:
PROGRESS: Computing most similar items for 9952 items:
PROGRESS: +-----------------+-----------------+
PROGRESS: | Number of items | Elapsed Time    |
PROGRESS: +-----------------+-----------------+
PROGRESS: | 1000            | 1.09591         |
PROGRESS: | 2000            | 1.2529          |
PROGRESS: | 3000            | 1.39995         |
PROGRESS: | 4000            | 1.54215         |
PROGRESS: | 5000            | 1.67863         |
PROGRESS: | 6000            | 1.80773         |
PROGRESS: | 7000            | 1.9314          |
PROGRESS: | 8000            | 2.04903         |
PROGRESS: | 9000            | 2.15834         |
PROGRESS: +-----------------+-----------------+
PROGRESS: Finished training in 2.50746s
subset_test_users = test_data['user_id'].unique()[0:10000]
len(subset_test_users)
10000
recommended_songs = personalized_model_problem.recommend(subset_test_users,k=1)
PROGRESS: recommendations finished on 1000/10000 queries. users per second: 723.767
PROGRESS: recommendations finished on 2000/10000 queries. users per second: 729.502
PROGRESS: recommendations finished on 3000/10000 queries. users per second: 730.974
PROGRESS: recommendations finished on 4000/10000 queries. users per second: 732.245
PROGRESS: recommendations finished on 5000/10000 queries. users per second: 730.881
PROGRESS: recommendations finished on 6000/10000 queries. users per second: 729.537
PROGRESS: recommendations finished on 7000/10000 queries. users per second: 729.793
PROGRESS: recommendations finished on 8000/10000 queries. users per second: 731.585
PROGRESS: recommendations finished on 9000/10000 queries. users per second: 731.684
PROGRESS: recommendations finished on 10000/10000 queries. users per second: 732.331
recommended_songs.head()
user_id song score rank
b048033af070b5dbb18d5d0e5
f334c9390611b04 ...
Fantasy - The xx 0.037720015587 1
c66c10a9567f0d82ff31441a9
fd5063e5cd9dfe8 ...
Cuando Pase El Temblor -
Soda Stereo ...
0.0194504525792 1
ed04954d5b6001c7945c6ac71
686c3bd4ecdacb3 ...
Coming Your Way - Iration 0.031314214241 1
b1e6e9563da324641e644c769
b7edf202186de47 ...
Pimpa's Paradise - Damian
Marley / Stephen Marl ...
0.0694444444444 1
02f015d32ac2cd1e52d26e3ec
36048711dd5711b ...
Where The Boat Leaves
From (Album) - Zac Brown ...
0.063530766032 1
91b986eeb5d81eec60dc4b136
f04c0cfd662d658 ...
Jezebel - Sade 0.0588785769489 1
f933855d675606737fdc191e9
edff7625d08aae8 ...
Schießt die Deutschen
raus - Mario Lang ...
0.0357374917866 1
4867d5516a280db13695b9b9c
7ce6b574f34c6b4 ...
Two Steps_ Twice - Foals 0.0104654895666 1
968f1baebc490d3c6999ee6c8
5c5cab8b726b347 ...
Me_ Myself And I -
Beyoncé ...
0.0183084820675 1
c067c22072a17d33310d7223d
7b79f819e48cf42 ...
Grind With Me (Explicit
Version) - Pretty Ricky ...
0.0459424433009 1
[10 rows x 4 columns]
song_recommended_count =  recommended_songs.groupby(key_columns='song', operations={'count': graphlab.aggregate.COUNT()})
song_recommended_count.head()
song count
Wrong Turn - Jack Johnson 9
Welcome Home (Sanitarium)
- Metallica ...
4
Wake Up Call - Maroon 5 2
The Pyramids - Tim Wilson 1
U.R.A Fever - The Kills 3
Slow Down - Alicia Keys 1
If This Is Love - The
Saturdays ...
1
Marshall Mathers - Eminem 1
Electricity - Moby 1
Hoodoo - Muse 3
[10 rows x 2 columns]
song_recommended_count[-1]
{'count': 2, 'song': 'Amame - Juanes'}
sorted_song_recommended_count = song_recommended_count.sort('count',ascending=False)
sorted_song_recommended_count.head()
song count
Undo - Björk 447
Secrets - OneRepublic 373
Revelry - Kings Of Leon 228
You're The One - Dwight
Yoakam ...
179
Fireflies - Charttraxx
Karaoke ...
124
Hey_ Soul Sister - Train 117
Horn Concerto No. 4 in E
flat K495: II. Romance ...
95
OMG - Usher featuring
will.i.am ...
68
Sehr kosmisch - Harmonia 66
Dog Days Are Over (Radio
Edit) - Florence + The ...
52
[10 rows x 2 columns]



Credits Machine Learning Foundations: A Case Study Approach