liveBook · Manning

Click model

As explained in AI-Powered Search

A click model is a model that represents or predicts user clicks on search results to infer their relevance or examination behavior.

A click model turns search behavior into estimates of result relevance. Rather than treating every click as a reliable judgment, it uses records of the query, the ranked results shown, and which results were clicked. Those estimates can become implicit relevance judgments for training or retraining a learning-to-rank (LTR) model. section 11.1.3 section 11.5

A simple starting point is click-through rate (CTR): for each document returned for a query, divide its clicks by the number of sessions in which it appeared. This produces a useful first ranking of observed interest, but not a dependable ranking of relevance. Users tend to click results near the top, and a document seen only a few times can acquire a misleadingly high rate. section 11.1.3 section 11.5

From sessions to judgments

For the query “transformers dark of the moon,” a session records ranked product results and a click on a Blu-ray disc at rank 7. Aggregating sessions gives that disc a CTR of 0.0824. Another query, “dryer,” produces an apparently unrelated movie among results ranked by CTR—a prompt to inspect the signal before using it as a relevance judgment. Probabilistic judgments can also supply pairwise LTR examples: if one result has grade 0.80 and another 0.20, the higher-graded result is the preferred member of the pair. section 11.1.3 section 11.1.2

Listing 11.4 Computing CTR
def calculate_ctr(sessions):
  click_counts = sessions.groupby("doc_id")["clicked"].sum()
  sess_counts = sessions.groupby("doc_id")["sess_id"].nunique()
  ctrs = click_counts / sess_counts
  return ctrs.sort_values(ascending=False)

query = "transformers dark of the moon"
sessions = get_sessions(query, index=False)
click_through_rates = calculate_ctr(sessions)
print_series_data(click_through_rates, column="CTR")

The pandas calculation groups session rows by document, counts clicks and distinct sessions, then divides to obtain CTR. section 11.1.3

For automated LTR, improve on raw CTR by accounting for whether a result or position was likely examined and by treating estimates from sparse clicks cautiously; a beta-distribution prior is one way to update confidence gradually. Test the resulting ranking with users. If an LTR model performs well before deployment but fails an A/B test, revisit its click-derived judgments: presentation, sales, snippets, or post-click experiences may influence behavior without cleanly measuring search relevance. section 11.5 section 12.2.4

How AI-Powered Search covers it

How deep it goes
Works through session-based CTR calculation, then identifies position and confidence biases rather than detailing the full LTR retraining process.
Examples
Uses ranked movie-query sessions, pandas CTR calculations, pairwise relevance grades, and a failed A/B test.
What it assumes
Assumes familiarity with LTR training while introducing click-model inputs through search sessions and a first CTR calculation.
What you can do after
Build it from scratch as session-based CTR judgments, then diagnose bias before feeding judgments into LTR.
How it connects
Connects click-through rate, implicit relevance feedback, probabilistic judgments, position bias, and learning to rank.

Also explained in

Compare how 2 books explain click model →

Related concepts

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