Add advertising ranking example and CTR evaluation workflow
Motivation
The existing Criteo notebooks (lightgbm_tinycriteo.ipynb, xdeepfm_criteo.ipynb,
mmlspark_lightgbm_criteo.ipynb) each train a single CTR model, evaluated with whatever tool that
notebook happens to use (sklearn, a model's internal eval, or Spark ML's evaluator) rather than the
library's own recommenders.evaluation.python_evaluation module. I didn't find an example that
walks through a small, complete advertising workflow — data preparation, a CTR ranking model,
and evaluation using the library's shared evaluation utilities — end to end. scenarios/ads/README.md
also doesn't yet link to an ads-specific worked example.
I'd like to propose closing both gaps: a small new evaluation utility, and a notebook that puts it to use alongside the existing AUC/LogLoss metrics.
Note on related work: I'm aware of #2297 ("Two-Stage Recommendation Pipeline: Candidate Generation + LightGBM Ranker"). That issue is about a two-stage recommendation pipeline on MovieLens. This proposal is intentionally different — it's scoped to an advertising-specific Criteo workflow and a reusable CTR evaluation utility; I'm not proposing candidate generation or another two-stage framework here.
Proposed Scope
This is a standalone contribution, not a two-part bundle — PR 1 is the actual proposal; PR 2 is mentioned for context and would only move forward if there's maintainer interest.
PR 1 — CTR evaluation utility (standalone)
Add a ctr() function to recommenders.evaluation.python_evaluation (observed click-through rate:
clicks / impressions), following the style of the existing auc/logloss functions, with unit
tests.
PR 2 — Advertising ranking example notebook (only if maintainers are interested)
A notebook demonstrating:
Criteo Ads Data
|
v
Feature Preparation
|
v
CTR Ranking Model
|
v
Advertising EvaluationReusing the existing criteo dataset loader, python_splitters, and an existing supported model
(likely LightGBM), then evaluating with AUC/LogLoss and the new ctr() utility together. A link
would be added from scenarios/ads/README.md. This PR depends on PR 1 for ctr() but is otherwise
reviewable independently.
Scope Notes: Criteo Limitations
This is intentionally narrower than a full ads-ranking pipeline. Criteo has no session/request grouping key and no conversion label, so a candidate-generation stage and a CVR metric aren't demonstrable on this dataset without fabricating structure it doesn't have. For now I'd leave both out rather than force synthetic data into the example — happy to revisit if there's interest.
Not proposed here: new recommendation algorithms, framework/architecture changes, production or real-time serving components, or advertiser/campaign-specific data models.
Questions for Maintainers
- Does this overall scope align with the project's goals and existing ads examples?
- Would
ctr()be an appropriate addition torecommenders.evaluation.python_evaluation? - Is a Criteo-based advertising ranking workflow useful as a worked example, given the dataset's lack of request grouping and conversion labels?
- Would there be interest in a future example using a richer dataset to demonstrate candidate generation and/or CVR?
- Is linking the new notebook from
scenarios/ads/README.mdthe preferred way to surface it?
Source: recommenders-team/recommenders