liveBook · Manning

Viewing time

As explained in Experimentation for Engineers

The elapsed time between a user seeing a displayed post and closing the application, used as a measure of engagement.

Viewing time measures how long a user takes to close the application after seeing a displayed post. It serves as the system’s business-metric outcome: the model predicts viewing time from a user and a post, while the recommender chooses which post to display. section 5.1.1

A simulated engagement signal

A small simulator returns a positive, noisy value whose mean depends on the user context and the selected post’s action weights: measure_viewing_time(context, action_weights) = exp((context * action_weights).mean() + 0.1 * noise). Each observation can then be logged as context, action, and reward. section 5.1.1

In a contextual-bandit recommender, the user is the context, displaying a post is the action, and viewing time is the reward. A greedy policy estimates viewing time for every available post and displays the one with the highest prediction; models are refit daily from logged observations. section 5.1.1 section 5.1.2

Use viewing time with these operational checks:

  • Evaluate a daily recommender with mean viewing time per post when the model is refit once per day. section 5.1.3
  • Treat viewing time as appropriate for contextual bandits only when one display causes the measured reward; sequences of dependent actions require a multistep return. section 5.1.3
  • Handle cold starts with a manually designed policy or initialized model parameters so the system can begin collecting logs. section 5.1.2
Listing 5.1 Simulate viewing time
def measure_viewing_time(context, action_weights):
    return np.exp( (context*action_weights).mean()    #1
                    + 0.1*np.random.normal())         #2

Inspect the simulator that generates positive, noisy viewing-time outcomes from context and action weights. section 5.1.1

How Experimentation for Engineers covers it

How deep it goes
Defines the metric, simulates noisy outcomes, logs samples, fits predictions, and evaluates daily performance; it stops short of long-term returns.
Examples
Uses a social-media post recommender, a noisy simulator, logged context-action-reward samples, and a 30-day greedy-policy evaluation.
What it assumes
Assumes users, posts, and recommendation decisions; introduces contextual-bandit roles, logged rewards, cold starts, and short-term-reward limits.
What you can do after
Build it from scratch as a contextual-bandit reward, simulate observations, train post-specific predictors, and evaluate mean daily viewing time.
How it connects
Connects viewing time to contextual bandits, recommender systems, rewards, policies, cold starts, and multistep returns.

Related concepts

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