liveBook · Manning

Confidence

As explained in Data Without Labels

Confidence is the conditional proportion of transactions containing the consequent among those containing the antecedent of an association rule.

In market basket analysis, confidence answers a practical question: among transactions containing a rule’s antecedent, what proportion also contain its consequent? For a rule P → Q, confidence is the count of transactions containing both P and Q divided by the count containing P. It helps shortlist rules that may be useful for decisions such as product placement. section 4.3.1 section 4.11

Table 4.2 Dataset to understand the concept of support, confidence, lift, and conviction
Invoice Number
Milk
Eggs
Bread
Cheese
1001
1
1
1
0
1002
0
1
1
1
1003
1
1
1
0
1004
0
1
0
1
1005
0
1
1
0

Use the five-invoice table to count transactions containing an antecedent, then count how many of those also contain its consequent. section 4.3.1

Calculate confidence from invoices

For {milk, eggs} → {bread}, both invoices containing milk and eggs also contain bread: confidence is 2/2, or 100%. For {bread, eggs} → {cheese}, only one of four invoices containing bread and eggs also contains cheese: confidence is 1/4, or 25%. The first rule is more reliable among matching baskets, but occurs in only two of the five invoices; check support as well. section 4.3.1

In Python, pass transactions as a list of lists to `apyori.apriori` and set `min_confidence` alongside support, lift, and rule-length thresholds. Inspect the resulting rules rather than treating confidence alone as a verdict. If no rules qualify, revisit the thresholds: in the store-data example, lowering support alone still yields none, while lowering lift to 2 yields 200. section 4.4.1

How Data Without Labels covers it

How deep it goes
Defines confidence through transaction counts and demonstrates threshold tuning in Apriori; does not develop statistical uncertainty.
Examples
Uses five grocery invoices for rule calculations and a Python store dataset for filtering and inspecting generated rules.
What it assumes
Assumes transactions can be identified and introduces antecedents, consequents, and rule metrics without requiring advanced mathematics.
What you can do after
Apply it via apyori to filter candidate rules, then interpret confidence alongside support and lift.
How it connects
Links confidence to association rules, antecedents, consequents, support, lift, conviction, and Apriori.

Also explained in

Compare how 2 books explain confidence →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Without Labels. The section links point to the parts of the book it draws on.