Vector space: how to implement a simple music recommendation system?

Vector space: how to implement a simple music recommendation system?

Not only can select songs to listen to, but also according to taste preferences of your songs, recommend songs you might like

Parsing algorithm

  • You find with a similar user taste preferences, they want to hear the songs recommended to you
  • Find your favorite songs with characteristics similar to the songs, these songs recommended to you

1. make recommendations based on similar users

Similar to listen to the songs of people seen as similar to the taste of the user, whom co-favorite songs and more, and who say the taste is similar. Users only need to traverse all, compared to the number of each user together with your favorite songs, and sets a threshold value, if you and a number of user favorite songs together exceed this threshold, this user favorite but you have not heard of recommend to your song

How to define the level of user enthusiasm for a song?

To the extent defined by the user's favorite act, each action to define a score, the higher the score, the higher the degree of love

Single cycle share it Collect search for After hearing Have not heard jump over
5 4 3 2 1 0 -1

With the user whether it tastes similar to what degree after favorite songs correspondence table to determine if two users?

For the similarity between two users can use another distance, Euclidean distance is the Euclidean distance is used to calculate the distance between two vectors.

Vector and distance:

Is a one-dimensional line, indicates a location of a single one-dimensional numbers 1,2,3; is a two-dimensional plane, with a (1,3) or the like showing a two-dimensional space location; three-dimensional space is a three-dimensional space by (1,3,5), etc., by a location K-dimensional space can be used (x1, x2, ..., xk) said that this is the vector representation, how to calculate the distance between two vectors it?
two dimension ( x 1 , x 2 ) versus ( Y 1 , Y 2 ) d = ( x 1 y 1 ) 2 + ( x 2 y 2 ) 2 The distance d between the two-dimensional (x1, x2) and (y1, y2) = \ sqrt {(x1-y1) ^ 2 + (x2-y2) ^ 2}

( x 1 , x 2 , x 3 ) ( y 1 , y 2 , y 3 ) d = ( x 1 y 1 ) 2 + ( x 2 y 2 ) 2 + ( x 3 y 3 ) 2 Between (y1, y2, y3) a three-dimensional distance d (x1, x2, x3) = \ sqrt {(x1-y1) ^ 2 + (x2-y2) ^ 2 + (x3-y3) ^ 2}

K ( x 1 , x 2 , x 3 x k ) ( y 1 , y 2 y k ) d = ( x 1 y 1 ) 2 + ( x 2 y 2 ) 2 + + ( x k y k ) 2 The distance d between the K-dimensional (x1, x2, x3 ... xk) and (y1, y2 ... yk) = \ sqrt {(x1-y1) ^ 2 + (x2-y2) ^ 2 + ... + (xk-yk ) ^ 2}

To every level of user enthusiasm of all the songs is represented by a vector, calculates the Euclidean distance between two vectors, as two user's taste similar measure of the degree, if you Bob and Euclidean distance minimum, explain to your taste with the most similar

You: (5,3 ......)

Hsiao Ming: (4, 5 ...)

Wang: (1,0 ......)

Red: (3,0 ......)

White: (0,0 ......)

You and Xiao Ming, Wang, red, white Euclidean distance are:

38 \sqrt{38} 117 \sqrt{117} 61 \sqrt{61} 118 \sqrt{118} So with the most similar taste Xiao Ming

2 to make recommendations based on similar songs

If this is a new user, not collected enough data behavior can recommend songs based on similar, if a song is similar with your favorite songs, put recommend it to you

How to quantify the degree of similarity between the two songs?

Two songs, if you like to listen to the people are similar, reflecting the two sides of the song is quite similar, user-based criteria to define the degree of love, each user has a different degree of love songs, to define the degree of love, based on the recommended method is similar to a user, for each user, will love the degree of each song as a vector, based on similar ideas recommended songs, for each song, each user's score as a vector, with each song vector expressed by the Euclidean distance between the vector calculation, the smaller the distance, the more similar the two songs, find a higher degree of his favorite songs a user has listened to songs, and finding out these songs are very similar to other songs recommended

Extended summary

It is the recommended system is the most typical problems

Published 75 original articles · won praise 9 · views 9168

Guess you like

Origin blog.csdn.net/ywangjiyl/article/details/104770386