The principle and architecture of the "Recommendation System"

Source: Internet
Author: User

This article mainly introduces what is a recommendation system, why a recommendation system is required, and how to implement a recommendation system solution, including some common models for implementing a recommendation system, and hopes to provide readers with learning and practical reference.

Why do we need a recommendation system?

Information consumers need to find information they are interested in from a large amount of information. In the information overload era, it is difficult for users to obtain information of interest or value to themselves from a large amount of information.

For information producers, they need to make their own information stand out and attract the attention of users. From the item perspective, the recommendation system can better explore the long tail of an item ).

Long Tail effect is the traditional 2006 principle (80/20 of sales come from 80% of popular brands), pointed out in the book "Long Tail Theory" published in 20% by Chris Anderson, editor of Wired magazine) joining the Internet will be challenged. E-commerce websites can sell more goods than traditional retail stores due to their extremely low shelf costs on the Internet. The total volume of these small-volume products or services that were previously not valued exceeds that of mainstream products.

Mainstream products often represent the needs of the vast majority of users, while long-tail products often represent personalized needs of a small number of users.

The recommendation system finds users' personalized needs by exploring users' behaviors, so as to accurately recommend long-tail products to users who need them, helps users discover products that they are interested in but are hard to find.

The recommendation system has the following tasks:

  • On the one hand, it helps users find valuable information to themselves.
  • On the other hand, information can be displayed to users interested in it, so as to achieve a win-win situation between information consumers and information producers.

Essence of Recommendation Systems

Users and items are linked in a certain way, while different recommendation systems use different methods.

A recommendation system is a tool that automatically contacts users and items. It can help users discover information that interests them in an Information Overload Environment, information can also be pushed to users interested in them.

Evaluation Indicators

From the product perspective, a recommendation system can be evaluated from the following dimensions:

  • User satisfaction: As an important participant in the recommendation system, user satisfaction is the most important indicator for evaluating the recommendation system. However, user satisfaction cannot be calculated offline and can only be obtained through user surveys or online experiments.
  • Prediction Accuracy: the prediction accuracy measures the ability of a recommendation system or recommendation algorithm to predict user behavior. This indicator is the most important offline Evaluation Indicator of the recommendation system. Since the birth of the Recommendation System, almost 99% of the papers related to the recommendation are discussing this indicator.

An offline dataset is required when this indicator is calculated. This dataset contains the user's historical behavior records. Then, the time passed by the dataset is divided into a training set and a test set.

Finally, a user's behavior and interest model is established on the training set to predict the user's behavior in the test set, and the coincidence degree of the predicted behavior and the actual behavior in the test set is calculated as the prediction accuracy.

  • Coverage: Coverage describes how a recommendation system can discover long tails of an item. The coverage rate has different definitions. The simplest definition is the proportion of items that can be recommended by the recommendation system to the total item set.
  • Diversity: a wide range of user interests. To meet a wide range of user interests, the recommendation list needs to cover different areas of user interest, that is, the recommendation results need to be diverse.
  • Novelty: A Novel recommendation is to recommend users with items they have never heard of before. The simplest way to implement novelty on a website is to filter out the items that users have previously acted on the website from the recommendation list.
  • Surprise: Unlike novelty, if the recommendation results are not similar to the user's historical interests, but make the user feel satisfied, then it can be said that the recommendation results have a high degree of surprise, the novelty of the recommendation only depends on whether the user has heard of the Recommendation result.
  • Trust: there is also a trust problem in the Automatic Recommendation System Based on machine learning. If the user trusts the recommendation system, the interaction between the user and the recommendation system will be increased.

The same recommendation results can be recommended to users in a way that gives them trust in order to give users a desire to buy, however, it may be difficult for users to recommend to users in a way similar to advertising.

To measure the trust level of a recommendation system, you can only use a questionnaire to check whether users trust the recommendation results of the recommendation system.

  • Real-time: the recommendation system needs to update the recommendation list in real time to meet the user's new behavior changes. The recommendation system needs to be able to recommend the items newly added to the system to the user. This mainly tests the recommendation system's ability to process items in cold start.
  • Robustness: Any algorithm system that brings benefits will be attacked. The most typical example is the search engine.

The search engine's cheating and anti-cheating struggles are fierce, and the robustness (robust, robustness) indicators measure a recommendation system's ability to combat cheating.

User behavior recommendation

User behavior

User behavior can be divided into explicit feedback behavior (explicit it feedback) and implicit feedback behavior (implicit feedback ).

Explicit Feedback behavior: the behavior that the user explicitly expresses his/her preferences on the item. The main method is to rate and dislike/dislike the item.

For common explicit feedback behaviors, see the following table:

Implicit feedback: Refers to behaviors that do not explicitly reflect user preferences. The most representative implicit feedback behavior is page browsing behavior.

When a user browses an item page, it does not mean that the user must like the items displayed on this page. For example, because the Page Link is displayed on the home page, it is easier for the user to click it.

Compared with explicit feedback, implicit feedback is not clear, but the data volume is larger. In many websites, many users only have implicit feedback data, but not explicit feedback data.

A recommendation algorithm based on user behavior data is generally called a collaborative filtering algorithm. Academic circles have studied collaborative filtering algorithms in depth and put forward many methods.

For example, neighborhood-based algorithms, latent factor models, and random walk on graph algorithms.

The following describes the domain-based algorithms and implicit semantic model algorithms.

Domain-based algorithms

The neighborhood-based method is the most famous and widely used recommendation algorithm in the industry. It mainly includes the following two algorithms:

  • User-based collaborative filtering algorithm (usercf ).
  • Item-based collaborative filtering algorithm (itemcf ).

The basic steps involved in the algorithm are as follows:

  • Collect user preferences and convert users' preferences on items into quantifiable overall ratings.
  • Find similar users or items.
  • Computing recommendations.

Similarity Calculation

There are three main ways to calculate similarity:

① Euclidean distance (Euclidean distance)

Vector Euclidean distance:

② Pearson correlation coefficient (Pearson correlation coefficient)

Covariance, used to measure whether the variation trends of two vectors are consistent:

Standard Deviation:

Pearson correlation coefficient:

Pearson correlation coefficient is obtained by dividing the covariance by the standard deviation of two vectors. The value range is [-1, 1].

③ Cosine similarity (Cosine similarity, cosine distance)

Cosine similarity is actually the angle between two vectors. Among the three algorithms used to calculate the correlation coefficient, Pearson correlation coefficient is the most commonly used in production.

Neighbor Selection

How can we select a number of most similar neighbors based on similarity calculation? The following methods are used:

  • Based on a fixed number of neighbors: This method directly selects a fixed number of neighbors, it is possible to introduce objects with smaller similarity.
  • Neighbor based on the similarity threshold: This method first filters out a set of neighbors using the similarity threshold, and then selects a neighbor with a large similarity from the set. It can avoid introducing objects with smaller similarity, and the effect is better.

User-based collaborative filtering algorithm (usercf)

In short, it is to recommend items that are similar to those of other users.

In an online personalized recommendation system, when a user a needs personalized recommendations, he or she can first find other users who are similar to him or her, then, we recommend the items that users like and that user a has never heard of to user. This method is called a user-based collaborative filtering algorithm.

User A and user C have similar interests. User C prefers item 4, so user a recommends item 4.

Mathematical implementation is as follows:

It is known that the user rating matrix R (usually very sparse) is used to deduce the score value at the question mark in the matrix.

The usercf model has the following problems:

  • It is difficult to find a neighbor user for a new user.
  • For a new item, none of the nearest neighbors scored much.

Basic Solution:

  • Pearson similarity is recommended for similarity calculation.
  • Calculate the user similarity and consider the number of items to be scored together.

For example, multiplication, N indicates the number of items that are scored together, and N indicates the specified threshold. In this way, the smaller the number of items that are scored together by two users, the smaller the similarity.

  • Normalize the score. For example, convert the original score value range to [0, 10] And then [0, 1].
  • Set a similarity threshold.

Reasons why user-based collaborative filtering is not popular:

Data sparsity makes data access difficult.

The similarity between users is calculated by millions of users, and the calculation workload is too large.

Humans are changeable.

Item-based collaborative filtering algorithm (itemcf)

The item-based collaborative filtering algorithm (itemcf) is used to recommend items that are similar to those they liked before.

For example, this algorithm will recommend machine learning to you because you have purchased introduction to data mining.

However, the itemcf algorithm does not use item content attributes to calculate similarity between items. It mainly calculates similarity between items by analyzing user behavior records.

This algorithm holds that item A and item B are highly similar because most users who like item A also like item B.

Item 1 and item 3 are liked by user a and user B, so they are considered to be similar items. Therefore, when user C prefers item 1, item 3 is recommended to user C.

The main steps of the algorithm are as follows:

  • Calculate similarity between items.
  • Generate a recommendation list for the user based on the similarity of the item and the user's historical behavior.

Mathematical Implementation ideas include:

You need to rate Item 1 by item 5 r_15. Because item 3 and item 6 are the two items most similar to item 1 and take similarity as the weight, r_15 can be predicted as follows:

Model advantages:

  • The computing performance is high. Generally, the number of users is much larger than the number of items. In actual calculation, similarity between items can be calculated by selecting similar items under the same big classification to reduce the calculation workload.
  • The results can be reserved in advance, and the items are not changeable.

Comprehensive comparison between usercf and itemcf

Usercf recommends the items that the user has a common interest in, and itemcf recommends the items similar to the items he liked before.

From the principle of this algorithm, we can see that:

  • The recommendation results of usercf focus on reflecting the hot spots of small groups similar to user interests.
  • Itemcf's recommendation results focus on maintaining users' historical interests.

In other words:

  • Usercf recommendations are more social, reflecting the popularity of items in the small interest groups of users.
  • Itemcf recommendations are more personalized, reflecting the user's own interest inheritance.

User label-based recommendation

The purpose of the recommendation system is to contact the user's interests and items, which depend on different media.

Currently, popular recommendation systems basically contact user interests and items in three ways:

  • User recommendation based on usercf: use other users with similar interests to recommend items that other users have similar interests.
  • Item-based recommendation itemcf: recommends items similar to those he or she liked.
  • Feature-based: the features here have different manifestations, such as attribute sets of items (for example, for books, attribute sets include authors, publishers, themes, and keywords ), it can also be represented as a latent factor vector ).

Tag Problems

Tag Definition

According to Wikipedia, a tag is a non-hierarchical keyword used to describe information. It can be used to describe the meaning of an item.

Depending on the person who tags an item, tag applications are generally divided into two types:

One is to allow the author or expert to tag the item.

The other is to allow common users to tag items, that is, UGC (User Generated Content, user-generated content) the UGC tag system is an important way to express user interest and item semantics.

When a user adds a tag to an item, this tag describes the user's interests and the semantics of the item, thus connecting the user with the item.

Therefore, the following mainly discusses the tag application of UGC, the behavior of users labeling items, and how to customize recommendations for users by analyzing such behavior.

Why do users need to tag

From the product perspective, we need to understand the user's labeling behavior. Why do we need to tag the user? We only need to have a deep understanding of the user's behavior, only in this way can we design a personalized recommendation system that satisfies them.

The reasons behind this behavior can be discussed from two dimensions:

  • Social Dimension: some users are labeled for the content Uploader (easy for the Uploader to organize their own information), while some users are labeled for the majority of users (easy for other users to find information ).
  • Functional dimensions: Some annotations are used to better organize content for users' future searches, while others are used to convey certain information, such as the time and location of the photo.

What kind of tag do users use?

User tags are as follows:

  • Indicates what an item is.
  • Indicates the type of the item.
  • Indicates who owns the item. For example, many blog tags include the blog author and other information.
  • Express users' opinions. For example, if a user thinks that a webpage is interesting, the tag funny (interesting) will be added. If the user thinks that the webpage is boring, the tag boring will be added ).
  • User-related tags, such as my favorite (my favorite) and my comment (my comments.
  • User tasks, such as to read and job search.

Why recommend tags to users?

When a user browses an item, the tag system hopes that the user can add high-quality tags to the item so as to promote the virtuous circle of the tag system. Therefore, many tag systems have designed the tag recommendation module to recommend tags to users.

It is generally believed that the recommendation label for users has the following benefits:

  • It is convenient for users to enter tags, which makes it difficult for users to enter tags from the keyboard. In this way, many users do not want to tag items, therefore, we need an auxiliary tool to reduce the difficulty of tagging users and increase the user's participation in tagging.
  • To improve the tag quality, users with different semantics may use different words for representation. These synonyms will increase the vocabulary of tags and make the similarity calculation inaccurate.

When using Recommendation tags, we can select a Word Table. First, we can ensure that there are not many synonyms in the Word Table, and at the same time ensure that the words that appear are popular and representative words.

How to recommend tags to users

When user U tags item I, there are many ways to recommend tags related to item I to users.

There are four simple methods:

  • Recommendation of the most popular tag in the system for user U (this algorithm is called populartags here). This algorithm is too simple to be called a label recommendation algorithm.
  • This algorithm is called itempopulartags ).
  • User U recommends tags that he often uses (this algorithm is called userpopulartags ).
  • The first two types of fusion (here marked as hybridpopulartags), This method uses a coefficient to linearly weight the above recommendation results, and then generate the final recommendation results.

A Simple Algorithm

The basic steps are as follows:

  • Calculate the tags most commonly used by each user.
  • For each tag, count the items that have been tagged the most.
  • For a user, first find the frequently used tags, and then find the most popular item with these tags to recommend to the user.

For the above algorithm, the formula for user U's interest in item I is as follows:

  • Is a set of tags that user U has tagged.
  • It is a set of tag tags of item I.
  • The number of times user U has tagged B.
  • It is the number of times that item I has been labeled B.

A user has used the "humorous" label for 10 times, the "funny" label for 3 times, and the "Ironic" label for 6 times. The number of times the three tags are used by item A: 4, 7, and 2.

The user's interest in the item is calculated as follows:

The calculation formula above tends to give a large weight to the hot item corresponding to the hot tag, which will lead to the recommendation of hot items to users, thus reducing the novelty of the Recommendation results, in addition, the data sparsity problem can be corrected by dividing the calculation result by the penalty item.

System Cold Start

Problem description

The problem of system cold start mainly lies in how to design a personalized recommendation system on a newly developed website (no user, no user behavior, and only some item information, this allows users to experience personalized recommendation services when the website is just released.

There are three main types:

  • User cold start: the problem of user cold start mainly lies in how to make personalized recommendations for new users. When a new user arrives, we do not have his/her behavior data, so we cannot predict his/her interests based on his/her historical behavior, so we cannot make personalized recommendations for him.
  • Item cold start: the problem of item cold start mainly lies in how to recommend new items to users who may be interested in it.
  • Cold start of the system: the system has just been launched, with fewer user and item data.

Solution

For the above three types of Cold Start problems, you can refer to the following solutions:

  • Provide non-Personalized recommendations: the simplest example of non-Personalized recommendations is the hot ranking. We can recommend Hot rankings to users and wait until user data is collected to a certain extent, then switch to personalized recommendations. This is also the most common solution.
  • Use the age, gender, and other data provided during user registration for coarse-grained personalization.
  • Users are required to provide feedback when they log on for the first time, such as entering tags of interest or items of interest. Collect information about users' interests in items and recommend items similar to these items to users.
  • For newly added items, you can use the content information to recommend them to users who like similar items.
  • When the system is cold-started, you can introduce expert knowledge to quickly establish an item relevance table in a certain efficient way.

Evaluation Indicators

The recommendation list is a list of user behaviors on the training set. It is a list of user behaviors on the test set.

Accuracy

Used to measure the error between the predicted value and the actual value of the model.

Recall rate

It is used to measure the ratio of the number of correct recommendations to the user behavior list in the test set. Multiple Positive examples are divided into positive examples.

Coverage

Users can measure the proportion of recommended items to all items. Generally, we recommend items to cover as many categories as possible. There are two common calculation methods:

Proportion of recommended products in total:

Or, the higher the entropy value, the higher the coverage rate:

Diversity

It is used to measure the ratio of items pushed in each recommendation to all possibilities. The larger the diversity, the richer the items that are recommended each time.

In fact, different platforms have different measurement standards, such as user satisfaction and advertising revenue, which need to be adjusted based on actual business conditions.

System Architecture

Feature-based recommendation system

Review the three ways in which the recommendation system contacts users and items.

Abstract these three methods to find that if you think that your favorite items are also a user feature, or other users that are similar to your interests are also a user feature, the user is connected to the item through features.

There are many types of user features, including the following:

  • User Registration attributes: age, gender, nationality, etc.
  • User behavior features: browsing, thumb ups, comments, and purchases.

Overall system architecture

Due to the complexity of the push policy itself, if you want to comprehensively consider all the features and tasks mentioned above in a system, the system will be very complicated, it is also difficult to easily configure the weights of different features and tasks through the configuration file.

Therefore, a recommendation system must be composed of multiple recommendation engines. Each recommendation engine is responsible for a type of features and a task, the recommendation system only merges, sorts, and returns the results of the recommendation engine based on a certain weight or priority.

There are two benefits to doing so:

  • You can easily add or delete engines to control the impact of different engines on recommendation results. For the vast majority of requirements, you only need to use different engine combinations.
  • The recommendation engine-level user feedback can be implemented. Each receng actually represents a recommendation policy, and different users may like different recommendation policies:

Some users may like to make recommendations based on their age and gender.

Some users may prefer to view new videos related to their interests.

Some users prefer novel recommendations.

Some users prefer to focus on the recommendation of a nearby area.

Some users like various recommendations.

We can design every strategy into a recommendation engine, and then analyze the feedback from users on recommendation results to find out which engines the users prefer to recommend, this gives different engine combination weights to different users.

Recommendation engine architecture

Receng uses one or more user features to generate a recommendation list for a type of item based on a recommendation policy. The basic architecture is as follows:

For example, the receng architecture consists of three parts:

  • User behavior data module: Part A in the figure. This module obtains user behavior data from the database or cache and generates the feature vectors of the current user by analyzing different behaviors.

However, if you use non-behavioral features, you do not need to use the behavior extraction and analysis module. The output of this module is the user feature vector.

  • Item data module: Part B in the figure. This module converts a user's feature vector to an initial recommendation item list through the feature-item matrix.
  • Final result generation module: Part C in the figure. This module filters and ranks the initial recommendation list to generate the final recommendation result.

There are several modules that need to be introduced in detail:

  • Candidate item set: feature-item-related recommendation module can also accept a set of candidate items. The purpose of a candidate item set is to ensure that the recommendation results only contain items in the Candidate item set. It is generally used to recommend certain types of TV series to users.

For example, if some products require users to recommend new items that have been added for the last week, the candidate item set includes newly added items for the last week.

  • Filter Module: after obtaining a preliminary recommendation list, you cannot display this list to users. First, you need to filter out the results based on product requirements to filter out the items that do not meet the requirements.

In general, the filter module filters out the following items:

The user has produced behavior items. Because the recommendation system aims to help the user discover items, there is no need to recommend the items he knows to the user. This ensures the novelty of the Recommendation results.

For items other than candidate items, the candidate item set generally has two sources, one of which is the product requirement. For example, you may need to recommend new items to the user on the homepage. Therefore, you need to filter out items that do not meet this condition in the filter module.

Another source is the user's choice. For example, if you select a price range and only want to see the items in this price range, the filter module needs to filter out the items that do not meet your needs.

Some items of poor quality, in order to improve the user experience, the recommendation system needs to recommend good quality items to users, so the recommendation system needs to filter out some items that are rarely commented by most users. This filtering is generally based on the user's historical score, for example, filtering out items with an average score of less than 2.

  • Ranking module: After filtering, the recommendation results are directly displayed to users, which is generally normal. However, if you rank them, it can better improve user satisfaction. You can optimize rankings based on novelty, diversity, and user feedback.

Summary

In addition to the model algorithms introduced in this article, user behavior-based recommendations and implicit semantic models are also common graph-based models, as well as context-based and social network-based recommendations. There are some common algorithm libraries that can implement recommendation system operations, including librec and crab.

References:

Recommendation System practices

Understanding the Knowledge System of the Recommendation System

Https://cloud.tencent.com/developer/article/1070529

Summary of Personalized Recommendation System

Https://www.jianshu.com/p/319e4933c5ba

Recommendation SYSTEM INTRODUCTION

Https://www.cnblogs.com/redbear/p/8594939.html

Chen caihua (caison) is engaged in server-side development. He is good at system design, optimization and reconstruction, and online troubleshooting. The main development language is Java, No.: 4151881375.

[51cto original manuscript. For reprinted on the Cooperation site, please indicate the original author and Source: 51cto.com]

The principle and architecture of the "Recommendation System"

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.