Causality APIs 37: Personalized Recommendations And Net Basket Value

Rocket Vector rocket logo on a dark branded background.

A recommendation widget starts getting clicks. Product managers are relieved, merchants are curious, and the growth team wants to scale it across the site. Then the basket data looks strange: some clicks replace planned purchases, some suggested items are out of stock, and some customers return what the model pushed.

Share: A recommender can lift clicks and still lose basket value. Substitutes, complements, inventory, margin, returns, and trust decide whether the click was useful. #Causality #RetailAnalytics #Recommendations

Synthetic teaching model

This article uses a synthetic retail model. It is not pricing, legal, financial, operational, compliance, or merchandising advice. The sources below justify why some variables belong in the model. The probabilities are invented so the reasoning path is easy to inspect.

The Operating Problem Is Usually Wider Than The Metric

Recommendations are often judged by click-through or add-to-cart rates because those signals arrive quickly. Retail profit arrives through a slower path: the customer keeps the item, the basket expands rather than substitutes, inventory is available, margin mix is acceptable, and the shopper still trusts the experience next time.

Why The Dashboard Can Mislead

The dashboard can mislead because clicks are not basket value. A recommendation may get attention because it is popular, not because it is incremental or complementary. If the widget moves a shopper from one planned item to another, click lift may hide cannibalization.

Plain-language modeling note

A Bayesian belief network, or BBN, is a graph for asking conditional questions. Each node is a condition, each arrow says one condition informs another, and each probability is explicit. You do not need to know the SDK to read the graph: the SDK code is only there when we need a repeatable action query.

The Question For This Example

This example asks how net-basket-value-loss risk changes after observing popularity bias, low diversity, unavailable inventory, and poor catalog metadata, and what changes if recommendations become more diverse, margin-aware, and available.

The target outcome is NetBasketValueLoss, which means net basket value loss in this teaching model.

A Small Model Of The Situation

The model treats recommendations as a causal system around exposure, add-to-cart quality, substitution, returns, trust, and repeat behavior. It leaves out full ranking algorithms, embeddings, personalization privacy, session-level paths, and real product economics.

The graph has 16 nodes:

  • ShopperIntentClarity: Shopper intent clarity (clear / unclear)
  • CatalogMetadataQuality: Catalog metadata quality (good / poor)
  • RecommendationDiversity: Recommendation diversity (adequate / low)
  • PopularityBias: Popularity bias (low / high)
  • MarginAwareRanking: Margin-aware ranking (strong / weak)
  • InventoryAvailability: Inventory availability (available / unavailable)
  • PersonalizationFreshness: Personalization freshness (fresh / stale)
  • SubstituteExposure: Substitute exposure (low / high)
  • ComplementExposure: Complement exposure (adequate / low)
  • ClickThroughLift: Click-through lift (adequate / low)
  • AddToCartQuality: Add-to-cart quality (good / poor)
  • BasketCannibalization: Basket cannibalization (low / high)
  • ReturnRisk: Return risk (low / high)
  • CustomerTrust: Customer trust (adequate / low)
  • RepeatPurchaseSignal: Repeat purchase signal (strong / weak)
  • NetBasketValueLoss: Net basket value loss (no / yes)

Retail Recommendation Basket Value BBN graph with source-informed retail variables and synthetic probabilities.

What Is Sourced And What Is Synthetic

NRF and Deloitte sources support personalization, AI, inventory visibility, and profitable transactions as active retail priorities. McKinsey’s personalized-marketing work supports the relevance and timing path, while CLV work supports connecting short-term actions to long-term value.

Personalization pressure
McKinsey and Deloitte both frame personalized interactions as a major retail growth and differentiation mechanism.
Inventory visibility
Deloitte’s retail outlook motivates making recommendation quality depend on inventory availability and fulfillment feasibility.
Long-term value
McKinsey’s CLV discussion supports looking beyond one click or transaction to repeat behavior and customer value.

Boundary of the evidence

The sources support the general mechanisms in the graph. They do not estimate this article’s node states, thresholds, or conditional probability values. Those are synthetic teaching values.

The Query The Graph Cannot Show By Itself

The visual graph is the best way to inspect the structure. The code-backed query is there for a narrower reason: we want to separate what is learned by observing a messy retail case from what changes if one condition is set differently.

Using the Darkstar Python SDK, a subscribed SDK user can load the same BBN JSON, ask for the target probability after evidence is entered, then run the action query by setting a node before querying again. The download includes this as illustrative SDK code, while the standalone query_example.py reproduces the article numbers without shipping the SDK.

import json

from darkstar import DiscreteModel

TARGET = "NetBasketValueLoss"
OBSERVED_EVIDENCE = {
    "PopularityBias": "high",
    "RecommendationDiversity": "low",
    "InventoryAvailability": "unavailable",
    "CatalogMetadataQuality": "poor"
}
INTERVENTION_CONTEXT = {
    "PopularityBias": "high",
    "CatalogMetadataQuality": "poor"
}
INTERVENTION = {
    "RecommendationDiversity": "adequate",
    "MarginAwareRanking": "strong",
    "InventoryAvailability": "available"
}


def probability_after_observing(model, evidence):
    query = {"nodes": [TARGET], "evidence": evidence}
    result = json.loads(model.pquery(json.dumps(query)))
    return result[TARGET]["yes"]


def probability_after_setting(model, setting, evidence):
    changed_model = model.intervene(json.dumps(setting))
    return probability_after_observing(changed_model, evidence)


with DiscreteModel(model_json) as model:
    observed = probability_after_observing(model, OBSERVED_EVIDENCE)
    acted = probability_after_setting(model, INTERVENTION, INTERVENTION_CONTEXT)

That is the article’s main modeling distinction. Observing a pattern is not the same as setting one part of the system differently.

The standalone query code gives this synthetic result:

Baseline net basket value loss: 19.7%
Observed scenario (popular but narrow recommendations with inventory gaps): 25.8%
Action scenario (diverse, margin-aware, available recommendations): 20.2%
Same context with the action left unfavorable: 26.7%
Synthetic reduction versus the observed scenario: 5.6 percentage points

What We Learn By Observing The Situation

The observed scenario sets:

  • Popularity bias = high
  • Recommendation diversity = low
  • Inventory availability = unavailable
  • Catalog metadata quality = poor

The observed scenario raises net-basket-value-loss risk because the model sees a narrow, popularity-biased recommender with inventory and metadata problems. That combination can lift engagement while weakening add-to-cart quality and trust.

Reasoning comparison for Retail Recommendation Basket Value BBN.

What Changes If We Set One Condition Differently

The action scenario sets:

  • Recommendation diversity = adequate
  • Margin-aware ranking = strong
  • Inventory availability = available

The action query sets recommendation diversity to adequate, ranking to margin-aware, and inventory to available. It does not guarantee a good recommender. It asks whether three practical safeguards reduce the risk that clicks become low-value basket changes.

What This Example Cannot Prove

This model cannot evaluate a production recommender, estimate causal lift, or choose a ranking objective. It is a teaching graph for why engagement metrics need basket and customer paths beside them.

Try this in the shared model

Open the companion model, change one upstream condition at a time, and watch the target probability move. Start with the observed scenario above, then reset one condition that looks actionable. The point is to compare stories, not to treat the toy probabilities as a forecast.

Try The Model

Open the companion Darkstar model: Open Retail Recommendation Basket Value BBN

In the shared model, improve ClickThroughLift while keeping SubstituteExposure high. Then improve ComplementExposure instead. The target should make the difference between attention and basket quality visible.

Download the teaching package: Retail Recommendation Basket Value BBN ZIP

The ZIP contains synthetic model files and examples only. It excludes product catalogs, customer profiles, ranking code, embeddings, the Darkstar Python SDK, and chart-generation code.

Sources

  1. NRF: Retail Trends in AI
  2. Deloitte: 2025 US Retail Industry Outlook
  3. McKinsey: Unlocking the Next Frontier of Personalized Marketing
  4. McKinsey: Customer Lifetime Value, the Customer Compass

Leave a Reply

Discover more from Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading