random - Algorithm for picking thumbed-up items -
I have software like pandora where a user can thumb a song or a thumb over a song. The software, called Silverlight + C #, is a language and platform-neutral question.
My software must choose a song based on the user's preferences. I need a good algorithm for this
I want my software to choose one song to run the following requirements:
-
Should be preferred, and regular Is played in the form
-
The undefined song (Neither up or down thumb) should still be played;
-
The songs below must hardly be played.
-
Whatever the algorithm, the song should not be repeated again.
Looking at these design decisions, is there some good algorithm here?
I have some code that catches all the songs, songs liked, and dislikes song:
var allsongs = ... var likes song = all song. Where (S => S.LikedByUser (...)); Var dislike songs = all songs Where (S => s.DislikedByUser (...));
Any simple idea to choose a good song for the user?
You can weigh the songs; It is said that every song is initially a score of 1.0, 0.5 if it is thumbed down and 1.5 is missed, then you choose a random element from the set of all the digits, along with its probability, its, um, weights by weight is done. I think all the weight loss from the sharp and dirty view of here. Choose a random number smaller than that amount. Loop all songs until the current version + SongWeight> RandomNumber (and currently the current + = SongWeight)
Surely you can make this arbitrarily more complicated by starting collaborative filtering :)
Imagine five songs, the first two were raised, the next one down the thumb, two neutral.
{1: 1.5, 2: 1.5, 3: 0.5, 4: 1, 5: 1}
The sum of this is 5.5. Now we take a random number & lt; 5.5 See also: This is 2.43789
Now we look for songs related to this random number.
Get started with the current = 0. The weight of the first song = 1.5 CurrentWight + 1.5 & lt; 2.43789 -> We continue, but increase the weight of this song currently.
Then currently the current = 1.5 = 1.5 next weight of the song: 1.5 again. But now, presentwight + 1.5 == 3> 2.43789 means that we chose the second song!
What you do here, basically choose a random place on one line, but increase the "area" on that line, if the song is chosen, then a song has to be selected.
It makes many recurrences or does not basically depend on how you increase / decrease the weight of the song.
Comments
Post a Comment