How Collaborative Filtering Turns User Behavior into Smart Recommendations

This article explains the fundamentals of collaborative filtering, detailing explicit and implicit user feedback, power‑law behavior patterns, neighborhood‑based and latent‑factor recommendation algorithms, and how they are applied in e‑commerce and social platforms.

21CTO
21CTO
21CTO
How Collaborative Filtering Turns User Behavior into Smart Recommendations

用户行为介绍

Based on user behavior recommendation, the academic term is collaborative filtering algorithm.

Collaborative filtering means users cooperate through continuous interaction with a website, gradually filtering out items they are not interested in, so the recommendation list increasingly satisfies their needs.

User behavior in personalized recommendation systems is generally divided into two types: explicit feedback and implicit feedback.

Explicit feedback includes actions where users clearly express their preference for items, mainly through ratings and likes/dislikes.

Implicit feedback refers to behaviors that cannot directly reflect user preference, with page view behavior being the most representative.

Feedback can also be categorized as positive or negative.

用户行为分析

Define two variables:

User activity: total number of items a user has interacted with.

Item popularity: total number of users who have interacted with an item.

Both user activity and item popularity follow a Power Law (long‑tail distribution).

More active users tend to browse niche items.

Recommendation algorithms based solely on user behavior data are generally called collaborative filtering algorithms. Academic research has produced many methods, such as neighborhood‑based methods, latent factor models, and random walk on graph algorithms.

基于邻域的算法

Neighborhood‑based methods include two major categories:

User‑based collaborative filtering: recommends items liked by users with similar interests.

Item‑based collaborative filtering: recommends items similar to those the target user previously liked.

基于用户的协同过滤算法

Steps:

Find a set of users whose interests are similar to the target user.

Recommend items liked by this set that the target user has not encountered.

Similarity can be measured by Euclidean distance, Pearson correlation, Cosine similarity, or Tanimoto coefficient.

基于物品的协同过滤算法

Item‑based collaborative filtering evaluates similarity between items based on user ratings and recommends items similar to those the user previously liked.

Comparison:

In e‑commerce, the number of users usually far exceeds the number of items, making Item‑CF computationally cheaper.

Item‑CF is widely adopted in e‑commerce because it effectively guides users to related items.

In social networking sites, User‑CF combined with social network information can improve recommendation explainability.

隐语义模型(LFM)

Latent Factor Models originated from improvements to Singular Value Decomposition (SVD). Traditional SVD is computationally intensive for large systems; Funk‑SVD (later called LFM) addresses this.

LFM assumes hidden variables representing user interests. The user‑item rating matrix R is factorized into P (user‑topic) and Q (topic‑item) matrices:

When the matrix is large, SVD becomes slow, so gradient descent is used to estimate missing values. The update rules are:

Key hyper‑parameters:

Number of latent factors F.

Learning rate α.

Regularization λ.

Negative sampling principles:

Maintain a balance between positive and negative samples for each user.

When sampling negatives, choose popular items that the user has not interacted with.

总结

This article introduced basic concepts of user behavior, explicit/implicit and positive/negative feedback, and presented two major classes of recommendation algorithms: neighborhood‑based methods and latent factor models. The next article will use the Surprise library to apply these algorithms to real problems.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

user behaviorAIcollaborative filteringRecommendation Systemslatent factor modelneighborhood based CF
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.