Source deck: FAI_Part13_PatternMining_25-26.pdf, 35 PDF pages (p.34 is the conclusions slide, p.35 is the closing "Questions?" slide). The count was read off the file itself with two independent libraries, PyMuPDF and pypdf, and both report 35. An earlier pack note said 36; that number is wrong and every citation below uses the verified 35 page file.
Page-number convention: only a few slides in this deck carry a printed number (pp.2, 3, 4, 15, 24, 30), and where one is printed it equals the PDF page index. There is no drift to correct, so every citation below is a PDF page index, counted from the title slide as p.1.
Lecture transcript: T12. Exercise material: session 10, assignment pattern_mining_FAI.pdf (3 pages) and solutions pattern_mining_solution.pdf (102 slides). Every trace in this chapter was re-executed in Python and checked against the solution slides.
Printed copy: all task answers and model answers are expanded below their questions.
h covers a transaction e exactly when h ⊆ e (deck p.8). Generality is the same subset relation: h1 is more general than h2 exactly when h1 ⊆ h2.the theory exam... tests both for factual knowledge as well as for synthetic knowledge... we also want to see that you can uh bring things across different chapters uh together because as you know by now uh the course is largely incremental.(Lecturer, T9). Part 13 is the clearest instance of that in the whole course: it is Part 12's search machinery run on a different acceptance test, and the deck says so on its own slides (pp.19, 23, 34). An answer that connects the two is the answer that earns the synthesis marks.
Deck p.3 places the topic: data mining is "a subfield by itself that focuses on algorithms and techniques for analysing data, for finding interesting and actionable patterns and models in these data", and the course narrows to one corner of it, "frequent pattern mining, i.e., discovering patterns or regularity in the data". Page 4 gives the commercial instance, recommender systems: a webshop wants to know which books are bought together so it can suggest the third one.
Page 10 is the scope slide, and its middle bullet is the sentence that separates this Part from the previous one:
Deck p.10, verbatim: "data typically need not be divided into positive and negative class (as in concept learning)". There is no class column, so there is nothing for a hypothesis to be consistent with. The acceptance test becomes statistical: a pattern is kept when it occurs often enough. Everything else in this Part, the ordering, the borders, the search, is inherited from concept learning.
The rest of p.10 sets the boundaries of the lecture. Patterns come in several data types, "sets / strings / graphs", and the exercise session works on the first two. Patterns are wanted because they "give insight into the data" and because they are "actionable, can be used to suggest further products (association rules)". And the method is stated as search: "we search through the space of possible patterns", with the explicit note that "the basis of pattern mining is closely related to version spaces".
Page 9 gives the non-supermarket example that returns later in this chapter as the motivation for two thresholds at once: molecules are graphs, patterns are subgraphs, and the interesting subgraph is the one that occurs in the mutagenic molecules and not in the clean ones. Keep it in mind for section 12, where "frequent in one dataset, infrequent in another" becomes the algorithm's second test.
Pages 5 and 6 are the same slide in two frames. Five customers have each bought a subset of six books, and the items are named by the colour of the cover: Blue, Red, Green, Yellow, Brown, AI. The slide writes the first basket twice, once as a boolean vector and once as a set, and the second form is the one the rest of the Part uses.
The first basket is written both as [true,true,true,false,false,false] and as {Blue,Red,Green}. Both descriptions carry the same information for this shop. State what stops being true when the shop is Amazon, and what the itemset form is silently asserting about the four books it does not mention.
Nothing about the information content changes; what changes is cost and readability. The vector has one slot per product, so with the "100.000s of products" of deck p.11 every basket becomes a hundred thousand entries of which three are true. The itemset form lists only what was bought, which is why p.11 concludes "Only what you buy matters!".
The silent assertion matters more, and p.14 makes it explicit: a transaction itemset is read under a closed world. Writing {Blue,Red,Green} as a basket asserts Blue and Red and Green and not Yellow and not Brown and not AI. A pattern itemset asserts nothing about the items it omits. Same notation, two readings, which is exactly the single representation trick of section 5.
The slide reports {Blue, Green} at 4/5 = 80 percent and the three-book pattern {Blue, Green, AI} at 3/5 = 60 percent. Give both numbers as absolute frequencies, then state the general inequality between the frequency of a pattern and the frequency of any pattern that extends it. Say which direction the inequality runs and why.
Absolute frequencies 4 and 3, out of 5 transactions. The general fact: extending a pattern can only lose transactions, never gain them, because a basket that contains all of {Blue, Green, AI} certainly contains all of {Blue, Green}. So for I1 ⊆ I2 we get freq(I1, D) ≥ freq(I2, D). That is the anti-monotonicity property, printed on p.18 and tested verbatim as MC 1.5 of the 2023 sample paper (section 6 below).
Write the absolute number in the FAI exercise exam. Percentages appear on this motivating slide and nowhere in session 10, where every threshold is an absolute count ("frequency ≥ 3", "frequency ≥ 2", "frequency < 3"). Section 15 explains why that habit matters two days later.
Page 7 is the only slide in the deck about association rules. It states the shape, "IF X THEN Y with a particular probability P", derives one rule from the frequencies of the previous slide, and notes that rules "Can be used for predictive purposes". The conclusions slide p.34 repeats the idea in one line: "Frequent patterns can be turned in association rules to make predictions."
The slide writes the rule's probability as the fraction 60% over 80%. Evaluate it, say in words what event it is the probability of, and say which of the two frequencies belongs to the more specific pattern.
60/80 = 0.75, that is 75 percent. It is the conditional probability that the AI book is in the basket given that the two books in the IF part are, estimated by counting: 3 baskets contain all three books, 4 contain the two. The 60 percent belongs to the more specific pattern, which is the whole set {Blue, Green, AI}; the 80 percent belongs to the IF part alone. So the rule's probability is (frequency of the whole set) divided by (frequency of the condition), and it can never exceed 1 precisely because of the anti-monotonicity of the numerator.
What to do with this on 18 August: recognise it, do not go looking for it. This quantity is shown here once, it is not named anywhere in the deck (a full-text search of all 35 pages returns no occurrence of the word "confidence"), and no question in session 10 asks for a rule or for a probability. Section 15 is the discipline that keeps this from becoming a wrong answer.
Page 8 (reprinted as p.16 with the phrase "generality ordering lattice" added) gives the whole formal language in five lines. An itemset problem is the "special case where all attributes are boolean", and then:
e ⊆ ℐh ⊆ ℐh covers example e if and only if h ⊆ eh1 is more general than h2 if and only if h1 ⊆ h2Two margin notes on the same slide carry the reading: "hypothesis = pattern", and "heavily used in pattern mining". From here on, pattern and hypothesis are the same object.
Read the last two lines together and the geometry of the whole Part follows. More items means a stricter conjunction, which means fewer transactions covered, which means more specific and less frequent. Fewer items means more general and more frequent. The empty itemset {} is the most general pattern of all: it demands nothing, so it covers every transaction and its frequency is always the size of the dataset.
The table's last column is labelled No Class, and the slide translates the conjunctive pattern "Salami = True AND Bread = True" into the itemset {Salami, Bread}. Two consequences for the hypothesis language follow. Name both. Then say why "Coffee = False" can never be part of a pattern here.
One. With no class column there are no positive and negative examples, so the acceptance test cannot be "covers all positives and no negatives". It is replaced by a frequency threshold (p.10, and the formal statement in section 6 of the session 10 sheet).
Two. The pattern language is conjunctions of positive attribute tests only. "In itemset mining one only focusses on the true attributes" (p.11). The itemset {Salami, Bread} is shorthand for the conjunction Salami ∧ Bread, with nothing said about coffee or milk.
"Coffee = False" would be a negated literal, and the slide gives the reason it is excluded: "In recommender systems/a supermarket there are 100.000s of products, only what you buy matters". Allowing negations would put a second literal in play for every product in the shop and blow up the search space, for information nobody wants. The formal consequence is on p.14: a pattern says only what must be present.
Deck p.13 shows the running dataset for the rest of the chapter, four transactions over four items, plus three worked frequencies. Deck p.14 explains why the same notation means two different things on the two sides of the covers relation.
The four rows, written as itemsets with the initials the deck uses from p.17 onwards (s, b, c, m), are {s,b,c,m}, {s,b,m}, {s,c,m} and {s,m}. Learn this dataset: pages 17 to 33 never change it, and every worked number in the second half of this chapter comes from it.
The slide gives freq({salami, coffee}) = 2, freq({coffee}) = 2 and freq({salami, milk}) = 4. Compute two more from the table: freq({bread, coffee}, D) and freq({coffee, milk}, D). Then explain in one line why salami and milk reach 4.
freq({bread, coffee}) = 1. Only the first row has True in both columns. freq({coffee, milk}) = 2, rows 1 and 3.
Salami and milk reach 4 because both columns are True in all four rows, so the pattern {s,m} covers every transaction: 4 out of 4, a relative frequency of 100 percent. That single fact drives the whole of p.19.
Method note, worth more than the numbers: counting a pattern means counting rows in which every listed item is True, ignoring the other columns entirely. A row with extra items still counts.
one representation is used for both the patterns and the data. Um which can be a bit confusing sometimes but it holds several advantages.(Lecturer, T12). He is warning you about a real hazard, not making conversation. The two sides of the covers relation are printed in the same notation, and the direction of the subset sign is the only thing that tells them apart. When a trace confuses you, ask which of the two objects you are holding.
The slide states it precisely. A transaction itemset {i1, …, ik} denotes i1 ∧ … ∧ ik ∧ ¬i(k+1) ∧ … ∧ ¬in: everything not listed is false. A pattern itemset {i1, …, ik} denotes only i1 ∧ … ∧ ik. From that asymmetry comes the line the whole search is built on: "The pattern covers all its supersets!"
The slide works two examples: {s,b,c} covers {s,b,c} and {s,b,c,m}; {s,b} covers {s,b}, {s,b,c}, {s,b,m} and {s,b,c,m}. Using the same rule, decide which of these four the pattern {s,b} covers: {s}, {s,b}, {s,b,m}, {s,c}.
It covers {s,b} and {s,b,m}, and neither of the other two.
{s} is a subset of the pattern, not a superset: a basket with salami and no bread does not satisfy the conjunction s ∧ b. {s,c} fails for the same reason, it has no bread. The rule has one direction only: a pattern covers a transaction when the pattern is contained in it, so a pattern covers exactly its supersets, including itself.
Classic error this prevents: reading "more general" as "bigger set". In this language more general means smaller itemset. The empty pattern is the most general one there is.
Pages 17 and 18 are one slide in two frames. Two copies of the same 16-node lattice stand side by side, labelled Transactions on the left and Patterns on the right, with the word covers between them. The point of drawing the identical structure twice is the single representation trick: the objects look the same, but a point on the right selects a whole region on the left.
Take the pattern {s,m} on the right. List every node of the left-hand transaction lattice it covers. Then do the same for the pattern {s,m,c}. Compare the two sets and say which pattern is the more general one.
{s,m} covers its four supersets: {s,m}, {s,m,c}, {s,m,b}, {s,m,c,b}. {s,m,c} covers only two: {s,m,c} and {s,m,c,b}.
The second covered set is a subset of the first, so {s,m} is the more general pattern. This is the picture behind the definition: generality between patterns (a subset relation on the right) shows up as containment between covered regions (on the left). Because the regions are nested, the counts are ordered, which is the next slide.
Note the arithmetic shortcut, worth having in an exam: a pattern of size k over n items has exactly 2(n − k) supersets. Here 22 = 4 and 21 = 2.
anti-monotonicity: if I1 ⊆ I2 (that is, I1 is more general than I2) then freq(I1, D) ≥ freq(I2, D) (as it has more supersets)
The parenthesis is the proof. I1 covers all its supersets; every superset of I2 is also a superset of I1; so the transactions counted for I2 are a subset of those counted for I1.
The usable form of the property is its contrapositive, and it is what every algorithm in this Part exploits: if an itemset is infrequent, every extension of it is infrequent too, so the entire region below it can be discarded without a single further count.
From the p.13 table, freq({c,b}, D) = 1. The minimum frequency threshold is 2. Name every node of the 16-node lattice you may now cross out without counting anything, and name the property that licenses it.
Cross out {c,b} itself and its three supersets: {s,c,b}, {m,c,b}, {s,m,c,b}. Four nodes, one count. The licence is anti-monotonicity: each of them contains {c,b}, so each has frequency at most 1, which is below 2.
Check against the deck: on p.33 those four nodes are exactly the ones left uncircled in the bottom right of the lattice, and the lecture makes the same deletion out loud on p.19 with coffee and bread at threshold 4.
2023 sample theory exam, MC 1.5, verbatim
The anti-monotonicity property in itemset mining implies that if itemset I2 is a superset of itemset I1, then the frequency of I1 will be higher-or-equal than the frequency of I2.
True. "I2 is a superset of I1" is I1 ⊆ I2, and deck p.18 prints exactly this conclusion: freq(I1, D) ≥ freq(I2, D). I1 is the more general pattern, it demands less, so it covers at least as many transactions.
Why "False" is tempting and wrong: two ways to get lost. The first is reading "superset" as "more general" and flipping the inequality. In this language the bigger itemset is the more specific one, because it is a longer conjunction. The second is expecting a strict inequality: the statement says higher-or-equal, and equality really does occur here, for instance freq({s}) = freq({s,m}) = 4 in the p.13 table. A statement with ≥ is not falsified by a tie.
Sanity check you can do in five seconds: take any concrete pair. {s} appears in 4 baskets, {s,c} in 2. The longer set is the rarer one. Anti-monotone means the constraint "freq ≥ c" is inherited upwards, never downwards.
Marking arithmetic: +0.5 correct, -0.25 wrong, 0 if both boxes are empty. The expected value of answering is 0.75p - 0.25, which is positive whenever your confidence beats one in three, so never leave a true/false box blank.
Pages 19, 20 and 21 run the same experiment three times on the same four transactions, changing only the thresholds. Learn to answer the question "which nodes are solutions" by inspection before learning the algorithm that finds them mechanically; the exam asks for both.
At a minimum frequency of 4, that is 100 percent, the slide gives the answer {s,m}, {s}, {m}, {} and then draws the conclusion this Part keeps coming back to: "Version space with S = {{s,m}} and G = {{}}", "Transactions act as positive examples, and we require 100% frequency !", "If we require 100% coverage, then S is intersection of all itemsets!"
At threshold 4, {c} is not a solution because freq({c}) = 2. How many of the 16 nodes does that single count remove from consideration, and which ones? Then use the slide's own hint to compute S without searching at all.
Eight nodes, namely {c} and all seven of its proper supersets: {s,c}, {m,c}, {c,b}, {s,m,c}, {s,c,b}, {m,c,b}, {s,m,c,b}. A one-item pattern over four items has 23 = 8 supersets including itself. The same count applies to {b}, and the two families overlap, which is why only four nodes are left standing.
S without searching: at 100 percent frequency a solution must be contained in every transaction, so the most specific solution is the intersection of all four rows. {s,b,c,m} ∩ {s,b,m} ∩ {s,c,m} ∩ {s,m} = {s,m}. That is the slide's line "S is intersection of all itemsets", and it is a one-step answer to any 100 percent question.
At a minimum frequency of 2 the answer set grows to twelve itemsets, and the slide prints the two definitions that fill-in 2.2 asks for: "S contains the most specific (i.e., the maximal itemsets) that satisfy the frequency threshold. G contains the most general (i.e., the minimal itemsets) that satisfy the frequency threshold." Here S = {{s,m,c}, {s,m,b}} and G = {{}}.
Verify that {s,m,c} really is maximal at threshold 2: extend it in every way the item set allows and count. Then say why {s,c,b} is not in S either, given that it is not in the solution set at all.
{s,m,c} has exactly one extension, {s,m,c,b}, and its frequency is 1 (only the first row has bread and coffee together), which is below 2. No extension survives, so {s,m,c} cannot be pushed further down: it is maximal, and it belongs in S.
{s,c,b} has frequency 1 for the same reason, so it fails the threshold and is not a solution. Maximality is only ever asked of things that are already solutions: S is defined as the maximal solutions, not the maximal itemsets.
The twelve solutions at threshold 2, for reference: {}, {s}, {m}, {c}, {b}, {s,m}, {s,c}, {s,b}, {m,c}, {m,b}, {s,m,c}, {s,m,b}. All verified by counting rows in the p.13 table.
Adding a maximum frequency threshold of 3 leaves S unchanged at {{s,m,c}, {s,m,b}} but moves G from {{}} to {{b},{c}}. Say which frequencies caused the move, why {s} does not qualify for G, and why S was untouched.
The four most general itemsets are all too frequent now: freq({}) = 4, freq({s}) = 4, freq({m}) = 4, freq({s,m}) = 4, and 4 > 3. They stop being solutions, so the boundary of minimal solutions slides downwards until it reaches itemsets whose frequency has dropped to 3 or less. Those are {b} and {c}, both at frequency 2, and neither can lose an item and still be a solution, since the only thing below them is {} at frequency 4.
S is untouched because the maximum threshold bites at the top of the lattice, where frequencies are large, and S lives at the bottom, where they are small. Frequencies only fall as you go down, so a set that already satisfied "freq ≥ 2" and sits deep in the lattice automatically satisfies "freq ≤ 3" as well.
The slide's closing note is the design idea behind section 12: "We have been using the same set of examples, one could use a min freq threshold on the positives and a max freq threshold on the negatives".
Pages 22 and 23 are the formal versions of what the previous section did by eye. The deck splits them across two slides, one border each, and the sample exam's fill-in question is built out of both.
S-set = { I ⊆ ℐ | I satisfies min and max frequency thresholds, and there is no J ⊆ ℐ that is strictly more specific than I (i.e., I ⊂ J and J ≠ I) and also satisfies the thresholds }
S contains all maximal solutions, i.e., solutions that cannot be extended with extra items
The definition quantifies over J ⊆ ℐ, with the script ℐ being the set of all possible items. In the picture on the right, does "strictly more specific than I" point up or down, and does it mean J is a subset or a superset of I? Check your answer against the formula in the parenthesis.
Down, and superset. The parenthesis says I ⊂ J: the more specific object is the larger itemset, drawn lower in the lattice, and the lattice's bottom node {s,m,c,b} is the most specific itemset there is.
Watch the two different roles of the subset sign in one line. J ⊆ ℐ only says J is a legal itemset over the available items. I ⊂ J is the generality ordering. Mixing them up is the single most common misreading of this slide.
Plain paraphrase to memorise: S = the solutions you cannot extend. Anything you add to an element of S breaks a threshold.
G-set = { I ⊆ ℐ | I satisfies min and max frequency thresholds, and there is no J ⊆ ℐ that is strictly more general than I (i.e., J ⊂ I and J ≠ I) and also satisfies the thresholds }
G contains all minimal solutions, i.e., solutions from which no item can be deleted
Suppose a question gives you a minimum frequency threshold and no maximum. What is the G-set, always, and what is the one condition on the threshold that has to hold for your answer to be right?
G = {{}}, the singleton containing the empty itemset. The empty pattern covers every transaction, so its frequency is the size of the dataset, so it satisfies any minimum threshold; and nothing is more general than it, so it is minimal. Every other solution has it below them in generality, so no other itemset can be minimal.
The condition: the threshold must not exceed the number of transactions, c ≤ |D|. If a question set c above |D| there would be no solutions at all and both borders would be empty. Deck p.20 shows the normal case, G = {{}} at threshold 2, and the transcript states the rule in general.
Exam use: when only a minimum threshold is given, writing G = {{}} is a free half mark. When a maximum threshold is also given, G moves down and has to be computed, which is section 12.
2023 sample theory exam, fill-in 2.2 (1 point), verbatim including the printed typo
In pattern mining, the (1) of the lattice representing the search space are specified by the S-set which contains all (2) and the the G-set which contains all (3) .
Write your three answers before opening this. The paper prints "and the the G-set"; that is a typo on the original exam, not a hint.
(1) borders (equivalently boundaries, or boundary sets). It is the title of deck pp.22 and 23, and it is the word the question is fishing for.
(2) maximal solutions, that is the most specific itemsets that satisfy the frequency thresholds, the ones that cannot be extended with any further item.
(3) minimal solutions, that is the most general itemsets that satisfy the thresholds, the ones from which no item can be deleted.
What earns the marks. The two middle blanks are worth writing in the slides' own words, because "maximal" and "minimal" alone can be read either way by a marker: say maximal solutions, which cannot be extended with extra items and minimal solutions, from which no item can be deleted. Both phrases are printed on pp.22 and 23. Do not write "the most frequent" for G and "the least frequent" for S; frequency is what the thresholds test, generality is what the borders order.
Length. Quote 13 (T9) applies: fill-in questions "can also be short answers that you need to provide", and "the boxes also give an indication of the expected length given a regular written font size". Three short noun phrases fill the three rules on the paper; a paragraph is not wanted.
Why both borders are needed. Because the solution set is convex under these constraints: if g and s are solutions with g ⊆ I ⊆ s, then I is a solution too, since freq(I) ≥ freq(s) ≥ t1 and freq(I) ≤ freq(g) ≤ t2. So S and G do not merely summarise the answer, they determine it exactly.
Three slides say the same thing at rising levels of precision. Page 19: at 100 percent frequency the answer is a version space, with transactions playing the part of positive examples. Page 23, printed under the G-set definition: "Concept-learning = 100% frequency on the positives AND 0% frequency on the negatives". Page 34, in the conclusions: "Also, 100% frequency on positives and 0% on negatives = concept-learning with version spaces."
if you run the algorithm with 100% frequency on the positives and 0% frequency on the negatives, you get the same solution as the ones that are characterized by version spaces.(Lecturer, T12). Note the two conditions joined by AND. One of them alone is not enough, and the exam-shaped version of this statement is the one that drops the second half.
Set the minimum frequency threshold on the positive transactions to 100 percent and the maximum frequency threshold on the negative transactions to 0 percent. Then a pattern is a solution exactly when it covers every positive example and no negative example, which is the definition of consistency in Part 12. The output is the version space, and this Part's S and G are Part 12's S and G.
Relax either threshold and the correspondence breaks. With a minimum frequency of 2 out of 4 you are no longer asking for hypotheses consistent with the data, you are asking for patterns that occur often, and a solution may miss half the transactions. The borders survive the relaxation, which is the useful part: S and G still bound the answer, because frequency constraints keep the solution set convex.
The connection also explains why the search space is drawn the same way in both Parts. The lecturer introduced pattern mining as version spaces with the consistency requirement relaxed into a frequency requirement, and the deck's structure follows that: same lattice, same two borders, different acceptance test.
Constructed, in the sample paper's format (not a past question)
Frequent itemset mining with a minimum frequency threshold of 100 percent on a set of positive transactions produces the same solution set as the Version Spaces algorithm run on those transactions.
False, because half of the condition is missing. Deck p.23 and quote 34 require 100 percent frequency on the positives AND 0 percent frequency on the negatives. With only the first half, nothing forbids a pattern that covers every positive and also covers negatives, and Version Spaces would have thrown that hypothesis out on the first negative example.
Deck p.19 is not a counterexample: there the dataset has no negative transactions at all, so the second condition holds vacuously and the slide can legitimately write "Version space with S = {{s,m}} and G = {{}}". Add one negative transaction and the two answers separate.
Why "True" is tempting: p.19 shows exactly that equality, and it is the slide most people remember. The distinction between "no negatives in the data" and "negatives allowed but required to be uncovered" is the whole content of the item.
Marking arithmetic: +0.5 / -0.25 / 0. An item built by deleting one conjunct from a course statement is the standard trap shape on this paper: MC 1.3 and MC 1.4 of the same 2023 block are built the same way. Read true/false statements looking for the missing half.
Page 25 gives the algorithm in six lines. It is a search from the most general pattern downwards, and it is worth reading with Part 4 in mind: a queue, a pop, a test, a push.
Input: a set of transactions D,
a set of items ℐ,
a frequency treshold c.
Queue = { {} }
for all I ∈ Queue do
if freq(I,D) >= c
then
output I
add all I ∪ {i} to Queue (with i ∈ ℐ - I)
end for
The slide's own justification for starting at the top is printed underneath it: "We start from the top element because the itemsets of interest are typically small. Recall that there can be 100.000s of products in a supermarket." Searching upwards from {s,m,c,b} would begin in the region where every count is zero.
Two details decide whether your trace matches the marking scheme. First, the add step sits inside the then-branch, so an infrequent itemset is never extended. Second, the exercise sheet fixes the queue discipline that the deck leaves open: "New itemsets are added to the front of the queue in alphabetical order." Front insertion makes the structure last in first out, which is why the session 10 solutions rename it and write stack = {{}}, While stack not empty do, Pop I from stack. The resulting walk is depth first, exactly as in Part 4.
The line "add all I ∪ {i} to Queue" is indented under "then". Say what changes if it is moved outside the if, and name the property that makes the inside version safe, that is, guarantees no solution is lost.
Outside the if, the algorithm would refine infrequent itemsets as well, so it would eventually generate all 2n itemsets: correct, and useless. Inside the if, the search stops at the first itemset that fails the threshold.
The licence is anti-monotonicity (p.18): every extension of an infrequent itemset is infrequent, so nothing below a failed node can be a solution and cutting there loses nothing. This one placement is the entire efficiency story of the naive algorithm, and it is the reason section 6 is a prerequisite rather than a curiosity.
Minimum frequency threshold 3, on the four transactions {s,b,c,m}, {s,b,m}, {s,c,m}, {s,m}. Before turning to the next slide, list every solution.
Four solutions: {} at 4, {s} at 4, {m} at 4, {s,m} at 4. Every other itemset has frequency at most 2: bread appears in 2 rows, coffee in 2 rows, and every pair or triple containing one of them inherits that ceiling.
So S = {{s,m}} and G = {{}} at this threshold, the same borders as at threshold 4 in this dataset, which is a coincidence of the data rather than a rule.
The slide colours generated nodes red, circles solutions in blue, and points three arrows at nodes labelled "generated twice". Name those three nodes, and identify the single structural fact about the lattice that causes all three.
{s,m}, {s,m,c} and {s,m,b}.
The cause: in the lattice, {s,m} has two parents, {s} and {m}, and the naive rule adds every one-item extension of every frequent set, so {s,m} is generated once from each. Because it is frequent, it is popped twice and each pop re-pushes both of its children, so {s,m,c} and {s,m,b} are generated twice as well. In general an itemset of size k is generated k times, once per item you could have added last.
The slide's diagnosis is printed on it: "too much redundancy". The lattice is a graph, and the naive algorithm walks every path through it rather than one path per node.
Exercise session 10, question 1.1, verbatim
We would like to find frequent patterns in the buying habits of customers. We investigate the following products: Apples, Bananas, Chocolate and Donuts. We have observed the following purchases.
| Customer 1 | A, B, C |
|---|---|
| Customer 2 | B, D |
| Customer 3 | A, B, D |
| Customer 4 | B, C, D |
Apply the naive algorithm to find the patterns with a frequency ≥ 3. At each step, write down the queue and which itemsets are outputted. Note on the sheet: New itemsets are added to the front of the queue in alphabetical order.
Frequencies you will need: {A} = 2, {B} = 4, {C} = 2, {D} = 3, {A,B} = 2, {B,C} = 2, {B,D} = 3, {C,D} = 1, {A,D} = 1, {A,B,D} = 1, {B,C,D} = 1.
| Pop | freq | Output | Added to the front | Stack after this step | |
|---|---|---|---|---|---|
| 1 | {} | 4 | {} | {A}, {B}, {C}, {D} | {A}, {B}, {C}, {D} |
| 2 | {A} | 2 | none, fails the threshold | {B}, {C}, {D} | |
| 3 | {B} | 4 | {B} | {A,B}, {B,C}, {B,D} | {A,B}, {B,C}, {B,D}, {C}, {D} |
| 4 | {A,B} | 2 | none | {B,C}, {B,D}, {C}, {D} | |
| 5 | {B,C} | 2 | none | {B,D}, {C}, {D} | |
| 6 | {B,D} | 3 | {B,D} | {A,B,D}, {B,C,D} | {A,B,D}, {B,C,D}, {C}, {D} |
| 7 | {A,B,D} | 1 | none | {B,C,D}, {C}, {D} | |
| 8 | {B,C,D} | 1 | none | {C}, {D} | |
| 9 | {C} | 2 | none | {D} | |
| 10 | {D} | 3 | {D} | {A,D}, {B,D}, {C,D} | {A,D}, {B,D}, {C,D} |
| 11 | {A,D} | 1 | none | {B,D}, {C,D} | |
| 12 | {B,D} | 3 | {B,D} again | {A,B,D}, {B,C,D} | {A,B,D}, {B,C,D}, {C,D} |
| 13 | {A,B,D} | 1 | none | {B,C,D}, {C,D} | |
| 14 | {B,C,D} | 1 | none | {C,D} | |
| 15 | {C,D} | 1 | none | empty, stop |
Output sequence: {}, {B}, {B,D}, {D}, {B,D}. Fifteen pops, and {B,D} is output twice because it is reached from {B} and again from {D}. That duplicate is the point of the question: it is what the next section removes.
What earns the marks: the question says "at each step, write down the queue and which itemsets are outputted", so the queue column is the answer, not decoration. Write the frequency you used next to each pop, and mark the pops that fail so the marker can see the pruning. Do not silently deduplicate the output; the naive algorithm really does emit {B,D} twice, and showing that is what motivates part 2 of the question.
The fix for the duplicate problem is one extra condition on the add step. Page 28 states it and page 29 shows the pruned picture.
The left picture is the same lattice after the ordering, the right one is the original. In the left tree, list the children of {m}, of {c} and of {b}. Then count the parents of {s,m,c,b} in each of the two pictures.
Under s > m > c > b, children of {m} are {m,c} and {m,b}; the only child of {c} is {c,b}; and {b} has no children at all, because b is the smallest item and nothing sits below it in the order.
{s,m,c,b} has four parents on the right, {s,m,c}, {s,m,b}, {s,c,b} and {m,c,b}, and one on the left, {s,m,c}, reached by adding b. That is the general recipe for reading the tree: the parent of an itemset is that itemset with its smallest element removed, which is unique, so every node has exactly one.
Reading test for the rule: the number of children of a set shrinks as you go deeper and as you move right along the order. The whole tree has 16 nodes and 15 edges, one per non-root node, which is what "tree instead of a graph" means arithmetically.
Impose the order s > m > c > b
Only add an element to a set I if it is smaller than the smallest element in the set
Every set is only generated once and we get at tree instead of a graph
Why it works: each itemset now has exactly one legal construction, the one that adds its items in descending order, so it has exactly one parent instead of k. The generation graph becomes a tree, and a tree has one path to each node. Nothing is lost, because every itemset still has that one descending construction available.
The check is smaller, not larger. Students write "add all items lexicographically larger than the elements of I" from memory and produce a trace that is internally consistent, complete, and marked wrong, because it is not the algorithm on the sheet. Two ways to keep it straight:
Two more marks are lost on bookkeeping rather than on the rule: new itemsets go to the front of the queue, in alphabetical order, and the queue has to be written at every step because the question asks for it.
The green edge on the slide is the one that is "not generated any more". Say which edge it is and why the rule forbids it. Then count how many pops the naive run of section 10 needed on this dataset at threshold 3, and how many the lexicographic run needs.
The forbidden edge is {m} → {s,m}. Adding s to {m} requires s to be smaller than m, and the imposed order says s > m. So {s,m} is generated only from {s}, by adding m.
Naive: 15 pops. {}, {s}, {s,m}, {s,m,c}, {s,m,b}, {s,c}, {s,b}, {m}, {s,m} again, {s,m,c} again, {s,m,b} again, {m,c}, {m,b}, {c}, {b}.
Lexicographic: 12 pops. The same list with the three repeats gone. The saving is small here because the dataset is tiny; the point is that it is exactly the three nodes the previous slide's arrows marked, and that the saving is multiplicative as the lattice grows.
Both runs output the same four solutions, {}, {s}, {m}, {s,m}, each once in the lexicographic run.
Input: a set of transactions D,
a set of items ℐ,
a frequency treshold c.
Queue = { {} }
for all I ∈ Queue do
if freq(I,D) >= c
then
output I
add all I ∪ {i} to Queue (with i ∈ ℐ - I
and i lexicographically smaller than elements of I)
end for
Cover the pseudocode and write the added condition from memory, then check it. Under the order s > m > c > b, which items may be added to I = {m,c}? And which parent generates {s,m,c}?
The condition is "and i lexicographically smaller than elements of I", meaning smaller than all of them, which is the same as smaller than the smallest.
To {m,c} you may add only b. The smallest element present is c, and b is the only item below it. In particular s cannot be added: it is the largest item in the order.
{s,m,c} has exactly one parent, {s,m}, reached by adding c. It is not generated from {s,c} (m is larger than c) and not from {m,c} (s is larger than everything). One parent per node is the whole point of the check.
Exercise session 10, questions 1.2 and 1.3, verbatim
Find the patterns with a frequency ≥ 3 using the check on the lexicographical order (A < B < C < D). At each step, write down the queue and which itemsets are outputted.
Specify the S and G sets.
| Pop | freq | Output | Added to the front | Stack after this step | |
|---|---|---|---|---|---|
| 1 | {} | 4 | {} | {A}, {B}, {C}, {D} | {A}, {B}, {C}, {D} |
| 2 | {A} | 2 | none, fails the threshold (and nothing is smaller than A anyway) | {B}, {C}, {D} | |
| 3 | {B} | 4 | {B} | {A,B} only | {A,B}, {C}, {D} |
| 4 | {A,B} | 2 | none | {C}, {D} | |
| 5 | {C} | 2 | none | {D} | |
| 6 | {D} | 3 | {D} | {A,D}, {B,D}, {C,D} | {A,D}, {B,D}, {C,D} |
| 7 | {A,D} | 1 | none | {B,D}, {C,D} | |
| 8 | {B,D} | 3 | {B,D} | {A,B,D} only | {A,B,D}, {C,D} |
| 9 | {A,B,D} | 1 | none | {C,D} | |
| 10 | {C,D} | 1 | none | empty, stop |
Output: {}, {B}, {D}, {B,D}. Ten pops instead of fifteen, and no duplicates.
S and G. The solution set is exactly those four itemsets. S = {{B,D}}: it is the only solution that cannot be extended, since {A,B,D} and {B,C,D} both have frequency 1. G = {{}}: only a minimum threshold is given, so the empty itemset is a solution and nothing is more general. The solution slides mark exactly these two nodes on the lattice, G at the top and S at {B,D}.
Where marks are lost: writing children for {A} (there are none under A < B < C < D); adding {B,C} or {B,D} as children of {B} (C and D are larger than B, so they are illegal here even though the naive run generated them); appending new itemsets to the back of the queue, which turns the walk breadth first and changes every line of the table.
The last version of the algorithm adds the second threshold. Page 31 puts it in the pseudocode, and the change is smaller than it looks, but its placement is the examinable part.
Input: a set of pos transactions Pos,
a set of neg transactions Neg,
a set of items ℐ,
frequency treshold t1, t2.
Queue = { {} }
for all I ∈ Queue do
if freq(I,Pos) >= t1 then
if freq(I,Neg) <= t2 then output I
add all I ∪ {i} to Queue (with i ∈ ℐ - I
and i lexicographically smaller than elements of I)
end for
On the slide, add all I ∪ {i} to Queue is at the same indentation as the inner if freq(I,Neg) <= t2 then output I, not inside it. Suppose someone moves the add step inside that inner if, so that only outputs get refined. Run the first pop of the p.32 example (minimum 2, maximum 3) in your head and say exactly what the algorithm returns.
It returns nothing at all, and it stops after one pop. The first itemset is {} with frequency 4. It passes the minimum, fails the maximum (4 > 3), so it is not output, so under the broken version it is not refined either. The queue is now empty and the run ends, having missed all eight solutions.
The reason is worth saying in one line, because it is the marked point: the path to every solution here runs through itemsets that are themselves too frequent. {s,m,c} is only reachable as {} then {s} then {s,m} then {s,m,c}, and the first three all have frequency 4.
So the two tests do two different jobs. The minimum test gates the refinement, because it is anti-monotone and failing it kills the whole region below. The maximum test gates only the output, because failing it says nothing about what lies below.
The minimum test gates both output and refinement. If freq(I, Pos) < t1, nothing below I can pass either, so the branch dies. That is anti-monotonicity again.
The maximum test gates output only. An itemset that is too frequent must still be refined, because its extensions are less frequent and may well fall under the ceiling. Pruning on the maximum test would delete solutions. Deck p.32 shows this happening: {} at frequency 4 and {s} at frequency 4 are both rejected for output with a maximum of 3, and both are refined, and solutions are found beneath them.
Consequence for the borders: a maximum threshold is exactly what moves G off {{}}. With a minimum only, G is always {{}} (section 8). With a maximum as well, the minimal solutions sit wherever the frequency has first dropped to the ceiling.
Two wordings to watch. The deck writes freq(I,Neg) <= t2, the session 10 solutions write freq(I,D2) < t2, and the session 10 assignment asks for patterns with "a frequency < 3 in the control group". They are not the same boundary. Copy the inequality from the question you are answering, and write it at the top of your trace so the marker can see which one you used.
Minimum 2, maximum 3, on the same four transactions. Take the first two pops, {} and {s}. For each one say: is it output, and is it refined? Give the frequency you used.
{}: frequency 4. It passes the minimum (4 ≥ 2) so it is refined, pushing {s}, {m}, {c}, {b}. It fails the maximum (4 > 3) so it is not output.
{s}: frequency 4. Same verdict, refined into {s,m}, {s,c}, {s,b}, not output.
This is the asymmetry in action on the first two lines of the trace. A trace that stops at {} because "the empty set is not a solution" loses every mark in the question.
Count the circled nodes on the final slide and name them. Then give S and G, and explain why {s,m} is not circled even though it lies between {s} and the circled {s,m,c}.
Eight circled nodes: {c}, {b}, {s,c}, {s,b}, {m,c}, {m,b}, {s,m,c}, {s,m,b}. All have frequency 2, comfortably inside the window [2, 3].
S = {{s,m,c}, {s,m,b}} and G = {{b}, {c}}, which is what p.21 announced before the algorithm was run.
{s,m} is not a solution because its frequency is 4, above the maximum of 3. There is no contradiction with convexity: convexity says that anything between two solutions is a solution, and {s} is not a solution either (frequency 4). The interval that matters runs from {c} up to {s,m,c}, and every itemset on it, {c}, {s,c}, {m,c}, {s,m,c}, is circled.
Exercise session 10, question 2, verbatim
We have two colonies of bacteria: a treated group and a control group. We would like to discover frequent patterns of mutations (labeled M0 to M4) that happen in the treated group, but that do not happen frequently in the control group. We have the following data:
| Control group | Treatment group |
|---|---|
| M0, M1, M2 M0, M2, M3 M0, M2 M1, M2, M3 | M0, M2 M0, M1, M2 M2, M3, M4 M0, M2, M4 |
Apply the algorithms to find the patterns with a frequency < 3 in the control group and frequency ≥ 2 in the treatment group. Use the check on the lexicographical order (M0 < M1 < M2 < M3 < M4). At each step, write down the queue and which itemsets are outputted. Write down the S and G sets.
Two tests per pop: refine when freq(I, Treatment) ≥ 2, output when in addition freq(I, Control) < 3. Below, fT is the treatment count and fC the control count.
| Pop | fT | fC | Output | Added to the front | Stack after this step | |
|---|---|---|---|---|---|---|
| 1 | {} | 4 | 4 | no, fC not < 3 | {M0}, {M1}, {M2}, {M3}, {M4} | {M0}, {M1}, {M2}, {M3}, {M4} |
| 2 | {M0} | 3 | 3 | no, fC not < 3 | none, nothing is smaller than M0 | {M1}, {M2}, {M3}, {M4} |
| 3 | {M1} | 1 | no | none, fT below 2, branch dies | {M2}, {M3}, {M4} | |
| 4 | {M2} | 4 | 4 | no | {M0,M2}, {M1,M2} | {M0,M2}, {M1,M2}, {M3}, {M4} |
| 5 | {M0,M2} | 3 | 3 | no | none | {M1,M2}, {M3}, {M4} |
| 6 | {M1,M2} | 1 | no | none | {M3}, {M4} | |
| 7 | {M3} | 1 | no | none | {M4} | |
| 8 | {M4} | 2 | 0 | {M4} | {M0,M4}, {M1,M4}, {M2,M4}, {M3,M4} | {M0,M4}, {M1,M4}, {M2,M4}, {M3,M4} |
| 9 | {M0,M4} | 1 | no | none | {M1,M4}, {M2,M4}, {M3,M4} | |
| 10 | {M1,M4} | 0 | no | none | {M2,M4}, {M3,M4} | |
| 11 | {M2,M4} | 2 | 0 | {M2,M4} | {M0,M2,M4}, {M1,M2,M4} | {M0,M2,M4}, {M1,M2,M4}, {M3,M4} |
| 12 | {M0,M2,M4} | 1 | no | none | {M1,M2,M4}, {M3,M4} | |
| 13 | {M1,M2,M4} | 0 | no | none | {M3,M4} | |
| 14 | {M3,M4} | 1 | no | none | empty, stop |
Output: {M4} and {M2,M4}. An exhaustive check over all 32 itemsets confirms these are the only two that satisfy both constraints, so nothing was pruned away wrongly.
S = {{M2,M4}}, the only maximal solution: its extensions {M0,M2,M4} and {M1,M2,M4} have treatment frequency 1 and 0. G = {{M4}}, the only minimal solution: deleting M4 from it gives {}, whose control frequency is 4, not below 3.
Reading of the result: M4 never occurs in the control group at all, and occurs twice under treatment. That is the drug-design shape from deck p.9, a pattern present in the active group and absent from the clean one.
Where marks are lost. Pruning on the control-group test: {} and {M2} both fail it, and both must still be refined, otherwise you never reach {M4} or {M2,M4} at all. Checking the control count for a set that already failed the treatment count is harmless but wasted. And note that {M3} dies at step 7 while {M3,M4} is still generated later, at step 8, as a child of {M4}: under the lexicographic order the parent of {M3,M4} is {M4}, not {M3}.
Constructed, in the sample paper's format (not a past question)
If a frequent itemset mining problem specifies only a minimum frequency threshold, and that threshold is not larger than the number of transactions, then the G-set of the solution consists of the empty itemset.
True. The empty itemset covers every transaction, so its frequency equals the number of transactions, so it satisfies any minimum threshold up to that size. Nothing is more general than it, so it is a minimal solution, and since every other solution contains it, no other itemset can be minimal. G = {{}}. Deck p.20 shows this concretely at threshold 2.
Why "False" is tempting: because it feels wrong that the answer should contain the pattern that says nothing. It is nevertheless a solution under a pure minimum-frequency constraint, and the G-set is about generality, not usefulness. What makes G interesting is a maximum threshold: on deck p.21 the maximum of 3 pushes G down to {{b},{c}}.
Trap sibling to expect: the same sentence with "S-set" substituted for "G-set" is False, since S is the maximal solutions and depends entirely on the data.
Marking arithmetic: +0.5 / -0.25 / 0.
Deck p.10 lists "sets / strings / graphs" as the data types pattern mining works on, and the third exercise of session 10 takes the algorithm across to strings. The generality relation changes from subset to substring: the sheet gives nut ⊂ donut and dot ⊄ donut, the second because a substring has to be contiguous.
The itemset algorithm cannot be carried over unchanged, because a string is a sequence: ar and ra are different patterns, and there is no single "smallest element" to compare a new letter against. What survives is the principle, and the sheet's hint says which one: "A string can't occur more than any of its substrings". That is anti-monotonicity in the substring order.
queue = { ε }
output = { ε }
While queue not empty do
Pop I from queue
for all i ∈ alphabet where substring(I+i, 1) ∈ output do
if freq(I+i, D) ≥ t do
output = output ∪ (I+i)
queue = append (I+i) to back of queue
Two annotations on the solution slide: the guard "checks if the tail of the extended string is minimally frequent", and "Only need to check this one!" Extension happens on the right, and the queue is appended to at the back, so this walk is breadth first by string length, unlike the itemset stack.
Why only the tail needs checking: the string I+i has exactly two substrings of its own length minus one, the head I and the tail. The head is already known to be frequent, because it came off the queue, which only ever holds frequent strings. So the tail is the one new thing to verify, and verifying it before counting saves the count.
Exercise session 10, question 3, verbatim (marked "Optional" on the sheet)
We can also mine patterns in strings using the substring relation (e.g. nut ⊂ donut and dot ⊄ donut). Note how this is different from the itemsets used before.
Single letters first. a = 7, c = 3, e = 7, h = 2, l = 3, p = 2, r = 8, s = 2. With the threshold at 3 the frequent letters are a, c, e, l, r; h, p and s die immediately and can never come back, since any string containing them is at most as frequent.
| Pop | Extensions tested and their counts | Kept | Queue after this step | |
|---|---|---|---|---|
| 1 | ε | a 7, c 3, e 7, h 2, l 3, p 2, r 8, s 2 | a, c, e, l, r | a, c, e, l, r |
| 2 | a | aa 0, ac 0, ae 0, al 0, ar 7 | ar | c, e, l, r, ar |
| 3 | c | ca 2, cc 0, ce 0, cl 0, cr 0 | none | e, l, r, ar |
| 4 | e | ea 3, ec 0, ee 1, el 0, er 0 | ea | l, r, ar, ea |
| 5 | l | la 0, lc 0, le 1, ll 0, lr 0 | none | r, ar, ea |
| 6 | r | ra 0, rc 0, re 2, rl 3, rr 0 | rl | ar, ea, rl |
| 7 | ar | only tails in output are worth testing: arl 3 | arl | ea, rl, arl |
| 8 | ea | ear 3 | ear | rl, arl, ear |
| 9 | rl | no letter gives a tail of length 2 that is in output | none | arl, ear |
| 10 | arl | no candidate tail of length 3 in output | none | ear |
| 11 | ear | earl 1 | none | empty, stop |
Output: { ε, a, c, e, l, r, ar, ea, rl, arl, ear }.
S and G with the minimum only. S = { c, arl, ear }, G = { ε }. Each element of S is maximal: c cannot be grown in either direction (ca = 2, ch = 2, ac = 0, rc = 0), and arl and ear both have their only extension, earl, at frequency 1. G is the empty string for the same reason the empty itemset was the whole G-set in section 8.
With the extra ceiling freq ≤ 7. S is unchanged, S = { c, arl, ear }, because those three sit at frequency 3 and were never near the ceiling. G changes to { a, c, e, l }: the empty string (8) and r (8) are now too frequent to be solutions, so the minimal survivors move down to the four letters at 7, 3, 7 and 3.
What earns the marks. Part 1 wants the algorithm, and the mark is for the tail check plus the reason (a string is never more frequent than any of its substrings, so an infrequent tail kills the extension). Part 2 wants the counts written down; part 4 is the payoff, since it shows that a maximum threshold moves G and leaves S alone, which is the same lesson as deck p.21.
The conclusions slide p.34 makes the general claim: "Minimum and maximum frequency are just one type of constraints", followed by the arrow "Pattern mining = search". The fourth exercise of session 10 asks what happens when a different kind of constraint arrives, and the answer separates the constraints that can be pushed into the pruning test from the ones that cannot.
A constraint can be checked inside the loop, next to the frequency test, exactly when it is anti-monotone: once a set violates it, every extension of that set violates it too. Then failing the test is a safe reason to stop refining.
If the constraint is not anti-monotone, checking it inside the loop destroys completeness, because a set that fails it may sit on the only path to a set that satisfies it.
Exercise session 10, question 4, verbatim
Imagine that we have additional constraints on the patterns.
Must always appear together: not anti-monotone, so pre-process instead. The solutions list three options and reject the middle one. Option A1, filter the frequent patterns afterwards, is correct but wasteful. Option A2, test the constraint next to the frequency test, "results in a loss of completeness", and the solution slide gives the counterexample in its own notation: evaluating patterns [A,B], [A,C], [B,C] you would never generate [A,B,C]. The reason is that {A} on its own violates "A and B always together", yet {A} is on the path to {A,B}, which satisfies it.
The promising option is pre-processing: "If A and B are not meaningful separately, they shouldn't be separate in the set of possible items". Define ℐ' as all minimal subsets of ℐ that do not violate the constraints. The slide's example: if ℐ = {a,b,c,d} and a and b must always appear together, then ℐ' = { {a,b}, {c}, {d} }. Then define an ordering over ℐ' so the lexicographic check still works, and run the unchanged algorithm over the compound items:
Queue = {{}}
While queue not empty do
Pop I from queue
If freq(I,D1) >= t1
Then
If freq(I,D2) < t2 then output I
Push I ∪ i in Queue (for all i ∈ ℐ', i ⊄ I and i < I)
Must not appear together: anti-monotone, so push it into the loop. The solutions reason by analogy with the substring exercise: "The subset of a set that satisfies our membership restriction will also satisfy it", equivalently "A set that contains items that should not appear together can not be extended into a set that satisfies that constraint". Adding items can only add violations, never remove them. So the constraint has the same shape as the frequency test and can be checked in the same place:
Queue = {{}}
A set of anti-monotonic constraints C
While queue not empty do
Pop I from queue
If I satisfies all constraints in C and freq(I,D1) >= t1
Then
If freq(I,D2) < t2 then output I
Add all I ∪ {i} to Queue (with i ∈ ℐ - I and i
lexicographically smaller than elements of I)
What earns the marks: not the pseudocode but the classification. Say which of the two constraints is anti-monotone, prove it in one line (adding items preserves the violation), and say what goes wrong for the other one (a violating set lies on the only path to a satisfying set, so pruning there loses solutions). Then give the repair that fits: tight integration for the anti-monotone one, a redefinition of the item set for the other.
Both courses use the words itemset, frequent, anti-monotonicity and prune. They mean different algorithms, different arithmetic and different deliverables. This table is the discrimination.
| FAI, 18 August (this Part) | Machine Learning, 20 August | |
|---|---|---|
| Algorithm | Depth-first enumeration from {} with a queue worked last in first out, extending only with items lexicographically smaller than all current elements | Level-wise candidate generation: all candidates of size L, count, prune, then self-join pairs sharing the first L-1 items |
| Frequency | Absolute counts. "frequency ≥ 3" means three transactions | Relative support, a percentage of the transactions |
| Rules | Named once on p.7, never computed, never asked | Confidence is a definition you compute and a rule is a deliverable |
| Borders | Core. S = maximal solutions, G = minimal solutions, and "specify the S and G sets" appears in three of the four session 10 exercises | Not used |
| Deliverable | "At each step, write down the queue and which itemsets are outputted", then S and G | The frequent itemsets, where you pruned and why, and a rule |
The one-line test. If your FAI answer starts dividing counts by the number of transactions, or computes a ratio between two frequencies, or self-joins two itemsets of equal size, you have started answering the 20 August paper. On 18 August the queue is the answer.
Constructed discrimination item (pack). Not a past question
An FAI exercise-exam question gives four customer baskets over the items A, B, C, D and asks for the frequent patterns with a frequency of at least 3, then for the S and G sets. Which answer shape is the one this course marks?
B. The session 10 sheet asks in so many words to "write down the queue and which itemsets are outputted" at each step, and then to "Specify the S and G sets". The queue column and the counts are where the marks are.
Why A is wrong here: that is the level-wise, self-joining, percentage-based procedure of the Machine Learning course. It is a correct algorithm for finding frequent itemsets and it answers a question nobody asked on 18 August, so it collects no marks for the trace and none for the borders.
Why C is wrong: confidence does not occur anywhere in the FAI deck or in session 10. Deck p.7 shows one ratio, in passing, as motivation.
Why D is wrong: not wrong in content, but incomplete. A circled lattice is the right way to present S and G, and it is how deck p.33 and the solution slides finish, but it skips the trace that the question explicitly asks for. Draw the lattice in addition to the table, not instead of it.
| Term | Precise definition | Plain paraphrase | Exam phrasing |
|---|---|---|---|
| Item, item set ℐ | An item is one boolean attribute, for instance one product. ℐ is the set of all possible items. Every transaction and every pattern is a subset of it (p.8). | The shop's catalogue. | "a set of possible items I = {i1 ... in}" (session 10 sheet) |
| Transaction | One row of the data, written as the set of items that are True in it. Read under a closed world: the items it does not list are asserted false (p.14). | One shopping basket. | "a dataset of transactions T where each transaction is an itemset" (session 10 sheet) |
| Pattern (= hypothesis) | An itemset used as a conjunction of positive tests only. {i1,...,ik} denotes i1 ∧ ... ∧ ik and says nothing about the other items (pp.8, 14). |
A shopping habit you are testing for, phrased only as "at least these". | "hypothesis = pattern" (p.8); "A possible itemset {Salami, Bread}" (p.11) |
| Covers | h covers e if and only if h ⊆ e. Equivalently, a pattern covers exactly its supersets (pp.8, 14). |
The basket contains everything the pattern asks for. | "I covers t ⇔ I ⊆ t" (session 10 sheet) |
| More general than | h1 is more general than h2 if and only if h1 ⊆ h2. Fewer items means more general; the empty itemset is the most general pattern (p.8). |
Asks for less, so matches more. | "h1 is more general than h2 if and only if h1 ⊆ h2" (p.8) |
| Frequency, absolute and relative | freq(I, D) is the number of transactions in D covered by I. The relative frequency is that number divided by |D|, shown as a percentage on pp.5 to 7. FAI exercises use the absolute form throughout. | How many baskets contain the whole pattern. | "freq({salami, milk}, D) = 4" (p.13); "the patterns with a frequency ≥ 3" (session 10) |
| Minimum frequency threshold | The lower bound c or t1. A pattern is kept only if freq(I, D) ≥ c. Because frequency is anti-monotone, failing it also prunes everything below (pp.25, 30). | Ignore anything too rare to matter. | "min freq threshold = 3?" (p.29); "freq(I, D) ≥ c" (p.25) |
| Maximum frequency threshold | The upper bound t2, tested on a second dataset or on the same one. It gates the output only, never the refinement, because "too frequent" is not inherited downwards (pp.21, 31). | Ignore anything so common it says nothing, but keep looking below it. | "max freq threshold = 3?" (p.32); "frequency < 3 in the control group" (session 10 question 2) |
| Anti-monotonicity | If I1 ⊆ I2 then freq(I1, D) ≥ freq(I2, D) (p.18). Contrapositive: every extension of an infrequent itemset is infrequent, so the region below it can be discarded uncounted. |
Adding an item can only lose baskets. | "The anti-monotonicity property in itemset mining implies that if itemset I2 is a superset of itemset I1, then the frequency of I1 will be higher-or-equal than the frequency of I2." (2023 theory MC 1.5, answer True) |
| The lattice | All 2n itemsets ordered by the subset relation, drawn with {} at the top and ℐ at the bottom. It is both the pattern space and the transaction space, which is the single representation trick (pp.16, 17). | The map the search walks, general at the top. | "the lattice representing the search space" (2023 theory fill-in 2.2) |
| The borders | The pair (S, G) that delimits the solution set in the lattice. They determine it exactly, because the solution set is convex: anything between two solutions is a solution (pp.22, 23). | The top edge and the bottom edge of the answer region. | "In pattern mining, the ______ of the lattice representing the search space are specified by the S-set ... and the the G-set ..." (2023 theory fill-in 2.2, answer borders) |
| S-set | All solutions that satisfy the thresholds and have no strictly more specific solution, that is, no superset of them is a solution (p.22). | The maximal solutions: cannot be extended with extra items. | "S contains all maximal solutions, i.e., solutions that cannot be extended with extra items" (p.22); "Specify the S and G sets" (session 10) |
| G-set | All solutions that satisfy the thresholds and have no strictly more general solution, that is, no subset of them is a solution (p.23). With a minimum threshold only, G = {{}}. | The minimal solutions: no item can be deleted. | "G contains all minimal solutions, i.e., solutions from which no item can be deleted" (p.23) |
| Single representation trick | Data and patterns share one notation. A transaction itemset means its items and the negation of all the others; a pattern itemset means only its own items (p.14). | Same brackets, two readings; the subset sign tells you which. | "one representation is used for both the patterns and the data ... which can be a bit confusing sometimes but it holds several advantages" (Lecturer, T12) |
| Lexicographic check | Fix a total order on the items; extend an itemset only with an item smaller than all its current elements (pp.28, 30). Each itemset then has one parent, so the generation graph is a tree and nothing is generated twice. | Only ever add letters that come earlier in the declared order. | "Only add an element to a set I if it is smaller than the smallest element in the set" (p.28); "using the check on the lexicographical order (A < B < C < D)" (session 10) |
| Association rule | IF X THEN Y with a probability P, obtained from two frequencies of the frequent-pattern step (p.7). Named on pp.7 and 34 of this deck, computed once, never asked in session 10. | A frequent pattern rewritten as a prediction. | "Turn the frequent patterns into association rules" (p.7). The word "confidence" does not occur in this deck; see section 15 before writing one on 18 August. |
Constructed, in the sample paper's fill-in format (not a past question)
Answer in one term. During frequent itemset mining, the algorithm stops extending an itemset as soon as that itemset falls below the minimum frequency threshold. Name the property of frequency that makes this pruning safe, and state it as an inequality.
Anti-monotonicity, stated as: if I1 ⊆ I2 then freq(I1, D) ≥ freq(I2, D).
What earns the mark: the name plus the inequality with the subset direction written the right way round. A one-line justification, that a superset covers a subset of the transactions covered by its subset, converts a recalled term into a demonstrated one and costs half a line. The fill-in box on the real paper is about that size (quote 13, T9: the boxes indicate the expected length).
Do not answer "monotonicity". The property is that the constraint "freq ≥ c" is inherited upwards in the lattice and lost downwards, which is why the course calls it anti-monotone.
Chapter index: index.html · Previous: Part 12, Version Spaces · Next: Part 14, The AI Debate · Drill: viz-patternmining.html · Search by question: question-index.html