From NetEase cloud music to algorithm experience

Source: Internet
Author: User

In the knowledge to see the question "NetEase Cloud Music song single recommendation algorithm is how?" "I also thought about this question, why NetEase cloud can do so well, recommended so in place, their algorithm team is how to describe a song, describe a user's." After entering this question, I read the first answer of the ranking, answer the main introduction of an algorithm, "latent factor (latent Factor)". After reading this algorithm let me to the algorithm this logic toy, have some new experience.

Here I try to describe this "latent factor (latent Factor)" algorithm, which is illustrated by the example of Nick Lee:

This assumes that we have three users: Zhang San, John Doe, Harry; There are music categories: small fresh, heavy taste, elegant, sentimental, May days, and there are four music: music A, music B, music C. We can construct the matrix first:

First, the user-potential factor matrix Q, indicating that different users of the degree of preference for the use of elements, 1 representatives like, 0 is not like. such as the following:

Second, the potential factor-music matrix P, that each kind of music contains a variety of elements of the composition, such as the following table, music A is a small fresh music, containing small fresh this latent factor ingredient is 0.9, the ingredients of the heavy taste is 0.1, the elegant ingredient is 0.2 ...

Using these two matrices, we can conclude that Zhang San's liking for music A is: Zhang San's preference for small freshness * Music A contains a small fresh ingredient + a preference for heavy tastes * Music A contains ingredients with heavy flavors + Elegant Preference * Music A contains elegant ingredients + ...

namely: 0.6*0.9+0.8*0.1+0.1*0.2+0.1*0.4+0.7*0=0.69

Each user's calculation of each song will give different users a matrix of scores for different songs. (Note that the wave line here represents the estimated score, and then we will use R without the wavy line to indicate the actual score):

So our team Zhang San recommended the highest score in the four songs of B, John Doe recommended the highest score of C, Harry recommended B.

If the matrix is represented as:

Here's the question, how does this potential factor (latent factor) get it?

It is obviously unrealistic to have a huge amount of data that allows users to classify music and tell us their preferences, in fact, we can get only the user behavior data. We use the "@ Tai" the Quantitative standard: Single loop = 5, share = 4, collection = 3, active play =2, listen to = 1, skip =-2, Pull Black =-5, in the analysis can get the actual score matrix R, that is, the input matrix is probably this way:

In fact, this is a very, very sparse matrix because most users hear only a few of the entire music. How can we use this matrix to find potential factors? The main application here is the UV decomposition of the matrix. That is, the above scoring matrix is decomposed into two low-dimensional matrices, using the product of Q and P two matrices to estimate the actual scoring matrix, and we want to estimate the scoring matrix

Figure: UV decomposition

and the actual scoring matrix do not differ too much, that is, to solve the following objective function:

This involves the optimization theory, in practical applications, it is often to add 2-norm penalty, and then use the gradient descent method can be obtained by this p,q two matrix estimates. We're not going to start talking here. For example, the example we gave above can be decomposed into such two matrices:

The two matrices multiply to get the estimated score matrix:

After the user has listened to the music culling, select the highest score music recommendation to the user can (red body word).

In this example user 7 and user 8 have strong similarities:

From the recommended results, it is recommended that the other high-scoring music:

The above is an example of a potential factor algorithm, thanks again to Nick Lee.

Why would I write this blog?

Because when I saw this answer, I thought about the scene when I was doing a mathematical modeling contest, and then two people were working day and night to study how to model the problem, and how to get the data needed in the model after modeling using the achievable method. In fact, now look back at modeling a problem when we determine a good problem to solve the requirements, that is, the goal. will be divided into two categories of people:

One is to find a solution to a model, and then put the problem into the model, because the model has been in the details of the very good processing, this time only need to run this model to verify.

The other is to determine the final parameters of the problem description, and then to build the model according to these parameters, but the generation of these parameters do not have a ready-made method to obtain, this time we need to find a way to get this parameter, as the "latent factor" algorithm in the description of the song, from "Figure UV decomposition" We can see that this model is actually not really small fresh, May days of this classification, "figure UV decomposition" in the factor in this solution is variable.

So through the above analysis, in the face of NetEase cloud Music recommendation Analysis, if the use of latent factor algorithm, then this process is:

We envision a model where user's love for different kinds of music, the degree of element in music, and the collection of these two data can be used to find out how much a particular user is interested in a particular music, and then to recommend the user according to this result. In this analysis, the first thing we think about is how to classify music, how to determine the best classification, the result of the algorithm here, and not to achieve the classification of music, but through the user to listen to the operation of the song, we can assume that this operation from the private FM, Through this FM we can get users to listen to the operation of the song: Single Loop, share, collection, active play, listen, skip, pull black, we scored these operations: Single cycle = 5, share = 4, collection = 3, active play =2, listen to 1, skip =-2, pull black =-5. Then get the user a basic preference for each song, but only according to the data we still, we can not recommend the song, because we only got the user to have heard the song's preferences, we have not heard of the songs we know nothing about. But through the UV decomposition we can get a factor, this factor the user and music linked, whether it is heard or not heard. The technical processing of this model is only a UV decomposition.

So why say "from NetEase Cloud music to algorithm experience"? In fact, there are many programmers who want to do this.

First, the number of users is very large, the number of songs is also very large, then the user to the music operation of the matrix will be a very large matrix, and considering that each user listen to the size of the amount of songs relative to the number of music library is very small, so this matrix must be a fairly sparse sparse matrix, So the sparse matrix of the various operations at this time to come in handy, and then break into the brains of developers is the sparse representation of the matrix, sparse matrix transpose, sparse matrix subtraction, UV decomposition algorithm. When I was a big hit, I saw the Prince algorithm, that is, a gene prediction algorithm, I was in writing this algorithm, or in writing sorting algorithm, did not feel what difficulty exists, that is to think: "Gee, these are quoted so many times of the paper, the classic algorithm why it is so simple, In my opinion they are not simple statistics, and then through the pattern analysis results well, good-looking is the best algorithm, bad is bad algorithm. At that time there was no "good" in the algorithm, Dijkstra's algorithm didn't know where to go. Is that what I call a study to write these low-level algorithms for the statisticians? ACM doesn't know where it's going to be more challenging than you. But now I understand that I as a programmer or with that is not what I should and those scientists to compare the place, I should do is to complete an intelligent system, do not need to think of me the same "code animal" write those low-level statistical code (in fact, is not very low, some still difficult, hey), This system is the direction of our programmers ' efforts.

Of course, as the last fortunate to get the big touch of Ali Middleware said that the programmer's final development is not the technical level, the level of writing code but sense. Now my understanding of this sense is that the problem is not worth me to abstract out, it is not worth me to write an intelligent system for him (so to speak NetEase Cloud recommendation system is the core of this product).

Look at yourself on this road out of the world!

From NetEase cloud music to algorithm experience

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.