Apriori Algorithm Calculator

Read the Theory Guide →

Enter a transaction dataset, set the minimum support and confidence, and generate frequent itemsets and association rules. The solver shows how candidates are counted and filtered at each level before evaluating the resulting rules.

What You Can Explore

  • Edit the transaction table by entering items separated by commas in each row. Duplicate items within a transaction are ignored.
  • Set Min Support (%) and Min Confidence (%) to control which itemsets and rules survive.
  • Press Generate Association Rules to build the itemsets level by level and inspect which candidates are kept or dropped.
  • Use the final rules table to compare each rule's combined support, left-side support, confidence, and Keep or Drop status.
Core Mechanics
▼
  • Support is the Entry Ticket: To survive, an itemset must appear frequently enough to pass your Minimum Support threshold. If it falls short, cross it off immediately—it is permanently discarded.
  • The Pruning Rule (Apriori Property): If a small itemset is infrequent, *every larger set containing it is also infrequent*. If {A,B}\{A, B\} fails, you never waste time scanning the data for {A,B,C}\{A, B, C\}!
  • Level-by-Level Growth: You must build itemsets strictly one step at a time. Frequent singles combine to form pairs; surviving pairs form triplets. You only ever build size k+1k+1 using the winners from size kk.
  • Confidence Makes Rules: Finding popular itemsets is only half the job. To create an actual recommendation rule (A⇒BA \Rightarrow B), you filter by Confidence: *"Given they already have A, how likely are they to also have B?"*
Initializing Workspace...

Understanding Your Result

The result is generated entirely from your transactions and the two thresholds you entered. The solver converts the minimum support percentage into a required transaction count, counts each candidate's occurrences, filters the candidates, and uses the surviving itemsets to generate the next level. Once the frequent itemsets are complete, the solver evaluates the possible association rules using confidence.

  • Required Support Count is the minimum number of transactions an itemset must appear in to survive. For example, with 5 transactions and 60% minimum support, an itemset needs a count of 3.
  • Each iteration first generates candidate itemsets and then filters them by the required support count. Candidates below the threshold are marked Drop, while survivors appear in the frequent-itemset table and can be used to generate the next level.
  • The Apriori process grows from 1-itemsets to 2-itemsets, 3-itemsets, and so on. If no candidates survive a level, the process stops.
  • The final rules table shows Support(X ∪ Y), Support(X), and Confidence. The confidence of X → Y is based on how often X occurs together with Y relative to how often X occurs.
  • A rule and its reverse can have the same combined support but different confidence because their left-hand sides are different. A high-confidence rule also does not automatically mean that the relationship is useful or causal.
  • Dropped rules remain visible in the final table so you can see which rules failed the confidence threshold rather than only seeing the rules that were kept.

Try These Experiments

Lower the Support Threshold

Setup: Run the preloaded transactions with Min Support at 60%. The summary shows a Required Support Count of 3, so item c, which appears in only 2 transactions, is dropped in Iteration 1.

Action: Change Min Support from 60 to 40 and generate the association rules again without changing the transactions or confidence.

What to Observe: The Required Support Count falls from 3 to 2. Item c now survives Iteration 1, so candidate pairs containing c can also be considered at the next level.

Takeaway: Lowering minimum support allows less frequent items to survive. Because later candidates are built from earlier survivors, changing the threshold can affect every iteration that follows.

Lower the Confidence Threshold

Setup: Run the preloaded transactions with Min Confidence at 80%. In the final table, {e} → {o} has 75% confidence and is dropped, while {o} → {e} has 100% confidence and is kept.

Action: Change Min Confidence from 80 to 70 and generate the rules again, keeping Min Support at 60%.

What to Observe: The {e} → {o} rule now reaches the 70% threshold and changes from Drop to Keep. The reverse rule remains at 100% confidence.

Takeaway: Confidence depends on the direction of the rule. The same pair can produce different confidence values, so always check X → Y and Y → X separately.

Change One Transaction

Setup: Run the preloaded transactions at 60% support. Item e appears 4 times and survives, while c appears 2 times and is dropped.

Action: Change transaction P3 from 'a, e, k, m' to 'a, c, k, m', then generate the rules again.

What to Observe: The support count of e decreases from 4 to 3, while c increases from 2 to 3. Both now meet the required support count, so c becomes available when generating the next level of candidates.

Takeaway: A single transaction can change whether an itemset survives the support threshold. Because Apriori builds later levels from earlier survivors, a small data change can propagate through the rest of the mining process.