Experience on ranking algorithms

Source: Internet
Author: User

I have not been here for a long time. When I updated my personal status a few days ago, I also changed the word "Technical blog" to "a long-time blog ".

I haven't summarized my work and study for a long time. I can't go through any of them, so I will write a simple article here.ArticleThere is no new content, which is a summary of experience.

1. rankings

In general, rankings are indispensable for all major websites. One is the ranking of data provided to business partners, and the other is the list provided to users.

For example, Douban's new book list:

2. Create a simple ranking

Let's use Douban's new book list as an example to see how we can improve our list step by step.

In fact, the original version is very simple. Since it is a new book, we only need to get a book published recently. For example:

Select * from book where create_datetime> XXXX limit 0, 10;

In this way, our rankings are available.

3. Ranking Evolution

We should soon find some problems in this list:

A. There are a lot of books with low quality, including 21 days proficient in ASP. NET.

B. Some books have received little attention, so they are not worth launching.

To sum up, we should add two elements to the ranking: The score and the number of favorites. At this time, the solution is still very simple:

We actually only add two layers of filtering.

However, we still found many problems. For a book that has just been published, few people are concerned about it. The "bloom period" of a book should be around two or three months after it was published, at this time, we can't use time to sort data in this way. In addition, we still need the rank problem of the book entries. Now our rank is completely dependent on time.

4. Introduction of the half-life

Let's redesign the entire ranking.AlgorithmFirst, let's sort out our ideas. Since it is a new book list, we certainly need to enlarge the concept of time, but we cannot take too much time, instead, we should only make him part of various factors and assign him a large weight.

In addition, we don't think there is any difference between the books published yesterday and today, but it involves a process of gradual decline. The first thing we think of is a basic concept of high school physics: The half-life. Let's review the formula for the half-lifecycle:

M = m * (1/2) ^ (T/T)

Let's explain the meaning of this formula: m is the initial value, M is the value after the reaction, T is the reaction time, and T is the half-life.

We apply this formula to the publishing time, taking day as the Unit, and one week as the half-life to obtain such a function curve:

Next we will consider the score factor. In fact, there are two options to choose from. The first is to multiply the score factor with the previous score, and the second is to adopt the index method. However, because the previous time standard is <1, the function is a decreasing curve, so if we need to make the score evaluation work on the previous function curve, we need to reverse the score. Because we have filtered out books with less than 3 points, we have normalized the score parameters. (Here I use the second one, all relying on the preferences of shoot heads) to define our algorithm as follows:

The last factor is the number of people added to the favorites folder. We just need to convert it and then simply multiply it.

This gives us a relatively complete ranking.

5. Main Problems faced by rankings

In fact, rankings are more about business issues than algorithms. When we are faced with a ranking requirement, what we need is to sort out the rankings first. What factors do we need to consider, the percentage of these factors in the rank of the entire ranking. Then, we only need a simple multiplication or logarithm to solve most of the problems.

For most websites, there are just a few factors, such as the quality of items, the click rate of items, and the collection rate of items. The ranking of entries often appears on the homepage of a website, such as Baidu:

If we do not make any optimization, we will see the biggest problem facing the ranking: Matthew effect.

6. Matthew Effect

What is the Matthew effect? Let's take a look at the explanation on the Internet:

Matthew effect refers to the phenomenon that the stronger the strong, the weaker the weak, and is widely used in social psychology, education, finance, and other fields.

In our ranking, the more you listen to it, the more you listen to it. The more you listen to it, the more you see it in the ranking. This is a loop.

To solve the Matthew effect, the engineering community has put forward many algorithms, including the ranking algorithm of Reddit and Hacker News, and the half-time algorithm I have previously proposed.

Next we will introduce them one by one and compare their advantages and disadvantages.

7. Reddit Algorithm

Let's take a look at the Reddit algorithm formula:

In fact, the principle of Reddit is very simple. The post time minus the fixed time is used to indicate the freshness of a post, and X indicates the popularity of a post.ProgramThen, we will talk about the logarithm of this parameter because it is greatly affected by the heat, and the generated value is different from the other time result in the same order of magnitude.

As for 10 and 45000, It is a trial-and-error, which is the biggest headache for algorithm engineers, because this parameter does not provide much theoretical knowledge, it can only be fine-tuned based on the results of human eyes.

8. ranking algorithm of hacker new

This algorithm is simpler:

(P-1)/(t + 2) ^ 1.5

P indicates the number of times this post is recommended.-1 is to remove the author's own recommendation and divide it by a time index. 2 and 1.5 are also trial-and-error.

9. Advantages and disadvantages of the above algorithms

The first is the Hacker News algorithm. We can see from the formula that the design of this algorithm is relatively simple and time is a huge factor, even if it is recommended to many articles, it will soon sink:

Relatively speaking, Reddit's algorithm design is clever, but Reddit's limitation is that it has a high requirement on negative feedback. In a previous project, I tried to use the Reddit algorithm, however, if there is no negative feedback, the reduction effect is also poor.

The last is the half-lived algorithm. The half-lived algorithm is the one I admire most. It does not rely on negative feedback and has a single responsibility. He is dedicated to solving the problem of time decay, then we can calculate other factors separately. The most important thing is that its parameters are interpretable. We can explain the value of half-life based on the business logic, for example, we think that the hot season of a movie should be a week, so we can set the half-life to 7 or 7 days later, and the score of this movie will experience a great degree of attenuation. This is unmatched by the previous two algorithms.

As an algorithm engineer, trial-and-error needs to be avoided. That is to say, we can get the algorithm framework from the academic world, but we must try our best to maintain the interpretability of parameters.

10. Summary

Ranking is a business-heavy and algorithm-light requirement, and is a common requirement for almost all websites. This requirement is simple and complicated.

For example, application sink: http://www.appchina.com/soft_rank.html, the millennium unchanged rankings, there is no need to move your mind.

For example, the recent popular appstore, Douban movies, and many other spammers are used to set rankings. This requires not only the Matthew effect, but also the anti-spammer field.

If we divide the recommendation system into personalized recommendations and non-Personalized recommendations, the ranking must be the most important part of Personalized recommendations.

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.