liveBook · Manning

Behavioral data

As explained in AI Recommender Systems

Data recording how users interact with items, including actions such as clicks, purchases, ratings, and skips.

Behavioral data records how users interact with items in a catalog: clicks, purchases, views, watch time, skips, ratings, and reviews. It describes what users do, rather than what items are or when and where an interaction occurs. A recommender can use these records to select and rank items for a user or to find items consumed together. section 1.3 section 1.2

Interactions provide different kinds of evidence. Implicit feedback, such as clicks and watch time, is collected automatically and is plentiful but noisy: a click need not mean someone liked an item. Explicit feedback, such as a rating or review, expresses a judgment more directly but is sparse. Recommendations also create new behavioral data: users interact with suggested items, those interactions are logged, and the logs inform future models. section 1.3

From comic consumption to recommendations

Suppose a user–item matrix marks which comics each user has consumed. User-based collaborative filtering compares rows to find people with overlapping histories, then scores comics those people consumed that the target user has not. Item-based filtering instead compares columns to find comics consumed by the same users. Neither method needs to know what the comics are about. section 1.3.2

Listing 1.6 User-to-item Collaborative filtering
def find_similar_users(matrix: np.array, user_id: int, top_n: int = 3):
    user_sim = np.dot(matrix[user_id], matrix.T)  #A
    user_sim[user_id] = 0  #B
    most_similar_users = np.argsort(user_sim)[::-1][:top_n]  #C
    return most_similar_users.tolist()
 
def get_recommendations(matrix: np.array, user_id: int,
                        sim_users: list, top_n: int = 3):
    not_consumed = (matrix[user_id] == 0).astype(int)  #D
    sim_user_counts = matrix[sim_users].sum(axis=0)  #E
    scores = not_consumed * sim_user_counts  #F
    rec_ids = np.argsort(scores)[::-1][:top_n]
    return [catalog[id] for id in rec_ids]

The listing computes user similarity with a dot product, excludes the target user, then scores unconsumed items using similar users’ consumption counts. section 1.3.2

Shared audiences can reveal connections that item descriptions miss, including products frequently bought together. But a new user or item has no interaction history for behavioral methods to learn from. Popular items can also receive more exposure and reinforce their popularity, so behavioral signals should not be treated as an unbiased record of preference. section 3.2 section 1.6

How AI Recommender Systems covers it

How deep it goes
Defines implicit and explicit signals, then works through user–item matrices and similarity scoring; defers large-scale methods to later treatment.
Examples
Uses synthetic comic-consumption histories, co-consumption counts, and user- and item-based recommendation code.
What it assumes
Introduces the three recommender data types and a small catalog before using interaction matrices and dot products.
What you can do after
Build it from scratch using a user–item matrix to recommend unconsumed items from similar users’ histories.
How it connects
Connects collaborative filtering, user–item interaction matrices, feedback loops, cold start, and popularity bias.

Also explained in

Compare how 7 books explain behavioral data →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Recommender Systems. The section links point to the parts of the book it draws on.