Last.fm tool: Compare user tag clouds'; printMessages( "compare" ); echo 'With the form below, you can compare two Last.fm users, based on their personal musical tag clouds. This approach is different from the approach used by Last.fm, where users in the population are compared based on the common artists in their playlist. We feel that tag clouds give a better interpretation of musical preferences than other methods (compare Last.fm\'s own Taste-o-meter), as more descriptive meaning is embedded in tags (like, genres), rather than (often unknown) artists. The script also shows important differences among the tag clouds.
Please be patient, the script may require up to two full minutes to process your request. The script needs to download and analyze your profiles and their top 50 artists. Last.fm policy states that we can only make 1 database query per second, and the script\'s worst case scenario requires 102 requests. Caching is used to lower the load on user (cache = 10 minutes) and artist (cache = 1 week) database requests, so the scripts usually only take ten-something seconds. Similarity-o-meter"; $similartags; $similarmax = 0; foreach( $tags1 as $tag => $value ) { $similartags[ $tag ] = min( $tags1[ $tag ], $tags2[ $tag ] ); if( min( $tags1[ $tag ], $tags2[ $tag ] ) > $similarmax ) $similarmax = min( $tags1[ $tag ], $tags2[ $tag ] ); } foreach( $tags2 as $tag => $value ) { $similartags[ $tag ] = min( $tags1[ $tag ], $tags2[ $tag ] ); if( min( $tags1[ $tag ], $tags2[ $tag ] ) > $similarmax ) $similarmax = min( $tags1[ $tag ], $tags2[ $tag ] ); } $similarmax = 0; $similarlength = 0; foreach( $similartags as $tag => $value ) { $similarlength += $value * $value; if( $value > $similarmax ) $similarmax = $value; } // $similarmax = min( $max1, $max2 ); $similarlength = sqrt( $similarlength ); $similarpercentage = round( $similarlength * 10000 ) / 100; ksort( $similartags ); if( $similarpercentage < 33.333 ) { $similarity = "low"; } else if( $similarpercentage < 66.667 ) { $similarity = "moderate"; } else { $similarity = "high"; } echo "The similarity between users $user1 and $user2 is $similarity, at "; echo " You can notify your friend of your similarity, by copy/pasting the following BBcode to your friend's shoutbox! "; echo '
Method"; echo "For each of these users, we construct their tag vectors. A tag vector is a highly dimensional vector where each dimension denotes a tag used for the user's top artists, and the value of the element at that dimension denotes the importance of the tag in the user's listening profile. A tag cloud is the textual depiction of such a tag vector. You can read more about tag clouds here. "; echo " To find similarities among users, i.e., the common genres in these users' tag clouds, we construct a new tag vector where each tag's weight is given by the minimum of the tag's weights in the tag vectors of the users. The length of this vector is used to denote the similarity between two users. "; echo " Musical tag clouds"; echo "The following tag cloud represents the musical preferences of $user1 (more details). "; echo 'The next tag cloud depicts the profile of $user2 (more details). "; echo 'Similarity cloud"; echo "This tag cloud represents the overlap in musical preferences (similarities have been scaled up for easy reading). "; echo 'Difference cloud"; echo "To find the differences among these users' tag clouds, we simply subtract one user's tag vector from the other user's. "; $differenttags; $differentmax = 0; foreach( $tags1 as $tag => $value ) { $differenttags[ $tag ] = $tags1[ $tag ] - $tags2[ $tag ]; } foreach( $tags2 as $tag => $value ) { $differenttags[ $tag ] = $tags1[ $tag ] - $tags2[ $tag ]; } $differentmax = 0; $differentlength = 0; foreach( $differenttags as $tag => $value ) { $differentlength += $value * $value; if( abs( $value ) > $differentmax ) $differentmax = abs( $value ); } // $differentmax = max( $max1, $max2 ); $differentlength = sqrt( $differentlength ); arsort( $differenttags ); echo " This tag cloud highlights the differences in musical preferences. Blue tags are more prominent in $user1's preferences, where red tags belong to $user2's prefered genres (scaled up for easy reading). "; echo ' |
|||||
|