A better default scoring script for Amarok 2

Dan Meltzer parallelgrapefruit at gmail.com
Sun Dec 14 17:50:53 CET 2008


On Sat, Dec 13, 2008 at 10:33 PM, Karthik Periagaram
<karthikp at gatech.edu> wrote:
> Hi all,
>
> Me again. Here are the three changes that need to be made to the codebase to
> improve the default scoring algorithm.

Hi,

I support this change for 2.1 (I was the one who told him to mail it
in originally).

I think this is a nicer algorithym, but I'm not quite sure whether or
not the masses will be up in arms if their scoring algorthym changes
(will they even notice?)
Dan,
>
> 1) File: src/Amarok.h line 90
> Change function definition of computeScore() to the following:
>
> inline double computeScore( double oldScore, int playCount, double
> playedFraction, int rating )
> {
>        double newScore;
>        if( rating == 0 )
>                rating = 5;
>        if( playCount == 0 )
>                oldScore = 0;
>        newScore = ( ( 5 * rating + 0.5 * oldScore ) + ( 100 - ( 5 * rating + 0.5 *
> oldScore ) ) * ( playCount / ( playCount + 1 ) ) ) * ( 0.9 + 0.1 *
> playedFraction );
>        return newScore;
> }
>
> Then,
>
> 2) File: collection/sqlcolllection/SqlMeta.cpp line 755
> Change function call
> setScore( Amarok::computeScore( score(), playCount(), playedFraction, rating()
> ) );
>
> 3) File: collection/nepomukcollection/NepomukTrack.cpp line 316
> Change function call
> setScore( Amarok::computeScore( score(), playCount(), playedFraction, rating()
> ) );
>
> With these changes, the score algorithm change is complete. The new score will
> agree with your rating more and will approach 100 as the song playcount tends
> to infinity. Thus, it is a better algorithm to calculate how much the song is
> liked by the user.
>
> To test the change, it helps to set all scores to zero. A bit of mysql-fu
> should do it (though I don't know how to play with those things). I just nuked
> the contents of ~/.kde4/share/apps/amarok, but that might not be an ideal
> solution to most people. :)
>
> Again, if you have questions, do ask me and I'll explain why this is awesome
> and how when plotted, this function looks really cool. :) Thanks all, for
> helping me put this together.
>
> (markey: I figured #include <cmath> might not be needed after all- I replaced
> exp( -x ) with 1/(x+1) and it works equally fine!)
>
> Karthik
> _______________________________________________
> Amarok-devel mailing list
> Amarok-devel at kde.org
> https://mail.kde.org/mailman/listinfo/amarok-devel
>


More information about the Amarok-devel mailing list