Practice: Association Rules, and What Confidence Leaves Out
Question
Direct application
In a set of ten transactions, bread appears in eight, milk appears in eight, and both appear together in seven.
Compute the confidence of the rule
Enter the value. It is checked against the answer and the precision this task asks for.
2 hints available, least help first.
Hint 1: Retrieval cue
Confidence is a proportion of the transactions containing the antecedent, not of all transactions.
Hint 2: Next step
Of the eight transactions containing bread, how many also contain milk?
Direct application
In ten transactions, bread appears in eight, eggs appear in six, and both appear together in four. The rule
Compute its lift, to six decimal places.
(Then note, for yourself, which side of
Enter the value. It is checked against the answer and the precision this task asks for.
2 hints available, least help first.
Hint 1: Retrieval cue
Lift compares the confidence against how often the consequent occurs anyway.
Hint 2: Next step
The consequent is eggs, with support
Direct application
In ten transactions, bread appears in eight, eggs appear in six, and both appear together in four. The rule
Compute the confidence of the reversed rule
Enter the value. It is checked against the answer and the precision this task asks for.
2 hints available, least help first.
Hint 1: Retrieval cue
Confidence divides by the support of whichever itemset is the antecedent.
Hint 2: Next step
Now the antecedent is eggs, which appear in six of the ten transactions.
Direct application
Five items appear across ten transactions, with supports: bread
Apriori proceeds level by level, forming candidates at each level only from the frequent itemsets of the level below:
- Level 1 counts all five single items.
- Level 2 forms pairs from the level-1 survivors only; all pass.
- Level 3 forms one candidate from the level-2 survivors; it passes.
- Level 4 has no candidates.
How many candidate itemsets does Apriori count in total across all levels?
Enter the value. It is checked against the answer and the precision this task asks for.
2 hints available, least help first.
Hint 1: Retrieval cue
Only items passing the threshold at level 1 can appear in level-2 candidates.
Hint 2: Next step
Three items survive level 1. How many pairs can be formed from three items?
Recognition · Error diagnosis
In ten transactions, bread appears in eight, eggs in six, and both together in four.
A learner computes
Which response identifies the error?
2 hints available, least help first.
Hint 1: Retrieval cue
In the definition of confidence, whose support is the denominator?
Hint 2: Concept cue
Bread appears in eight transactions and eggs in six. Reversing the rule changes which of those two is divided by.
Direct application · Explanation
Five items appear across ten transactions. Butter has support
(a) State the anti-monotone property and explain why it holds, from the definition of support.
(b) List the itemsets containing butter that a level-wise search never counts, and say how many there are.
(c) A colleague suggests counting a few of the butter pairs anyway, in case one turns out frequent. Explain why this cannot happen, and distinguish the guarantee from a heuristic that usually works.
Write your answer, then compare it with the worked solution.
2 hints available, least help first.
Hint 1: Retrieval cue
If a transaction contains
Hint 2: Concept cue
For (c), ask whether the conclusion follows from the definition or from observing many datasets.
Compare with the worked solution
Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.
(a) The property.
If
The reason is immediate from the definition. Support counts transactions containing the whole itemset. Every transaction containing
The contrapositive is what the search uses: if
(b) What is skipped.
With five items, the itemsets containing butter are butter itself plus every combination of butter with a subset of the other four items. That is
Once butter is measured at
- pairs: butter-bread, butter-milk, butter-eggs, butter-jam
- triples: the six combinations of butter with two others
- quadruples: the four combinations of butter with three others
- the five-item set
One measurement disposes of fifteen candidates.
(c) Why counting them is wasted effort.
It cannot happen, and the reason is the property in (a) rather than an empirical observation. Any itemset containing butter has support at most
The distinction from a heuristic matters. A heuristic that usually works would leave open the possibility of a missed pattern, and using one would oblige an analyst to say what was risked, perhaps to spot-check, as the colleague suggests. Here the pruning is exact: the set of frequent itemsets found by Apriori is identical to the set found by examining all
This is unusual. Most ways of making a search cheaper give up a guarantee, and this one does not, which is why the property is the foundation of the algorithm rather than an optimisation bolted onto it.
A complete answer does each of these:
- applies antimonotone pruning
Interpretation · Evaluation
A mining tool returns these rules from ten transactions, sorted by confidence as it does by default:
| rule | support | confidence | lift |
|---|---|---|---|
| butter → milk | |||
| jam → bread | |||
| bread → milk | |||
| eggs → bread | |||
| bread → eggs |
An analyst reports the top two as the headline findings and recommends stocking milk beside butter and bread beside jam.
(a) Say what is wrong with taking the top of this list, referring to the support column.
(b) Two rules here have lift below one. Say what that means and whether either should be reported as a finding.
(c) Which rule in the table is best supported, and what would you say about it, including what it does not establish?
Write your answer, then compare it with the worked solution.
2 hints available, least help first.
Hint 1: Retrieval cue
Support times the number of transactions gives the count behind the rule.
Hint 2: Concept cue
Compare each confidence against the consequent's own frequency before judging it.
Compare with the worked solution
Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.
(a) The top of the list is the weakest evidence. Support
A complete answer does each of these:
- judges rule worth
- reads lift against one
Transfer · Evaluation · Explanation
A health system mines 400,000 prescription records for drug pairs that co-occur with an adverse-event code. Each record is one patient's medication list plus any recorded events.
The team reports: "We set a minimum support of
The adverse event's overall rate in the dataset is
Write a review covering:
(a) What the reported confidence of
(b) Whether the support threshold was appropriate for this question, and what it may have excluded.
(c) What ranking by confidence over a large rule set does, and what statistical problem the "top 50" review introduces.
(d) Whether the causal conclusion follows, and what else could produce this co-occurrence.
(e) What you would do instead, and what you would report.
Write your answer, then compare it with the worked solution.
3 hints available, least help first.
Hint 1: Retrieval cue
The event occurs in
Hint 2: Concept cue
Minimum support
Hint 3: Strategy cue
Separate four claims: the measure, the threshold, the ranking, and the causal step. Each fails for a different reason.
Compare with the worked solution
Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.
(a) The confidence of
below one. Patients taking drug A experience this event less often than patients generally, about twenty-four percent less. Their own figures, correctly read, are evidence against the association they are reporting. A threshold of
- A third factor. Age, comorbidity, or care setting drives both the prescription and the event.
- Recording artefacts. Patients on drug A may be monitored more or less closely, so events are detected at different rates rather than occurring at different rates.
- How a record was defined. The medication list's time window determines what counts as co-occurring at all. The direction of the rule is also not settled by the data. Confidence is directional,
A complete answer does each of these:
- computes rule measures
- reads lift against one
- distinguishes direction
- applies antimonotone pruning
- judges rule worth
Session complete
Every question in this set has been through once. What you can do now depends on how it went — practising again is worth more than moving on if any of it was uncertain.
Practice data
Your practice record is stored in this browser only. Clearing it removes every answer and every scheduled review, and cannot be undone.