Development of an AI-powered Market Basket Analysis system

Manual association rules quickly become outdated, and reports do not suggest what to place next to each other on the shelf. We develop market basket analysis as a turnkey solution: from data preparation to ready-to-use rules and procedures. You get a higher average order value and fewer empty baskets.
Frequently Asked Questions

Why market basket analysis produces garbage on raw transactions

Market basket analysis breaks not on the algorithm but on the input. Transactions are exported from the POS as is: canceled receipts, refunds, duplicate SKUs, service lines such as bag or delivery, and items split across several operations all enter the array.

If you calculate product association rules on such a dataset, the model honestly brings to the top what appears in every second receipt — and instead of actionable combinations, it returns obvious "bread and milk."

The cost of the error is not in strange numbers but in losing trust in the tool. A category manager opens the report once, sees trivial pairs, and stops using it — decisions about shelf placement and cross-sell offers are again made on gut feeling.

Data preparation here is more important than choosing an interestingness measure.

Refunds and cancellations are removed, duplicate SKUs are merged, weighted goods are brought to comparable units, service lines are separated from product lines, and basket boundaries are restored if a receipt is split across several operations.

Only after that does customer basket analysis show behavior rather than accounting artifacts, and a pair stops being a consequence of both products simply being bought often.

We break down how this is solved: what order data quality checks we put in place before calculation, by what criteria we cut off statistical noise, and how to make sure the discovered combinations can actually be turned into action.

What changes on the shelf and in reports after implementation

Rebuilding association rules stops being a quarterly project. Previously, exporting baskets, cleaning, and recalculating took days of manual analyst work, so the rules became outdated between runs.

Now calculation runs on a schedule on fresh transactions, and a new batch of combinations appears in reports the same day.

The second shift is the share of manual work with the assortment. A category manager no longer compiles pairs in spreadsheets: disputed combinations come with the number of baskets, share of joint purchases, and a stability estimate.

Manual work remains for shelf verification and the shelf placement decision — what calculation cannot cover.

The third is the stability of recommendations. A rule that grew on a few random receipts is cut off by support and confidence thresholds, so a one-time spike does not enter working recommendations.

We separately check how the association holds across different periods: if it falls apart when historical data is split, the rule does not reach shelf placement.

On the shelf, this is visible as rearranging: related products stand next to each other, complementary items fall into the impulse zone, unused bundles leave the plan.

In reports, the set of metrics changes — instead of product share in revenue, the frequency of joint purchases and basket coverage come to the fore.

What we check before handover: reproducibility of the calculation on historical data, the share of rules that passed the thresholds, full recalculation time, and the list of pairs that the manager confirms manually.

This is the acceptance checklist — it shows whether the model works on your data, not on a demo dataset.

Modes of market basket calculation: batch, streaming, hybrid

The frequency of rule updates sets two things at once: the usefulness of the output and the load on the storage. There is no point in recalculating associations for every new basket — over a short window they are noisy, and recommendations jump from session to session.

Too infrequent recalculation gives stable rules but misses shifts in demand: new items and seasonal SKUs drop out of the output for days.

The mode is chosen based on two questions: how quickly the assortment changes and whether a reaction is needed within the customer's current session. Below are three schemes among which the choice is made in practice.

Mode When it fits Limitations
Batch rule recalculation Assortment changes slowly, decisions are needed by morning: shelf replenishment, category reports Rules live until the next window, reaction to a demand spike only after recalculation
Streaming basket calculation Reaction needed within the session: cross-sell, in-cart suggestion, dynamic bundles A long window is expensive in resources, associations on a small sample are unstable — support thresholds are needed
Hybrid mode Large catalog: stable associations are recalculated rarely, fast suggestions are needed often The two layers of rules are reconciled by product keys, harder to debug and explain the output

At the start, batch recalculation is almost always chosen: it is predictable and easy to verify on historical data. Streaming is enabled when a scenario appears where freshness matters — otherwise the added complexity does not pay off.

In hybrid mode, the rules of the two layers are matched by keys: if the keys diverge, the output starts contradicting itself.

"Batch recalculation covers most tasks; you move to hybrid when a metric appears that cannot be calculated overnight" — from the practice of our retail implementations

How we implement basket analysis: work stages

Implementation of basket analysis (market basket analysis) starts not with the model but with order data. Until receipt completeness and product labeling are verified, any association rules will describe noise. Below is the sequence of work that we go through together with the customer's team.

  1. Order data audit. We verify receipt composition, product and category identifiers, sort out duplicates, cancellations, refunds, and weighted items, and assess the history depth. The result is a data suitability report and a list of gaps that must be closed before calculation.
  2. Calculation scheme. We agree on the analysis level — receipt or order, history window, minimum support and confidence thresholds. We fix which associations are considered significant and what goes into exclusions.
  3. Rule calculation setup. We assemble regular recalculation: a full run over accumulated history and an incremental run over new receipts. The result is stored in a data mart, from which recommendations, mailings, and interfaces retrieve it.
  4. Backtesting rules on history. We run associations over past periods: how many were confirmed, how many turned out false, what fell apart on seasonal spikes. We cut unstable combinations before launch.
  5. Embedding into processes. We connect the rules where decisions are made: selection of related products, catalog navigation, bundle assembly. Based on feedback, we adjust thresholds and the list of exclusions.
  6. Handover of the solution to the team. We hand over configurations, the data scheme, the recalculation procedure, and an analysis of typical failures, and train the customer's specialists — after that the system runs without our involvement.

What we hand over: rules, schemes, procedures

A market basket analysis project ends not with a list of frequent product pairs but with a set of artifacts by which the system can be developed without us.

We hand everything over in a reproducible form: the same calculation on new data gives a comparable result, and the selection logic is explained by thresholds, not verbal agreements.

  • Solution documentation — entity descriptions: basket, transaction, product item, rule, customer segment; a metric dictionary with formulas.
  • Combination selection rules — set support and confidence thresholds, category filters, stop lists, and exclusions of service items.
  • Data scheme — structure of the transaction data mart, sources, requirements for completeness and arrival frequency, processing of refunds and weighted goods.
  • Recalculation procedure — triggers and frequency, run order when new transactions accumulate and reference data changes.
  • Rule stability control — checking associations across several periods and points of sale, filtering out random coincidences, a log of exclusion reasons.
  • Reference data update procedure — recording the effective date, monitoring the share of unrecognized items in baskets and the threshold at which a rule goes for review.
  • Reporting and handover — composition of regular exports, description of data marts for analysts, access procedure to the calculation environment, and support procedure.

Case study: how we reduced single-item baskets and rare combinations

Before: intuition instead of data

A retail chain, several dozen locations, an assortment of thousands of SKUs. Product combinations in receipts were analyzed manually: category managers relied on experience and sales of individual items, not on joint purchases.

As a result, 44% of receipts remained single-item baskets, and rare product combinations with a strong association never made it into a promotion — they simply were not seen.

What we changed and what we got

We collected receipt history over a long period and calculated association rules by support, confidence, and association strength. We filtered out noise: seasonal spikes, pairs glued together by the same discount, items without margin.

The output was a ranked list of associations that went to category management as a plan for shelf placement and joint promotions; the effect was tested at locations comparable by traffic.

Implementation reduced the share of single-item receipts from 44% to 31%, the average number of items per receipt increased by 0.6, and the share of promotions built on associations from the model reached 70%.

Before and after metrics were calculated by the same rules, so the growth cannot be attributed to seasonality.

Product combinations stopped being a matter of taste: we see which pairs actually pull each other and plan shelf placement by this list — the result repeats from location to location.

— department head ProdMarket

What to do if the catalog already has manual combination rules?

Manual combination rules are agreements: promo bundles, supplier requirements, shelf placement logic that a manager edits in the admin panel. They are not verified by data: a pair lives in the catalog for years but rarely intersects in receipts.

The working scheme is a hybrid: manual rules remain hard constraints, while the calculation layer provides recommendations with weight and explanation.

We calculate bundle frequency and association strength using the classical approach of Agrawal and Srikant — it provides numbers instead of taste-based assessments.

Option When it fits Limitations
Manual rules only Little data, narrow assortment Rule conflicts are not visible, does not scale
Shadow calculation run First step of migration to calculation Shelf placement is still managed manually
Hybrid: manual as constraints Catalog with promos and obligations A priority procedure is needed
Full transition to calculation Large receipt flow, no external obligations Formal category logic is lost

Migration to calculation proceeds in stages: we consolidate current rules into a single registry with source and term, run calculation in shadow mode, and compile a conflict report. We give each disputed pair to the manager with numbers — support, confidence, number of receipts.

After approval, the rule receives priority, and calculation begins to manage shelf placement in agreed catalog zones. Usually 10-15% of manual rules are canceled as erroneous, and the rest are retained and begin to work on data.

Common technical doubts before starting

Before starting, technical teams ask almost the same questions: how a rule behaves on data that was not present during training, and what happens when the assortment, prices, or sales channel change. Below are short answers on four bottlenecks that most often break trust in the result.

Seasonality in rules — how do you avoid dragging a holiday spike into an ordinary month?

We calculate rules on a sliding window and store the link to the period: pre-holiday, baseline, sales period. An association that rose on seasonal demand does not enter the baseline set — otherwise summer recommendations pull New Year items.

Wholesale shipments in the data — will they spoil the statistics?

They will if everything is calculated in one stream: one large shipment weighs as much as hundreds of ordinary receipts. We separate streams by shipment type and channel, build rules separately for retail and wholesale, and mark mixed combinations as low priority.

How do you know an association is real and not random?

We test every rule for stability: recalculation on independent periods, assessment of association strength relative to random coincidence, and filtering out rare combinations.

Only what repeats across different windows and does not rest on a single large purchase goes into the working set.

How often should rules be recalculated?

Frequency is set by the pace of change: with fast updates of assortment and prices — daily incremental updates on new data; with a stable catalog — a full recalculation once a week.

We fix the schedule in the procedure so that the rule set does not "fluctuate" between runs.

Let's discuss your task and come back with an estimate and plan

The first conversation takes about an hour and is to the point — we look at data, not a presentation. To come back with a project estimate and work plan, we need a minimum of context; we clarify the rest ourselves.

  • Export of transactions for several months: receipts, items, purchase time, sales channel.
  • Product reference data breakdown: categories, bundles, weighted items, seasonal replacements.
  • List of business questions: cross-sell in the receipt, shelf layout, bundle assembly, promotions.
  • Where the data is stored and how to connect to it: storage, reporting layer, regular export.
  • Access restrictions: anonymization rules, security service requirements, mode.
  • Who on the customer side accepts the result and in what form they expect it.

Based on the conversation, we send a work plan: stages, data composition, output format, project start date, and the points where you decide whether to continue.

The metric calculation scheme is also included — so the result can be explained to the business rather than taken on faith.

Next is a short pilot on your data slice: it shows whether the model catches stable associations, and only after that do we talk about scaling. You can discuss the task by email or a short call — that is enough to move to the estimate.

AI Development Areas

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1393
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1368
  • B2B Advance company logo design
    B2B Advance company logo design
    815
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1139
  • AIDER company logo development
    AIDER company logo development
    1057
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1152