A better default scoring script for Amarok 2

Karthik Periagaram karthikp at gatech.edu
Tue Dec 9 03:07:11 CET 2008


Hi,

Amarok 1.x had this nifty score feature that calculated a score for the song 
based on the playcount and the percentage of the song that was played. This is 
supposed to be called once - at the end of the song play / skip.

The default script was this:

if( playCount <= 0 )
	newScore = ( oldScore + percentage ) / 2;
else
	newScore = ( ( oldScore * playCount ) + percentage ) / ( playCount + 1 );

This worked pretty nice, but had the following problems:
- It starts the score off at 75 after the first complete playthrough of a song
- If I skip the song, percentage ~ 0, so newScore < oldScore and is pretty 
punishing at low playcounts.

This led to a song that I heard only once having a score of 75 while a song I 
liked but skipped the second time to have half that.

So, I wrote a script to set the score a little less punishingly if I skip a 
song. I refined my first attempt and came up with the current version that 
does what I want it to do. If you have time, the blog entry is here  
http://karper.wordpress.com/2007/09/04/karperscore-redux/ If you have an old 
install of Amarok 1.x kicking around, you can get it from here: 
http://www.kde-apps.org/content/show.php?content=65466

It would be nice if this could be included in the new release as the default 
scoring script - with some changes. Here's what the script does to calculate 
the newScore based on the oldScore, playCount, percentage and the current 
rating of the song:

1) Initialize 

if( playCount <= 0 )
	oldScore = 0.0;

if( rating <= 0.0 )
	songrating = 5.0; //Use a default rating of 5 if the song provides none
else
	songrating = rating;

2) Factor in the three variables. Done step by step to show how each variable 
impacts the score...

guess1 = ( 5 * songrating ) + ( 0.5 * oldScore );
guess2 = guess1 + ( 100 - guess1 ) * ( 1 - exp( -0.01 * playCount) );
guess3 = guess2 * ( 0.9 + 0.001 * percentage );
newScore = guess3;

(Refer to blog for reasoning)

3) Possible improvements (***optional*** These might be interesting avenues to 
pursue if you would like to refine the model further.)
a) relative importance of the songrating, playcount and percentage could be 
changed by the user - sliders or something...

Let's call it songratingweight playCountweight and percentageweight (between 
0.0 
and 1.0)
 
guess1 = ( 10 * songratingweight * songrating ) + ( 1 - songratingweight ) * 
oldScore;
guess2 = guess1 + ( 100 - guess1 ) * ( 1 - exp( - 0.2 * playCountweight * 
playCount ) );
guess3 = guess2 * ( ( 1 - percentageweight ) + percentageweight * percentage 
);

By default, songratingweight = 0.5; playCountweight = 0.5; percentageweight = 
0.1; Setting any of them to zero will negate any effect the quantity has on 
the score.

b) These following suggestions are not my own, but suggestions people left on 
the blog that I think are well thought out. At the least they provide a window 
into the usage patterns of users who might use the score feature... 
- account for how long the song has been in the collection - playCountweight 
decreases gradually for older songs
- If the song is skipped too soon, the score is left unchanged.
if( percentage < $SMALLVALUE )
	newScore = oldScore;

Hope I was clear enough in explaining how my scoring script improved on the 
default script. If there is too little interest in this, perhaps this could be 
merged in as an auto-rating mechanism that shows up as a grayed rating till 
the user provides a rating...

Please let me know if you would like any further clarifications.

Thanks,
Karthik Periagaram


More information about the Amarok-devel mailing list