Data Science and Applied AI for Automotive Parts Retail: Intermittent Demand, Inventory Optimization, Causal Simulation and Fitment-Aware GenAI

How the core methods fit a long-tail, store-based parts business, with working code for the stocking decision and for measuring which supply-chain levers actually move sales.

Causal simulation for automotive parts retail inventory: cutting replenishment lead time from 6 to 4 days, estimated with PyCausalSim at +4.4 units of weekly sales per store (interval 3.9 to 4.9) when the supply-chain graph is supplied, against a true effect of +4.8, while an unaided discovered graph gives an interval from minus 5.3 to 5.0

An automotive parts retailer runs on a very long tail. Most SKUs sell a few units a month, many store-days show zero demand, and the customer usually needs one specific part for one specific vehicle, often the same day. A missed sale is rarely a trade-down to a substitute. It is a lost repair job. That economics separates parts retail from general merchandise, and it decides which data science and applied AI work produces value.

This piece follows the decision chain a planner actually faces: what demand looks like, how much to stock, which levers move sales, what promotions return by region, what GenAI should and should not do at the counter, and how to prove any of it in dollars.

Intermittent demand needs a distribution, not a mean

Fast movers like wipers and oil filters behave like textbook retail demand. Slow movers show runs of zero followed by a one or a two, and a mean forecast tells a planner almost nothing about whether to hold one unit or four.

The classical starting point is Croston's method, which smooths two series separately: the size of nonzero demands, ẑ, and the interval between them, p̂. The Syntetos-Boylan approximation corrects Croston's known upward bias:

ŷ = (1 − α / 2) ẑ / p̂

Here α is the smoothing constant on the interval series. From there the toolkit extends to count models such as the negative binomial, gradient-boosted and neural models trained on quantile loss, and hierarchical reconciliation so store, region and distribution center forecasts add up. The signals that matter in this category are specific: vehicles in operation by make, model and age around each store, weather for batteries and wipers, part supersession, promotions and price.

Forecastability varies enormously across the catalog, and planning effort should follow it. Entropy is a clean way to measure that:

H = − Σ_i p_i log p_i

A part whose demand distribution has high entropy is hard to predict, and it deserves more safety stock, closer review or pooling at a hub. Mutual information does the same job for candidate demand drivers, screening which signals carry information about a part's demand before they go into a model.

Inventory optimization turns the distribution into a stocking decision

Once demand is a distribution, the stocking question becomes an economics question. The newsvendor result says to stock to the quantile given by the critical ratio:

CR = C_u / (C_u + C_o)

Cu is the cost of one unit short (the margin lost on the sale, plus any damage to the customer relationship) and Co is the cost of one unit too many (carrying cost and obsolescence risk over the period). With illustrative numbers, Cu = $12 and Co = $4 give CR = 12 / 16 = 0.75, so the right stock level is the 75th percentile of demand, not the mean.

from scipy.stats import norm

mu, sigma = 40, 12      # demand over the replenishment cycle (illustrative)
cu, co = 12.0, 4.0      # cost of a lost sale, cost of an excess unit
cr = cu / (cu + co)
q = norm.ppf(cr, loc=mu, scale=sigma)
print(round(cr, 2), round(q))   # 0.75 48

Stocking to the mean of 40 units stocks out in about half of all cycles. Stocking to 48 cuts that to about 25 percent, and the extra eight units are justified because a miss costs three times what an overage does. Normal demand keeps the example short; real slow movers use count distributions, and the same critical ratio picks the quantile.

At network scale the question widens to which locations carry which parts and at what depth, how distribution centers replenish stores, and how lead-time variability feeds safety stock. Stochastic optimization handles the allocation, and scenario simulation handles the questions nobody can test live: a supplier slipping two weeks, a hub going offline, a cold snap arriving early.

Causal simulation: which levers actually move sales

Forecasts say what will happen. Leadership usually asks a different question: if we shorten replenishment lead time, or fund more safety stock, how much does that move sales? Correlation answers it badly, because larger stores tend to differ on lead time, safety stock and sales all at once.

PyCausalSim, an open-source framework I built for causal discovery and simulation, answers it by fitting a structural causal model over a graph of the system and simulating interventions the business cannot afford to run as experiments. The example below uses synthetic store-weeks with a known answer built in: cutting lead time from 6 days to 4 should add 4.8 units of weekly sales per store, all of it flowing through the in-stock rate.

import numpy as np
import pandas as pd
from pycausalsim import CausalSimulator

# Synthetic store-weeks with a known answer built in
rng = np.random.default_rng(7)
n = 3000
store_volume = rng.normal(100, 20, n)                        # confounder
lead_time = rng.normal(5, 1.2, n) + 0.01 * store_volume      # days to replenish
safety_days = rng.normal(3, 0.8, n) + 0.01 * store_volume    # days of safety stock
in_stock = np.clip(0.97 - 0.02 * lead_time + 0.015 * safety_days
                   + rng.normal(0, 0.01, n), 0, 1)
promo = rng.binomial(1, 0.3, n)
sales = 0.8 * store_volume + 120 * in_stock + 6 * promo + rng.normal(0, 4, n)
df = pd.DataFrame(dict(store_volume=store_volume, lead_time=lead_time,
                       safety_days=safety_days, in_stock=in_stock,
                       promo=promo, sales=sales))

# Supply-chain structure supplied by domain knowledge: node -> its direct causes
graph = {
    "store_volume": [],
    "lead_time": ["store_volume"],
    "safety_days": ["store_volume"],
    "in_stock": ["lead_time", "safety_days"],
    "promo": [],
    "sales": ["store_volume", "in_stock", "promo"],
}

sim = CausalSimulator(df, target="sales", random_state=7).set_graph(graph)
effect = sim.simulate_intervention(variable="lead_time", value=4.0, n_simulations=300)
print(round(df.lead_time.mean(), 1), effect)
# 6.0 CausalEffect(variable='lead_time', effect=4.4005, ci=[3.8999, 4.9072])

With the supply-chain graph supplied, the simulated effect is 4.4 units, with an interval of 3.9 to 4.9, against the 4.8 built into the data. The sign and scale are right and the estimate is slightly conservative. On the same data, letting a discovery algorithm (PC) infer the graph unaided produced an estimate of 1.0 with an interval from −5.3 to 5.0, too wide to act on.

That contrast is the practical lesson. Distribution networks have structure that operators already know: lead time affects availability, availability affects sales, store size affects all three. Encoding that structure up front turns causal estimation from a fishing trip into a measurement. Discovery algorithms are still useful for checking the graph and surfacing edges nobody expected, and PyCausalSim includes PC-stable, GES, DirectLiNGAM and NOTEARS for that, along with placebo tests, confounding bounds and refutation checks. Testing the method on simulated data with a known answer, as above, belongs in the workflow before the real estimate goes in front of a decision maker; PyCausalSim's futures module builds those known-answer worlds and grades a model against them. Causal Discovery You Can Check With PyCausalSim goes deeper on that grading.

Promotions and marketing across a store network

Parts retailers spend on circulars, digital media, loyalty offers and programs for professional installers, and the response differs by region, by season and by customer type. Measuring that spend is a marketing mix modeling problem with a twist: a store network has many regions, and many of them have too little data to estimate on their own.

Papilon, the other open-source framework I built, is a Bayesian marketing mix modeling library designed for this. It models carryover and saturation for each channel, and its GeoMMM partially pools estimates across regions, so a thin-data region borrows strength from the network without being forced to match it. Results from real lift tests can enter the likelihood directly, and the library produces forecasts, budget scenarios and plan stability checks. Graded on 120 simulated brands with known returns, its 90% ranges held the true return 94% of the time on standard brands, as reported in Marketing Mix Modeling You Can Check. Papilon Studio runs the same model in a browser on a weekly spend and sales file.

Fitment is a data problem before it is an AI problem

Every part fits a defined set of year, make, model and engine combinations. Catalog data arrives from many suppliers, and the records disagree, duplicate, supersede and decay. Entity resolution, embedding-based matching and graph structures for supersession chains are the unglamorous work that determines whether search, recommendations and any assistant can be trusted.

A GenAI system that recommends a part that does not fit the vehicle is worse than no system. Fitment correctness belongs in the design as a hard constraint, enforced against governed catalog data, never left to a language model's recall.

GenAI at the counter and in the back office

The useful set of applications is narrower than the hype and wider than a chatbot. Retrieval-augmented generation over the catalog, technical bulletins and repair content supports counter staff and call centers. Agentic workflows triage exceptions, such as a late inbound shipment or a vendor price change, and draft the response for a person to approve. Natural-language analytics over governed metrics lets a category manager ask a question without waiting for a report.

Each of these needs the same discipline. Build an evaluation set from real questions before launch. Score groundedness and answer correctness, and treat a wrong-fitment answer as a hard failure. Add guardrails and refusal behavior, keep a human in the loop for any action with financial consequences, and monitor quality, cost and latency in production. A release should pass the evaluation gate the way code passes its tests.

Workforce analytics for stores and distribution

Labor is one of the largest controllable costs in a store network. Labor demand forecasting from traffic, delivery volume and counter transactions feeds scheduling optimization, and the same intermittent-demand thinking applies to low-traffic hours. Retention and engagement models can help, with caveats that deserve their own treatment: fairness testing, explainability, strict governance over which features are allowed, and a clear line between decision support and decision making.

Production is a capability, not a project

Models that stay in notebooks earn nothing. The enterprise pattern looks the same on any major cloud: governed data pipelines, a feature store, a model registry, automated training and deployment, drift and data-quality monitoring, reproducible environments and automated tests. LLMOps adds prompt and retrieval versioning, evaluation harnesses, cost and latency tracking, and security review. The platform matters less than whether the team can ship, monitor and roll back a model on a regular cadence.

Prove the value in dollars

Every model needs a written path from its technical metric to money. Better quantile calibration lifts the in-stock rate, a higher in-stock rate recovers lost sales, and recovered sales carry margin. On the cost side, better stocking depth frees working capital and reduces obsolescence. The causal estimate above is what turns a lead-time improvement into a sales number a finance team will accept.

Measurement design matters as much as the model. Holdout stores, staggered rollouts and difference-in-differences separate the lift from seasonality and everything else that changed that quarter. In a store network the question after every rollout is which stores responded and why, and uplift models that segment units by effect answer it.

Portfolio prioritization follows from the same logic. Rank opportunities by estimated value, feasibility, strategic fit and implementation effort, fund the few that clear the bar, and say no to the rest in writing.

The frameworks

Papilon and PyCausalSim are open-source Python libraries, both under the Apache 2.0 license. Papilon is Bayesian marketing mix modeling with regional pooling, lift-test calibration, scenarios and plan checks. PyCausalSim covers causal discovery, structural causal models, intervention simulation and known-answer grading, with adapters for DoWhy and EconML.

Sources

  • J. D. Croston, "Forecasting and Stock Control for Intermittent Demands," Operational Research Quarterly, 1972
  • A. A. Syntetos and J. E. Boylan, "The Accuracy of Intermittent Demand Estimates," International Journal of Forecasting, 2005
  • The newsvendor and causal simulation results above come from the code in this article, run on Nov 26, 2026; the simulation data is synthetic and the cost figures are illustrative

About the author

Brian Curry leads Vector1, a research, applied science and machine learning lab in Kansas City that runs on a proprietary agentic operating system he designed. The lab works across data science, machine learning, AI and agentic systems, causal modeling, and system design and architecture. Over the past decade, he has directed data science, machine learning, applied and agentic AI, advanced analytics, and data architecture initiatives across major enterprises from $4 billion to $125 billion. Vector1's work includes Gedanken Galaxy (patent pending) and the open-source Python libraries PyCausalSim, for causal discovery and simulation, and Papilon, a complex systems framework for Bayesian marketing mix modeling. He previously founded KC AI Lab, expanding the regional practitioner network to over 1,500 members. His open-source frameworks, benchmarks, and research are available at vector1.ai.

Related research