Beyond Keywords: Personalizing Contextual Advertising with Audience-Aware Embeddings
Advertising in the Digital Age
In digital advertising, two primary approaches dominate how ads are delivered to users: behavioral advertising and contextual advertising.
Behavioral Advertising
Behavioral advertising targets users based on their previous online actions. This includes browsing history, search queries, clicks, time spent on sites, and other forms of digital behavior. By collecting and analyzing this data, advertisers create detailed user profiles to deliver highly personalized ads.
Advantages of behavioral advertising include the ability to tailor ads to individual preferences, which can lead to higher engagement and conversion rates. It is particularly effective for retargeting users who have previously interacted with a brand. Retargeting means showing ads to people who have already shown interest in a product or brand. For example, if you visit a website and look at a pair of shoes but don't buy them, you might start seeing ads for those same shoes on other websites later. That’s retargeting, it reminds you of what you were interested in, hoping you’ll come back and make a purchase.
However, behavioral advertising comes with significant challenges. It relies heavily on tracking mechanisms such as cookies and device identifiers, which raise privacy concerns. As data regulations like GDPR and CCPA have become more stringent, and as browsers phase out third-party cookies, this model has faced increasing limitations. Users may also find behaviorally targeted ads invasive or uncomfortable.
Contextual Advertising
Contextual advertising offers a privacy-preserving alternative. Rather than targeting users based on their identity or history, it serves ads based on the content of the webpage currently being viewed.
For example:
- If a user is reading an article about recipes, it is a suitable time to display an ad for cooking ingredients or kitchen tools.
- If the content is about gardening, relevant ads might include plant food or outdoor equipment.
The key idea is to match the ad to the context of the content, not the identity of the user. This approach eliminates the need for personal data collection while still delivering relevant and timely advertising. It also aligns well with the growing demand for privacy-conscious digital experiences.
Contextual advertising aims to retain relevance without compromising user trust. In doing so, it presents a future-proof model for digital marketing that respects privacy and adapts to a shifting regulatory landscape.
How Does Contextual Intelligence Work?
Contextual intelligence enables digital advertising to be relevant without relying on personal user data. Instead of targeting users based on their past behavior, this system targets the content of the page the user is currently viewing. This is made possible by a coordinated interaction between Supply Side Platforms (SSPs) and Demand Side Platforms (DSPs) within the programmatic advertising ecosystem.
Role of SSPs (Supply Side Platforms)
A Supply Side Platform is used by publishers (such as news websites, blogs, or apps) to manage, optimize, and sell their advertising inventory. SSPs are responsible for:
Analyzing page content using contextual intelligence
Advanced NLP models, keyword analysis, and classification systems are used to extract meaning from a webpage.
Categorizing and tagging pages
Pages are tagged with contextual segments such as:
sports
technology
food_and_recipes
health
finance
Sending enriched content metadata to DSPs
This includes the context-based tags that describe what the page is about.
Role of DSPs (Demand Side Platforms)
A Demand Side Platform is used by advertisers to buy ad space across the web in an automated, efficient way. DSPs perform the following:
Accept content metadata from SSPs
DSPs receive contextual segments about the webpage from the SSP.
Match content to advertiser-defined audience segments
Advertisers define the types of content where they want their ads to appear. For example:
sports_enthusiasts → articles tagged with "athlete", "training", "fitness"
outdoor_activities → articles tagged with "hiking", "camping", "adventure"
team_sports → "basketball", "soccer", "baseball"
Bid on relevant impressions via real-time bidding (RTB)
If a page’s content matches an advertiser’s targeting criteria, a bid is placed in real-time.
How the End-to-End Process Works
Let’s walk through an example to see how contextual intelligence plays out in real-time:
User Visits a Webpage
A user visits a sports website and clicks on an article about basketball.
SSP Analyzes the Content
The SSP uses contextual intelligence to scan the article and tags it with segments such as:
sports
basketball
NBA
Contextual Tags Sent to DSPs
These tags are passed to multiple DSPs in real-time.
DSPs Evaluate and Match
Advertisers who have configured campaigns to target "NBA" or "basketball" content are identified. For example:
A sports brand promoting basketball shoes
A streaming service offering NBA game subscriptions
A hydration brand targeting athletes
Bidding Process Initiated
All interested advertisers place automated bids based on how well the content matches their targeting segments.
Winning Ad is Served
The ad from the highest bidder or best-matching campaign is displayed to the user, often within milliseconds.
Contextual intelligence is not just a concept, it is typically delivered as a service, often integrated into the programmatic advertising ecosystem via APIs. These services analyze and categorize web content in real time and expose this information through interfaces that Supply Side Platforms (SSPs) and Demand Side Platforms (DSPs) can use.
SSPs call contextual intelligence APIs to scan and tag pages with relevant contextual segments before sending them to DSPs. DSPs then use these contextual tags to evaluate whether the page aligns with an advertiser's targeting strategy. This makes contextual intelligence a plug-and-play component in the digital advertising pipeline.
This system ensures that
- Ads remain relevant and timely, increasing user engagement.
- Users' personal privacy is preserved since no behavioral data is required.
- Advertisers can still reach specific interest groups without needing cookies or identifiers.
- Publishers can better monetize content through high-quality ad matches.
Contextual intelligence offers a scalable, regulation-friendly solution to advertising in a post-cookie world, balancing relevance with responsibility.
Contextual Intelligence in Ad Tech
Contextual intelligence systems use Natural Language Processing (NLP) techniques to analyze and categorize web page content in real time. These services are often integrated into Supply Side Platforms (SSPs) to automatically tag URLs with relevant content-based segments such as sports, technology, or food. These tags are then passed to Demand Side Platforms (DSPs), which use them to match ads to appropriate content environments.
A New Approach: Predicting Audience Alongside Topics
Traditional contextual systems focus on classifying the topic of a webpage, for example, tagging an article about "LeBron James" as sports or basketball. While this is useful for aligning ads with relevant content, it doesn't account for who is actually visiting the page.
A more advanced and valuable approach is to predict the type of audience likely to visit a page, in addition to identifying the subject matter. This helps advertisers reach the right users even when no personal identifiers are available.
Examples
- A fashion trends article may attract urban women aged 18–40 who frequently browse retail and lifestyle content
- A highlights video on an NBA blog may draw sports fans aged 16–60, primarily male, with an interest in team merchandise
Using this approach, a URL such as nba.com/lebron-vs-curry could be categorized as:
- Topics: sports, basketball, nba
- Predicted Audience: male_16_60, basketball_enthusiasts, jersey_shoppers
This enriched tagging strategy gives advertisers a way to target based on context and audience relevance — all while preserving privacy and avoiding reliance on cookies.
The Data Backbone of Audience Prediction
Accurate audience prediction relies not just on powerful models, but on high-quality, well-structured data. Specifically, it requires two critical components:
- Behavioral granularity — insights into what users are actually reading or engaging with
- Cohort attribution — signals that link users to real-world behaviors, such as purchases or content interests
To support this, the system was built on two foundational datasets: user browsing data and audience membership data. These were combined to generate training labels that reflected the strength of association between specific URLs and specific audience segments.
Model Training Objective
The goal of each model was to estimate the likelihood that a specific audience would visit a given URL based on the page’s content (e.g., keywords, categories) and historical engagement patterns.
Each audience segment had its own independently trained model — using the same input features, but different labels depending on which users belonged to the audience.
1. User Browsing Data
The first dataset tracked web activity at the individual user level. It contained records of visits to specific URLs, enriched with content-derived features.
| UserID | URL | Keywords | Categories |
|---|---|---|---|
| U001 | recipehub.com | ["pizza", "dinner", "oven"] | ["food", "quick_meals"] |
| U002 | stylezone.com | ["heels", "jewelry", "outfit"] | ["fashion", "accessories"] |
| U003 | hoopsreport.com | ["lebron", "dunk", "playoffs"] | ["sports", "basketball"] |
- UserID: A pseudonymous identifier (e.g., a hashed cookie ID)
- Keywords: Extracted using NLP pipelines that process visible page content
- Categories: Assigned through a taxonomy mapping system that clusters similar keyword groups
Each row reflects a single page visit, allowing us to capture granular user-to-content interactions.
2. Audience Membership Data
The second dataset defined audience segments. Each audience (for example, Frozen Pizza Shoppers) was represented by a set of user IDs who had completed a qualifying action — such as purchasing frozen pizza, frequently browsing food delivery sites, or visiting grocery-related pages.
| Audience: Frozen Pizza Shoppers |
|---|
| U001 |
| U007 |
| U015 |
| U044 |
This forms the basis of positive labels: if a user visited a page and is known to be part of an audience, that visit contributes to training that audience's model.
Each audience is a cohort and can be defined behaviorally (e.g., purchasers, app downloaders), demographically (e.g., students, parents), or interest-based (e.g., fitness enthusiasts, gamers).
Label Generation Through Aggregation
To train a model for each audience, we needed to assign a numerical label to each URL indicating how relevant it is to that audience.
This was done by aggregating at the URL level, using the joined data between browsing activity and audience membership.
How the Aggregation Works
For each URL, we compute two numbers:
1. Total Visitors
This is the total number of unique users who visited the URL, regardless of audience membership.
For example, if 100 users visited recipehub.com/easy-microwave-pizza, then:
Total Visitors = 100
2. Audience Visitors
This is the number of those visitors who are known members of the target audience (e.g., Frozen Pizza Shoppers).
If 45 of those 100 users belong to the audience, then:
Audience Visitors = 45
By comparing these two numbers, we calculate the proportion of traffic to the page that came from the audience in question.
Relevance Score Formula
Relevance Score = Audience Visitors / Total Visitors
Example Aggregated Data
| URL | Audience Visitors | Total Visitors | Relevance Score |
|---|---|---|---|
| recipehub.com | 45 | 100 | 0.45 |
| stylezone.com | 8 | 80 | 0.10 |
| hoopsreport.com | 60 | 120 | 0.50 |
In this example:
recipehub.comis moderately aligned with Frozen Pizza Shoppershoopsreport.comis even more aligned, likely due to content overlap between sports and frozen food shoppersstylezone.comhas weaker relevance to this audience, but could be highly relevant to a different cohort
How Audience Models Work: Example Walkthrough
The goal is to predict whether a given URL is relevant to a specific audience segment.
In this setup, each audience has its own model, and each model is trained independently.
Task
Given a URL (represented by its keywords and categories), predict:
Will this URL likely be visited by a user who belongs to the Frozen Pizza Buyers audience?
The output is binary:
1 means yes, the URL is relevant to Frozen Pizza Buyers
0 means no, the URL is not relevant to Frozen Pizza Buyers
Example
Consider the following input URL:
URL: recipehub.com/easy-microwave-pizza
Extracted Keywords: ["pizza", "microwave", "frozen", "dinner"]
Categories: ["food", "quick_meals"]
This content overlaps strongly with the browsing behavior of users in the Frozen Pizza Buyers audience.
Model output:
frozen_pizza_buyers_model(url) → 1
The model predicts that this URL is relevant to that audience.
Audience Model Fleet
This process is repeated for all audiences.
The system includes approximately 650 audience models.
Each one is a binary classifier trained to identify whether a URL is relevant to its specific audience.
Example predictions for the same URL:
| Audience Segment | Model Name | Output |
|---|---|---|
| Frozen Pizza Buyers | model_frozen_pizza | 1 |
| Fitness Enthusiasts | model_fitness_enthusiasts | 0 |
| Budget-Conscious Shoppers | model_budget_shoppers | 0 |
| College Students | model_college_students | 1 |
All audience models receive the same feature representation of the URL but have different training labels and learn distinct decision boundaries.
Product Context and the Challenge We Faced
The approach described above, combining content-based tagging with predictive audience segments, was part of a new product initiative developed by a team I was part of. The objective was to extend traditional contextual intelligence by not only identifying the topics on a webpage but also estimating the type of audience likely to consume that content. This offered advertisers a more nuanced way to reach relevant users without relying on behavioral profiles.
The Problem We Encountered
As we developed and deployed this product, we began receiving an increasing number of advertiser complaints regarding misaligned ad placements. While the content tagging was generally accurate, the ads were sometimes shown on pages that attracted audiences outside the advertiser’s intended demographic.
Example
An advertiser targeting fashion-conscious users saw their ads placed on articles related to sports or horse betting. Though some surface-level keywords overlapped, the pages were not attracting the type of audience the advertiser cared about.
This mismatch resulted in
- Low engagement and poor performance metrics
- Inefficient use of ad budgets
- Frustration among clients over perceived lack of targeting precision
- Financial impact due to diminished return on ad spend and potential churn
This highlighted a core issue. Accurate topic tagging alone was not enough. Without insight into who was likely to visit a page, even a well-placed ad could underperform. The problem emphasized the importance of integrating audience prediction into contextual systems to deliver both content relevance and audience alignment.
Addressing the Problem
Step 1: Data Drift Investigation
One of the first areas explored was data drift: a common cause of performance degradation in machine learning systems.
Data drift occurs when the statistical properties of the input data change over time.
In this context, the objective was to determine whether the keywords and content tags the models relied on had shifted significantly across time.
Understanding whether the input data remained consistent was crucial to diagnosing why model accuracy had declined.
What Was Done
To evaluate data drift, historical data was divided into four time windows: Q1, Q2, Q3, and Q4.
For each quarter, we computed the normalized frequency distribution of keywords extracted from URLs.
This process involved the following steps:
Step 1: Count keyword occurrences per quarter
For each quarter \( Q_t \), count the number of times each keyword appears across all URL visits.
Let \( f_k^{(t)} \) be the number of times keyword \( k \) appears in quarter \( t \).
Step 2: Compute total keyword occurrences in each quarter
Let \( N^{(t)} \) be the total number of keyword tokens observed in quarter \( t \). This includes all keywords from all pages visited during that quarter.
Step 3: Compute the keyword distribution
The frequency (probability) of a keyword in a quarter is computed as:
$$ P(\text{keyword}_k \mid Q_t) = \frac{f_k^{(t)}}{N^{(t)}} $$
This gives a probability distribution over keywords for each quarter.
Example: Calculating Keyword Probabilities in Q1
To compute the keyword probability distribution for a specific quarter, we use the formula:
$$ P(\text{keyword}_k \mid Q_t) = \frac{f_k^{(t)}}{N^{(t)}} $$
Where:
- \( f_k^{(t)} \) is the number of times keyword \( k \) appeared in quarter \( t \)
- \( N^{(t)} \) is the total number of keyword occurrences in quarter \( t \)
Assume that in Q1, the following keyword counts were observed:
| Keyword | Count in Q1 (\( f_k^{(1)} \)) |
|---|---|
| pizza | 300 |
| oven | 220 |
| dinner | 450 |
| crypto | 0 |
The total keyword count in Q1 is:
$$ N^{(1)} = 300 + 220 + 450 + 0 = 970 $$
Now we calculate the probabilities:
-
Pizza:
$$ P(\text{pizza} \mid Q_1) = \frac{300}{970} \approx 0.309 $$ -
Oven:
$$ P(\text{oven} \mid Q_1) = \frac{220}{970} \approx 0.227 $$ -
Dinner:
$$ P(\text{dinner} \mid Q_1) = \frac{450}{970} \approx 0.464 $$ -
Crypto:
$$ P(\text{crypto} \mid Q_1) = \frac{0}{970} = 0.000 $$
Summary Table
| Keyword | Count in Q1 | Probability \( P(\text{keyword} \mid Q_1) \) |
|---|---|---|
| pizza | 300 | 0.309 |
| oven | 220 | 0.227 |
| dinner | 450 | 0.464 |
| crypto | 0 | 0.000 |
You would repeat this same process for Q2, Q3, and Q4 to generate the full probability distributions for each time window. Once you have all quarterly distributions, you can compare them using metrics such as Jensen-Shannon divergence to quantify how much the keyword usage has changed over time.
Step 4: Compare Distributions Across Quarters
To determine whether keyword usage shifted over time, we compared the probability distributions of keywords in Q2, Q3, and Q4 against Q1, which served as the baseline (since the model was trained on Q1 data).
This was done using divergence metrics that quantify how different two probability distributions are. The main metrics considered were:
- Kullback-Leibler (KL) divergence
- Jensen-Shannon (JS) divergence
- Cosine similarity
Jensen-Shannon Divergence
JS divergence is a symmetric and stable way to compare two distributions. It is defined as:
$$ JS(P, Q) = \frac{1}{2} KL(P \parallel M) + \frac{1}{2} KL(Q \parallel M) $$
where
$$ M = \frac{1}{2}(P + Q) $$
and \( KL(P \parallel M) \) is the KL divergence from distribution \( P \) to the mean distribution \( M \).
Example: Comparing Q1 and Q3
Assume we have the following keyword probabilities:
| Keyword | \( P \) = Q1 | \( Q \) = Q3 |
|---|---|---|
| pizza | 0.30 | 0.29 |
| oven | 0.22 | 0.25 |
| dinner | 0.45 | 0.50 |
| crypto | 0.00 | 0.01 |
Step 1: Compute the average distribution \( M \):
| Keyword | \( M = \frac{1}{2}(P + Q) \) |
|---|---|
| pizza | \( \frac{0.30 + 0.29}{2} = 0.295 \) |
| oven | \( \frac{0.22 + 0.25}{2} = 0.235 \) |
| dinner | \( \frac{0.45 + 0.50}{2} = 0.475 \) |
| crypto | \( \frac{0.00 + 0.01}{2} = 0.005 \) |
Step 2: Compute each term in the KL divergences
Use log base 2 for JS divergence (for results between 0 and 1). The formula for each term is:
$$ P_k \cdot \log_2 \left( \frac{P_k}{M_k} \right) $$
Example calculations for \( KL(P \parallel M) \):
- pizza: \( 0.30 \cdot \log_2\left( \frac{0.30}{0.295} \right) \approx 0.30 \cdot 0.024 = 0.0072 \)
- oven: \( 0.22 \cdot \log_2\left( \frac{0.22}{0.235} \right) \approx 0.22 \cdot (-0.108) = -0.0238 \)
- dinner: \( 0.45 \cdot \log_2\left( \frac{0.45}{0.475} \right) \approx 0.45 \cdot (-0.075) = -0.03375 \)
- crypto: \( 0.00 \cdot \log_2\left( \frac{0.00}{0.005} \right) = 0 \) (by convention)
Total \( KL(P \parallel M) \approx 0.0072 - 0.0238 - 0.03375 + 0 = -0.05035 \)
(If using natural log instead of log base 2, just convert the log base: \( \log_2(x) = \ln(x)/\ln(2) \))
Repeat the same for \( KL(Q \parallel M) \).
Step 3: Plug into the JS divergence formula:
$$ JS(P, Q) = \frac{1}{2} KL(P \parallel M) + \frac{1}{2} KL(Q \parallel M) $$
A resulting JS score close to 0 means the distributions are very similar.
A higher JS score (e.g., > 0.1) signals that keyword usage patterns have changed significantly, indicating potential data drift.
Why This Matters
By comparing Q3 to Q1, we can detect shifts in keyword emphasis or the emergence of new topics. For instance:
- If the keyword
"crypto"appears increasingly in Q3 but was nonexistent in Q1, this change will increase the divergence - Such a shift suggests the model may be encountering new vocabulary or content types it wasn’t trained on
This analysis helps determine whether a model retrain or vocabulary update may be necessary to restore performance.
Example Comparison
Suppose we observe the following keyword distributions over time:
| Keyword | Q1 | Q2 | Q3 | Q4 |
|---|---|---|---|---|
| pizza | 0.030 | 0.028 | 0.029 | 0.031 |
| oven | 0.022 | 0.021 | 0.025 | 0.023 |
| dinner | 0.045 | 0.047 | 0.050 | 0.044 |
| crypto | 0.000 | 0.000 | 0.001 | 0.020 |
While the top three keywords remain stable, the sudden rise of "crypto" in Q4 (from 0.0 to 0.02) may flag new emerging content patterns that didn’t exist during training. If many such terms appear, it could signal real drift in content type or user interest.
To quantify the overall change, we compute the JS divergence between Q1 and Q4 keyword distributions. If the divergence exceeds a predefined threshold (e.g., 0.05 or based on past variation norms), it may indicate significant drift worth addressing.
Why Data Drift Was the First Area to Explore
When a model begins to underperform, a natural and foundational question to ask is:
Are we still feeding the model the same kind of input data it was trained on?
Because most machine learning models are trained on historical snapshots, even modest changes in input distributions can degrade generalization. This is especially true when inputs are semantic — like page keywords, tags, or content-derived signals.
The potential consequences of data drift include:
- The model encountering new or rare keywords it hasn't seen before
- An increased rate of out-of-domain inputs
- A shift in the contextual meaning or use of existing terms
In audience modeling, this might mean the model still correctly identifies the topic of a page but no longer has accurate knowledge of the kind of audience that visits it.
What Data Drift Is Not
It's important to clarify that data drift focuses solely on input distributions.
It does not account for whether the relationship between inputs and outputs has changed — that is the domain of concept drift.
For example:
- If the keyword
"pizza"appears just as frequently in Q4 as in Q1, but the types of users visiting pizza-related pages have shifted from college students to working parents, that’s concept drift, not data drift - If
"pizza"disappears or is replaced by new phrases like"air fryer flatbread", that’s a signal of data drift
Result
After comparing keyword distributions across quarters and calculating divergence metrics:
- Only minor variations in keyword frequency were detected
- No significant increase in out-of-vocabulary terms
- The overall structure and vocabulary of the content remained stable
This indicated that data drift was not the likely cause of model performance degradation.
With the input environment confirmed to be stable, the investigation shifted focus to the possibility of concept drift, a change in the underlying relationship between content and audience behavior.
Step 2: Concept Drift Identification
After ruling out data drift as the primary cause of performance degradation, the next focus was concept drift.
Concept drift occurs when the relationship between input features and target outputs changes over time, even if the input data itself remains statistically consistent.
In this case, the model was still receiving familiar inputs — keywords and content structures appeared stable.
However, the connection between those inputs and the expected audience response had shifted.
This indicated that the issue was not in the input, but in the mapping between inputs and outputs — a classic sign of concept drift.
What Causes Concept Drift?
Several real-world dynamics may cause concept drift in a content-audience model.
Semantic Evolution
Language evolves.
Words that once signaled a specific audience may gain broader usage over time.
For example, the keyword "fashion" might originally attract young urban women but later become popular across multiple demographics and platforms, weakening its predictive power.
Changes in Audience Behavior
Audience composition and behavior shift due to seasons, trends, or events.
For example, basketball content might primarily attract men aged 18–35 most of the year, but during playoffs, it may suddenly draw a wider, more diverse audience.
The model's assumptions — based on historical patterns — become outdated.
The Refined Approach to Detecting Concept Drift
In systems with many models (e.g., one per audience), a practical and scalable approach is to track model behavior over time, rather than retraining after every data refresh.
Premise
You have around 600 binary classifiers. Each one predicts whether a given URL is relevant to a specific audience.
Each classifier produces:
1if the URL is relevant to the audience0if it is not
You also log evaluation data over time — quarterly predictions for the same or similar URLs.
Step-by-Step Process
Step 1: Collect Model Predictions by Quarter
For each model, collect predictions over time (Q1, Q2, Q3, Q4).
Separate the URLs into two groups:
- URLs predicted as positive (1)
- URLs predicted as negative (0)
Focus on the positive predictions, which represent content the model believes is relevant to the audience.
Step 2: Aggregate Keyword Distributions for Each Quarter
From the URLs predicted as positive in each quarter:
- Extract keywords
- Count keyword frequencies
- Normalize into probabilities so the distribution sums to 1
This gives a keyword profile for each model in each quarter.
Step 3: Compare Keyword Distributions Over Time
Compare the keyword distributions for positive predictions in Q1 (baseline) vs. Q3 or Q4 (current period).
If the distribution of keywords has shifted significantly, it suggests that the model’s idea of what constitutes audience-relevant content has changed.
This is concept drift — even though the input data and structure remained stable.
A Worked Example
Suppose your model predicted the following keyword distributions from positive predictions:
| Keyword | Q1 (P) | Q3 (Q) |
|---|---|---|
| bible | 0.30 | 0.25 |
| jesus | 0.25 | 0.15 |
| prayer | 0.15 | 0.30 |
| fasting | 0.10 | 0.10 |
| worship | 0.20 | 0.20 |
To detect concept drift, we compare these distributions using divergence metrics.
KL Divergence: Measuring Directional Shift
KL divergence measures how much Q3 differs from Q1 assuming Q1 is "true":
$$ KL(P \parallel Q) = \sum_{i} P(i) \cdot \log\left(\frac{P(i)}{Q(i)}\right) $$
Example:
-
For
"bible": $$ 0.30 \cdot \log\left(\frac{0.30}{0.25}\right) \approx 0.30 \cdot 0.182 = 0.0546 $$ -
For
"jesus": $$ 0.25 \cdot \log\left(\frac{0.25}{0.15}\right) \approx 0.25 \cdot 0.511 = 0.1278 $$ -
You repeat this for all keywords and sum the results.
If the result is close to 0, the distributions are similar.
Higher values indicate larger drift.
Note: KL is asymmetric. That is: $$ KL(P \parallel Q) \neq KL(Q \parallel P) $$
Also, KL becomes unstable if any \( Q(i) = 0 \), so smoothing is typically applied.
Jensen-Shannon Divergence: A More Stable Alternative
JS divergence is symmetric and bounded between 0 and 1:
-
Compute the average distribution: $$ M = \frac{1}{2}(P + Q) $$
-
Compute: $$ JS(P, Q) = \frac{1}{2} KL(P \parallel M) + \frac{1}{2} KL(Q \parallel M) $$
JS divergence handles near-zero values better and produces a more stable comparison between distributions.
Why This Approach Works
This method focuses on how the model's behavior changes over time, not just the raw data.
- If the model’s prediction of
1shifts toward URLs with different keyword profiles, its learned associations have changed - If this happens across multiple audiences, it signals systemic concept drift
The advantage is that we don’t just look at how often keywords occur — we observe how the model interprets and uses those keywords to predict audience relevance.
Summary
- Concept drift is about changing relationships between inputs and outputs
- By analyzing keyword distributions of positively predicted URLs over time, we can isolate this change
- KL and JS divergence help quantify the magnitude of the shift
- This method allows proactive detection of concept drift, without requiring full retraining or manual inspection
Would you like to follow this with a diagram showing keyword distributions shifting over time, or an example showing drift visualization in Python?
Comments (0)