Chapter 5. Frequent patterns and safe pruning
Data Mining as Observation, draft 0.3, 2026-09-09. Week 5 of ECE 514. Reading due before this chapter is TSK 5.1 to 5.3 and 5.6 to 5.7 [1]. Every number below traces to a committed file listed in the last section.
This chapter is standard content with one sidebar, and the book says so rather than stretch. Association analysis is the third task family, its algorithms are complete in TSK, and the observation program has no sealed result about market baskets. What it has is two results about the one idea in this week that transfers everywhere, which the session deck names as a course learning outcome. A monotone bound is a license to prune a search space without losing the answer. Section 5.4 states that idea precisely and gives the two owned instances, one proved and one measured. The rest of the chapter is TSK's material in the book's vocabulary, with the evaluation section pointing forward to chapter 8, because mining ten thousand rules and reporting the best is the multiple-comparison problem in its purest form.
5.1 Support, confidence, and the market basket
A transaction is a set of items. An itemset is any subset of the items. The support count of an itemset is the number of transactions containing it, and its support is that count divided by the number of transactions. An association rule is an implication from one itemset to a disjoint one, and its confidence is the support of their union divided by the support of the antecedent.
$$s(X)=\frac{\sigma(X)}{N},\qquad c(X\to Y)=\frac{\sigma(X\cup Y)}{\sigma(X)}=\frac{s(X\cup Y)}{s(X)}. \tag{5.1}$$
That support cannot rise as an itemset grows, that the support of a union is at most the smaller support, that every maximal frequent itemset is closed, and that under independence the confidence of a rule is the consequent's support whatever the antecedent, are machine-checked in Lean in appendix C.
Mining asks for every rule with support at least a minimum and confidence at least a minimum. The two thresholds are the observer's budget in this chapter. Lower them and the number of patterns grows without bound, and section 5.5 says what that costs. TSK 5.1 to 5.3 give the definitions, the worked baskets, and the algorithms, and the book does not repeat them.
5.2 Confidence misleads, and lift fails at low support
Confidence ignores the base rate of the consequent. If milk is in 90 percent of baskets, then almost any antecedent implies milk at confidence near 0.9, and the rule has said nothing. Lift divides confidence by the consequent's support, so that a rule with lift one is exactly the independence baseline and a rule with lift above one has found co-occurrence beyond chance.
$$\mathrm{lift}(X\to Y)=\frac{c(X\to Y)}{s(Y)}=\frac{s(X\cup Y)}{s(X)\,s(Y)}. \tag{5.2}$$
That lift is one under independence, at most the reciprocal of the consequent's support, and equal to the number of transactions for a single co-occurrence of two otherwise absent items, is machine-checked in Lean in appendix C.
Lift fails at low support, where a pair that co-occurs in two baskets out of ten thousand has lift 5000 and the number is about the rarity of the items, and TSK 5.7 catalogues the objective measures that repair this in different ways and shows that they rank the same rules differently.
The book's reading of that catalogue is chapter 1's. Each measure is an output metric. Each is the right one for some consumer, a stocking decision, a recommendation, a fraud alert, and the wrong one for others, and there is no consumer-free answer to which rule is most interesting. A pattern report names the measure and the decision it serves.
5.3 Anti-monotonicity is a pruning license
With d items there are two to the d minus one non-empty itemsets, and counting the support of each by a pass over the transactions is out of reach past a few dozen items. The Apriori principle is the observation that support cannot increase when an itemset grows [21].
$$X\subseteq Y\ \Longrightarrow\ s(X)\ge s(Y). \tag{5.3}$$
So if an itemset is infrequent, every superset is infrequent, and the search can prune the whole branch of the lattice above it without counting anything. The property is called anti-monotone, and it is a license. It says the pruning is safe, meaning that no frequent itemset is lost. The Apriori algorithm, FP-growth [22], and the maximal and closed representations are TSK 5.2 to 5.5, and the book keeps only the license, which is what transfers.
The deck's transferable idea, and the course learning outcome it names, is that the license in equation 5.3 has nothing to do with baskets. Any search over a structured space in which a bound on the objective is monotone in the structure can prune with the same safety. The sidebar has two instances.
5.4 Sidebar. Safe pruning outside itemsets
The word safe in this section has one meaning. A pruning rule is safe when the pruned search returns the same answer as the unpruned one on every input. The Apriori principle is safe by a two-line proof, and that proof is machine-checked in Lean in appendix C. A learned or heuristic pruning rule cannot earn that word from a finite test, since no held-out count proves a property on every input. What it can earn is the weaker statement, empirically lossless on the held-out cases, and the two owned instances below are held to that standard and named by it.
One proved license and one heuristic for formula search. Chapter 6's formula-search tool enumerates expressions over the features [23] and scores each by its optimal thresholded F1. Two of the three moves it makes are proved safe and the third is a heuristic, and the section keeps them apart: monotone-unary elimination is proved safe, the pointwise Youden ceiling on a node is proved, and using a node's ceiling to prune its descendants is a heuristic that the reruns below show missing the optimum on two of five datasets. Two theorems prune that search. The first, the Monotone Invariance Theorem of equation 6.2, says that a strictly monotone transform of a score, in either direction, cannot change its optimal thresholded F1, because the search sweeps thresholds both ways and so keeps every partition the transform could reach. A strictly increasing transform also leaves the AUROC unchanged, but a decreasing one, negation the plainest case, reverses the ranking and sends the AUROC to one minus itself; only the increasing direction preserves it, and an authority that should ignore orientation reads $\max(A,1-A)$. It is the F1 half that licenses the pruning: since the tool scores by optimal thresholded F1, every monotone unary node in the search tree is pruned with zero loss. The second bounds the achievable F1 of a score by its Youden index, the largest difference between its true-positive and false-positive rates over all thresholds. At any threshold the false-positive rate is at least the true-positive rate minus that index, and substituting that into the F1 expression gives a ceiling that holds for every score. The source paper stated the ceiling through AUROC alone, by the claim that any ROC curve with area A has Youden index at most two A minus one, and that claim, which the book records here as a correction to its own source, needed a hypothesis it did not carry rather than being false. It holds when the ROC curve is concave, as it is when the score's likelihood ratio is monotone in the score, because a concave curve lies above the two chords through its Youden point and so has area at least one half plus half the index; where it fails is a step-function ROC, which is not concave, and that is exactly the counterexample below. A score that ranks three quarters of the positives above every negative and the other quarter below every negative has AUROC 0.75 and Youden index 0.75, and reaches F1 0.857 at prevalence one half, above the 0.8 the AUROC form allows. For the formula search the consequence is direct. The AUROC form is a safe pruning bound only for concave ROC curves, and the search must prune with the measured Youden index, under which the ceiling loses nothing. The AUROC form entered the tool's record through its A* companion paper, whose pre-filter was rerun on 2026-09-03 beside the sound Youden ceiling. On the eight datasets the pre-filter lost no optimum, because the winning formulas had concave enough ROC curves, while the retracted theorem's ceiling sat below the F1 a formula actually reached for 812 of 8700 pair formulas on the 30-feature medical dataset and 412 of 1560 on the wine dataset. The Youden ceiling was admissible on all eight and evaluated 199 pairs on the medical dataset where the pre-filter evaluated 2576. The A* searches themselves were rerun as well, at depth three with fifty thousand expansions, in a strict mode with no pre-filter, the published fast mode, and a mode that prunes by the Youden ceiling. Strict and fast agreed on all five datasets and reproduced the published optima on the medical and diabetes sets, 0.958 and 0.694 with the published formulas. The Youden mode reached the same optimum on three datasets in one to two percent of the expansions and fell short by 0.006 and 0.002 on the other two, because pruning a subtree by its root's ceiling is sound for the root and a heuristic for its descendants, exactly as the AUROC pre-filter is. The five-dataset comparison of chapter 6 and the corrected comparison of chapter 7 used the tool's meta-learned pruning and never rested on the bound. The tool's code and paper carry the erratum, and the rerun's record is in its repository.
$$\begin{gathered} F_1^{\max}\ \le\ \sup_{t\in[J,\,1]}\ \frac{2t\pi}{t\pi+\pi+(t-J)(1-\pi)},\qquad J=\max_{\tau}\big(\mathrm{TPR}-\mathrm{FPR}\big),\qquad \pi=\text{prevalence}, \\ J\le 2A-1\ \text{when the ROC curve is concave, and not in general.} \end{gathered} \tag{5.4}$$
The Youden ceiling at an operating point, and the counterexample in which a score's Youden index exceeds two A minus one, are machine-checked in Lean in appendix C.
A formula whose Youden ceiling falls below a target F1 cannot beat it and can be pruned. The tool's runs used an AUROC threshold in place of that ceiling, which is licensed only for concave ROC curves. The threshold was tested at seven values up to 0.75 across eight datasets, 56 conditions, and at every one the pruned search found the same optimal formula as the unpruned search, zero admissibility violations. The reductions in evaluations at 0.75 ran from 70 percent on a 30-feature medical dataset to 99.1 percent on a synthetic one. The tool's third pruning rule, learned from exhaustive search on small folds, removed 88 to 99.6 percent of dead subtrees with zero false negatives on the datasets tested, and that is the standard the learned rule was held to. A learned prune is empirically lossless on the cases it was tested on, and that count is a measurement, not a proof of safety on every input.
A measured license for program search. A search over programs that transform grids, built for a reasoning benchmark [24], ran a beam over compositions of 29 operations to depth three. Its pruning rule discarded candidate states whose intermediate grids failed a similarity screen against the target. On the training tasks the naive search solved 53 and the pruned search solved 53. Zero lost. And the naive search hit its node budget on 94 percent of tasks while the pruned search hit it on none. The record's reading is the one this section exists for. Pruning was loss-free, so pruning was not the wall. Reachability was, because the operations that reach training tasks describe task types absent from the held-out set, on which the search solved zero of 172. A learned ranking of states then separated on-path from off-path states at held-out AUC 0.899 against 0.560 for the hand-written similarity, and the record separates the three things a search can be bad at. Ranking, which is learnable. Pruning, which was provably loss-free. And reachability, which no ranking or pruning changes.
The general lesson is the deck's, with a number attached. Anti-monotone pruning is not an itemset trick. It is the pattern by which a search over a structured space becomes feasible, and it is safe exactly when the bound is a bound. When the bound is learned, the count of false negatives on held-out cases is the only evidence of safety, and chapter 11 said what a cheap prune that is half right returns.
5.5 Pattern evaluation is chapter 8's problem
Mining returns thousands of rules, and the temptation is to report the ones with the highest lift. That is trying forty models and reporting the best, at a scale of ten thousand rather than forty. TSK 5.7 gives the statistical version. The expected support of a pair under independence is the product of the item supports, and a rule is interesting only if its observed support exceeds the expected one by more than sampling variation would produce.
$$\mathbb E\big[s(X\cup Y)\big]_{\text{indep}}=s(X)\,s(Y),\qquad \text{surprise}=\frac{s(X\cup Y)-s(X)s(Y)}{\sqrt{s(X)s(Y)(1-s(X))(1-s(Y))/N}}. \tag{5.5}$$
Chapter 8 section 8.5 gives the rule that applies. Count every comparison you made, correct for it, and prefer a preregistered rule to a mined one. Chapter 0 section 0.9 gives the arithmetic. Among ten thousand independent pairs at a five percent threshold, five hundred pass by chance.
Simpson's paradox is an aggregation quotient. Chapter 2 section 2.7 said aggregation collapses within-group directions. TSK's basket example is the case where the collapse reverses a rule [3]. Suppose two customer groups of one hundred transactions each. In the first, sixty baskets contain a television and thirty of those contain an exercise machine, confidence 0.50, while twenty-four of the forty without a television contain one, confidence 0.60. In the second, twenty contain a television and four of those an exercise machine, confidence 0.20, while twenty of the eighty without contain one, confidence 0.25. In each group, owning a television lowers the chance of the exercise machine. Combine the groups. Eighty televisions, thirty-four with the machine, confidence 0.425. One hundred twenty without, forty-four with the machine, confidence 0.367. Combined, the television raises the chance. The aggregate rule reads a direction that exists in neither group, and the consumer of the rule, a stocking decision for one store, is in one group. A rule mined on the aggregate is a rule about a quotient the consumer does not live in. That a pooled rate is the size-weighted mean of the group rates, that the classical example reverses, and that equal group sizes under both arms rule the reversal out, are machine-checked in Lean in appendix C.
Skewed support. When item supports span orders of magnitude, a frequent item pairs with everything at high confidence and the pairs are cross-support patterns that say nothing. TSK 5.8's remedy is the cross-support ratio, the smallest item support in the itemset over the largest, with a threshold below which the itemset is discarded. That the cross-support ratio can only fall when items are added, which is what lets a threshold on it prune safely, is machine-checked in Lean in appendix C.
$$r(X)=\frac{\min_{i\in X}s(\{i\})}{\max_{i\in X}s(\{i\})}. \tag{5.6}$$
The observer reading is chapter 3's. A frequent item is a hub of the basket space, appearing in everyone's list because it is central, and the cross-support ratio is the basket version of the Poisson excess. It asks whether the co-occurrence exceeds what the item's own frequency would produce.
5.6 What a pattern report must state
A project report that mines associations states the following.
- The thresholds, minimum support and minimum confidence, as the budget, with the count of itemsets and rules they admitted.
- The measure and the decision it serves. Lift, interest factor, or another, and the consumer for which that measure is the right output metric.
- The null. Expected support under independence for every reported rule, and the number of rules that would pass the threshold by chance at the count of rules examined.
- The strata. Whether the rule holds within each customer group, or only in the aggregate.
- The cross-support ratio of every reported itemset.
- The pruning rule and its safety. Apriori by proof, or a learned rule with its held-out false-negative count.
A report that lists the ten rules with the highest lift and nothing else will be returned.
Exercises
Warm-up
- Define support and confidence and explain why confidence is not symmetric.
- Why does confidence mislead when the consequent is common, and what does lift divide out?
- Why does lift fail at low support?
- State the Apriori principle and explain why it licenses pruning without loss.
- Why does FP-growth beat candidate generation on skewed data?
- State the difference between a maximal and a closed frequent itemset.
- What does the word safe mean in section 5.4, and how does a learned pruning rule earn it?
- In the program-search record, pruning was loss-free and the search still solved zero held-out tasks. Name what the record identified as the wall.
- Why is reporting the ten highest-lift rules a multiple-comparison problem?
- Explain Simpson's paradox as an aggregation quotient, in one sentence.
- What does the cross-support ratio ask, and what chapter 3 quantity is it the basket version of?
By hand
- Ten baskets. Bread in eight, milk in seven, both in six. Compute the support of the pair, both confidences, and both lifts.
- Two items each appear in two of ten thousand baskets and co-occur in both. Compute confidence and lift, and say what the lift measures.
- Five items, of which four are frequent singletons. Compute the number of candidate pairs Apriori generates and the number of itemsets it never counts, out of 31 possible.
- Using equation 5.4 with prevalence one half and a concave ROC curve, compute the F1 ceiling for AUROC 0.75 and for AUROC 0.5, and say what classifier achieves the second. Then compute the ceiling for the non-concave score of section 5.4 from its Youden index of 0.75.
- A pruned search finds 53 solutions and an unpruned search finds 53. State the false-negative count and whether the rule is safe on that evidence. State what one additional solution found only by the unpruned search would change.
- Item supports are 0.02 and 0.90, and the pair has support 0.018. Compute confidence in each direction, lift, and the cross-support ratio.
- Two groups of one hundred. In group one, 60 baskets have item A and 30 of those have item B, and 24 of the other 40 have B. In group two, 20 have A and 4 of those have B, and 20 of the other 80 have B. Compute the confidence of A implies B in each group and in the combined data, and state the direction in each.
- Ten thousand candidate rules are tested at a five percent threshold. Compute the expected number that pass by chance and the Bonferroni threshold.
Programming
- Implement Apriori from the definitions and run it on a transaction dataset from your project or a public basket set. Report the number of candidates generated and pruned at each size, and the pruning rate Lab 2 asks for.
- Rank the mined rules by confidence, by lift, and by the interest factor. Report the overlap of the top twenty under each and state which measure your project's decision needs.
- For every reported rule, compute expected support under independence and the surprise of equation 5.5. Report how many rules survive a Bonferroni correction at the number of rules examined.
- Stratify your transactions by a customer attribute and recompute the confidence of your top rules within each stratum. Report any rule whose direction reverses.
- Compute the cross-support ratio of every reported itemset and rerun with a ratio threshold of 0.1. Report what was discarded.
- Verify equation 5.4 numerically. For a synthetic score with AUROC 0.75 and a concave ROC curve, sweep the threshold and report the largest F1 achieved beside the AUROC form of the ceiling. Then build the score of section 5.4 that ranks three quarters of the positives above every negative and the rest below, and report that its best F1 exceeds the AUROC form while staying under the ceiling computed from its measured Youden index.
- Implement a learned pruning rule for a small search of your own, and report its false-negative count on held-out cases beside the reduction in evaluations.
Answers to the warm-up and by-hand problems are collected in the answer key at the end of the book.
Homework 5. Mine, then count what you mined
Assigned in week 5, due Sunday of week 6. Ten points. Extends Lab 2 on the same transaction data.
Part A, the run (3 points). Programming exercise 20. The candidate and pruning counts per size.
Part B, the measures (3 points). Programming exercises 21 and 22. The three rankings, their overlap, and the number of rules surviving correction. A report of the top rules by lift without the surviving count earns zero for this part.
Part C, the strata (2 points). Programming exercise 23.
Part D, the statement (2 points). The six items of section 5.6.
Preregistration. Before Part B, commit a file stating how many of your mined rules you expect to survive correction. Include the hash. Graded on having been made.
Sources for every number
Paths are relative to a checkout of the named repository, at the commit and with the access status listed in appendix A, all under github.com/ahb-sjsu unless appendix A says otherwise. Shas, DOIs, and versions are as recorded in the source files on 2026-09-03. A row is reproduced by opening the cited lines at that commit, and where a row names a script the command is the one the repository's README gives for it.
| Section | Claim | Source |
|---|---|---|
| 5.1 to 5.3, 5.5 | support, confidence, lift, the Apriori principle, FP-growth, closed and maximal itemsets, objective measures, Simpson's paradox, cross-support | TSK 2e chapter 5 |
| 5.3 | the transferable idea as a course learning outcome | instructor working documents, not public [11], ECE_514-01_FA26_session-outlines.md:117-136 |
| 5.4 | Monotone Invariance and AUROC invariance theorems, the AUROC to F1 bound via the Youden index, stated in the source for every ROC curve and corrected in the book to concave curves, with the counterexample at AUROC 0.75 and F1 0.857 | theory-radar\paper\astar_paper.tex:94-170; theory-radar\paper\theory_radar_paper.tex:290-304 |
| 5.4 | seven thresholds up to 0.75, eight datasets, 56 conditions, zero admissibility violations, reductions 70 to 99.1 percent | theory-radar\paper\astar_paper.tex:170-200 |
| 5.4 | the rerun of 2026-09-03 and 2026-09-04, pre-filter counts 2576 of 8700 and 413 of 1560, ceiling violations 812 and 412, Youden pruning 199 and 38, A* optima 0.958 and 0.694 in strict and fast modes, Youden mode short by 0.006 and 0.002 | theory-radar\results\rerun_youden_2026_09_03.json; theory-radar\ERRATA.md |
| 5.4 | learned pruning 88 to 99.6 percent with zero false negatives | theory-radar\README.md:88-100 |
| 5.4 | naive 53 equals pruned 53, budget exhaustion 94 percent to 0, 29 operations, depth three, 0 of 172 held out, learned ranking AUC 0.899 against 0.560, reachability as the wall | arc-equivariant-search\EXPERIMENTS.md:20-35,60-80; arc-equivariant-search\README.md:13; arc-equivariant-search\paper\arc_equivariant_search.md:20-30 |
| 5.5 | five hundred of ten thousand at five percent, Bonferroni | chapter 0 section 0.9 and chapter 8 section 8.5 of this book |
previous, Chapter 4. Dimensionality reduction as consumer-relative compression ยท next, Chapter 6. Classification, the classifier as an observer