Given an artist name, return a JSON encoded string which represents an array of the form:
{ 'image' => 'http://image of artist', 'similarities' => [ ['artist', 'artist2', simliarity1], ['artists', 'artist3', similarity2], ... ] }
Where relevance
is a float 0-1 where 0 is not related at all and 1 is virtually the same artist. This list should never have artistID1 = artistID2
.
This program prints to STDOUT
They have a web service which gives similar artists to a given artist and also gives you a score for the similarity.
We can access this through YQL through the lastfm.artist.getsimilar
table with the following query:
select * from lastfm.artist.getsimilar where api_key="2116c8771c6a03bb89c24a0935bea3a4" and artist="Lady Gaga" and limit="1000"
The limit="1000"
doesn't actually give 1000 artists, but it gives 250 it looks like. This should be sufficient for our purposes.
I was thinking that because this service is slow (0.5s for each request) we could cache results in our own database for the hackathon and that way have a speedier demo when we ask about a lot of artists
Simulator for physics in the javascript.
The model will be as follows:
- There is a central point everything is connected to with a spring with a pre-defined spring constant.
- Every node then repels each other node with a force inversely proportional to the relevance of the two objects
- All points start at random locations on a sphere with a certain radius
Then we hit go. The function move()
will be as follows:
-
Global arrays:
objs
: an array of yahoo IDs for each artist. The position of the ID in this array represents the position in the following arrays.pos
: an array of 3 element arrays wherex_i
is the position of thei
'th object in spaceveloc
: an array of 3 element arrays wherev_i
is the components of the velocity of thei
'th element.relevance
: this is a hash which stores all the relevances between two objects.relevance[i][j]
only works ifi < j
and will give you the relevance betweeni
andj
-
The location array is initialized randomly and the velocity array is initially all 0.
-
move()
will be called every so often and it will represent a time lapse of some number of seconds.- Upon calling move, all of the object's locations will be updated according to the springs/repulsions.
- The arrays
pos
andveloc
must be updated
This does things, flesh this out more
People have artists on facebook. This is awesome and we should use this. You enter in a bunch of usernames and you get all of the artists of the users and do fancy stuff with them.
This needs to be a function which takes a list of facebook usernames and then gives a mapping of username to list of artists listed on facebook:
function(['alex.crichton', 'kellyhope']) # then yields: { 'alex.crichton' => ['goats', 'more goats', 'GHB', ...], 'kellyhope' => ['awful artists 1', 'Fall Out Boy', ...] }
- Get a list of artists from a service (uploaded, last.fm, pandora?) and show how they group together
- Get a list of artists for you and your friends, color code all the objects, then see where the equilibrium is to find your similar artist tastes.
- Given an artist, show similar artists about them.