WGU D599 Task 3: Market Basket Analysis | Complete Report, Apriori Algorithm,
Python Code & Association Rules | 2026/2027 Updated
Actual Q&A – A+ Guarantee Format | Includes Drawings/Diagrams Where Needed – Apriori Workflow 8 Steps Transaction
to Frequent Itemsets to Association Rules Support Confidence Lift, Support Confidence Lift Formulas Transaction Table 10
Transactions Bread Butter Milk Formula Venn Bread Butter Intersection 3 Support 0.3 Confidence 0.6 Lift 1.2, Market
Basket Example | Python Code mlxtend apriori association_rules min_support min_confidence lift>1
1. For D599 Task 3, what is market basket analysis? Refer to market basket
example diagram below.
Figure 1: MARKET diagram – refer to this drawing for question 1
A) Market basket analysis discovers association rules between items frequently
purchased together, e.g., if customer buys bread and butter, how likely buys milk,
uses transaction data to find frequent itemsets and generate rules with support
confidence lift
B) No market basket analysis needed
C) Market basket same as no analysis
D) Market basket deletes transactions
Answer: A
Rationale: Option A correct market basket definition frequent itemsets
association rules as shown. Option B wrong analysis useful for retail strategy
,recommendation. Option C wrong analysis discovers patterns vs no analysis.
Option D wrong analyzes transactions not deletes.
2. What is Apriori algorithm workflow? Refer to Apriori algorithm workflow diagram
below.
Figure 2: APRIORI diagram – refer to this drawing for question 2
A) Apriori workflow: Step1 Transaction Dataset {Bread Milk Eggs} {Bread Milk}
{Bread Butter} {Milk Eggs}, Step2 Find Frequent 1-itemsets with min support
Support=Count/Total >= min_support, Step3 Generate Candidate 2-itemsets
combine frequent 1-itemsets self-join, Step5 Repeat until no more frequent
itemsets generate k-itemsets from k-1, Step6 Generate Association Rules A->B
from frequent itemsets where A and B non-empty subsets A union B frequent,
Step7 Calculate Support Confidence Lift formulas, Step8 Filter by min confidence
and lift>1, Final Output Actionable Rules for retail strategy, Loop k=k+1 back to
Step3, Key Insight Lift>1 positive correlation Lift=1 independent Lift<1 negative
B) No Apriori workflow needed
C) Apriori same as no algorithm
D) Apriori deletes transactions
Answer: A
Rationale: Option A correct 8-step workflow as diagram shows Transaction ->
Frequent 1-itemsets -> Candidate 2-itemsets -> Repeat k-itemsets -> Generate
,Rules -> Calculate Support Confidence Lift -> Filter min confidence lift>1 ->
Final Actionable Rules. Option B wrong Apriori standard algorithm for
association rules. Option C wrong Apriori algorithm vs no algorithm opposite.
Option D wrong discovers patterns not deletes.
3. What are support, confidence, lift formulas? Refer to Support Confidence Lift
diagram below.
Figure 3: SUPPORT diagram – refer to this drawing for question 3
A) Support (A&B) = P(A and B) = Number transactions where A&B together / Total
transactions measures how common itemset overall, Confidence (A->B) = P(B|A)
= Support(A,B)/Support(A) probability B bought when A bought measures rule
reliability, Lift (A->B) = Confidence / Support(B) = P(B|A)/P(B) how much more
likely B when A present vs overall, as shown Transaction Table 10 transactions
example Rule Bread->Butter Support 0.3 =3/10 30% transactions both
Bread&Butter, Confidence 0.6=0.3/0.5 60% Bread purchases also Butter, Lift
1.2=0.6/0.5 1.2x more likely than baseline, Venn Diagram Bread 5 transactions
Butter 5 intersection 3, Interpretation Lift=1.2>1 positive association 20% more
likely
B) No support confidence lift needed
C) Support same as confidence always
D) Lift cannot be calculated
, Answer: A
Rationale: Option A correct formulas and worked example as diagram shows
Support 0.3 Confidence 0.6 Lift 1.2 Venn Bread 5 Butter 5 intersection 3
interpretation positive. Option B wrong metrics essential to evaluate rules.
Option C wrong support measures overall commonality, confidence conditional
probability. Option D wrong lift calculable via confidence/support(B).
4. What is Python code for market basket analysis using mlxtend?
A) Python code: from mlxtend.frequent_patterns import apriori, association_rules;
frequent_itemsets = apriori(onehot_df, min_support=0.1, use_colnames=True);
rules = association_rules(frequent_itemsets, metric='confidence',
min_threshold=0.5); rules = rules[rules['lift']>1]; sorts by support confidence lift
descending to get actionable rules
B) No Python code needed
C) Python code same as no code
D) Python code deletes data
Answer: A
Rationale: Option A correct mlxtend code apriori association_rules min_support
confidence lift>1 sorting. Option B wrong code needed for Task 3. Option C
wrong code implements algorithm vs no code no implementation. Option D
wrong generates rules not deletes.
5. What is one-hot encoding for market basket analysis?
A) One-hot encoding transforms transaction list into binary matrix rows
transactions columns items values True/False or 1/0 if item present, required input
for apriori function, e.g., TransactionEncoder or pd.get_dummies
B) No one-hot encoding needed
C) One-hot same as no encoding
D) One-hot deletes items
Answer: A
Rationale: Option A correct one-hot encoding definition and purpose for apriori
input. Option B wrong encoding required for apriori. Option C wrong encoding
transforms list to matrix vs no encoding list. Option D wrong encoding
represents presence not deletes.
Python Code & Association Rules | 2026/2027 Updated
Actual Q&A – A+ Guarantee Format | Includes Drawings/Diagrams Where Needed – Apriori Workflow 8 Steps Transaction
to Frequent Itemsets to Association Rules Support Confidence Lift, Support Confidence Lift Formulas Transaction Table 10
Transactions Bread Butter Milk Formula Venn Bread Butter Intersection 3 Support 0.3 Confidence 0.6 Lift 1.2, Market
Basket Example | Python Code mlxtend apriori association_rules min_support min_confidence lift>1
1. For D599 Task 3, what is market basket analysis? Refer to market basket
example diagram below.
Figure 1: MARKET diagram – refer to this drawing for question 1
A) Market basket analysis discovers association rules between items frequently
purchased together, e.g., if customer buys bread and butter, how likely buys milk,
uses transaction data to find frequent itemsets and generate rules with support
confidence lift
B) No market basket analysis needed
C) Market basket same as no analysis
D) Market basket deletes transactions
Answer: A
Rationale: Option A correct market basket definition frequent itemsets
association rules as shown. Option B wrong analysis useful for retail strategy
,recommendation. Option C wrong analysis discovers patterns vs no analysis.
Option D wrong analyzes transactions not deletes.
2. What is Apriori algorithm workflow? Refer to Apriori algorithm workflow diagram
below.
Figure 2: APRIORI diagram – refer to this drawing for question 2
A) Apriori workflow: Step1 Transaction Dataset {Bread Milk Eggs} {Bread Milk}
{Bread Butter} {Milk Eggs}, Step2 Find Frequent 1-itemsets with min support
Support=Count/Total >= min_support, Step3 Generate Candidate 2-itemsets
combine frequent 1-itemsets self-join, Step5 Repeat until no more frequent
itemsets generate k-itemsets from k-1, Step6 Generate Association Rules A->B
from frequent itemsets where A and B non-empty subsets A union B frequent,
Step7 Calculate Support Confidence Lift formulas, Step8 Filter by min confidence
and lift>1, Final Output Actionable Rules for retail strategy, Loop k=k+1 back to
Step3, Key Insight Lift>1 positive correlation Lift=1 independent Lift<1 negative
B) No Apriori workflow needed
C) Apriori same as no algorithm
D) Apriori deletes transactions
Answer: A
Rationale: Option A correct 8-step workflow as diagram shows Transaction ->
Frequent 1-itemsets -> Candidate 2-itemsets -> Repeat k-itemsets -> Generate
,Rules -> Calculate Support Confidence Lift -> Filter min confidence lift>1 ->
Final Actionable Rules. Option B wrong Apriori standard algorithm for
association rules. Option C wrong Apriori algorithm vs no algorithm opposite.
Option D wrong discovers patterns not deletes.
3. What are support, confidence, lift formulas? Refer to Support Confidence Lift
diagram below.
Figure 3: SUPPORT diagram – refer to this drawing for question 3
A) Support (A&B) = P(A and B) = Number transactions where A&B together / Total
transactions measures how common itemset overall, Confidence (A->B) = P(B|A)
= Support(A,B)/Support(A) probability B bought when A bought measures rule
reliability, Lift (A->B) = Confidence / Support(B) = P(B|A)/P(B) how much more
likely B when A present vs overall, as shown Transaction Table 10 transactions
example Rule Bread->Butter Support 0.3 =3/10 30% transactions both
Bread&Butter, Confidence 0.6=0.3/0.5 60% Bread purchases also Butter, Lift
1.2=0.6/0.5 1.2x more likely than baseline, Venn Diagram Bread 5 transactions
Butter 5 intersection 3, Interpretation Lift=1.2>1 positive association 20% more
likely
B) No support confidence lift needed
C) Support same as confidence always
D) Lift cannot be calculated
, Answer: A
Rationale: Option A correct formulas and worked example as diagram shows
Support 0.3 Confidence 0.6 Lift 1.2 Venn Bread 5 Butter 5 intersection 3
interpretation positive. Option B wrong metrics essential to evaluate rules.
Option C wrong support measures overall commonality, confidence conditional
probability. Option D wrong lift calculable via confidence/support(B).
4. What is Python code for market basket analysis using mlxtend?
A) Python code: from mlxtend.frequent_patterns import apriori, association_rules;
frequent_itemsets = apriori(onehot_df, min_support=0.1, use_colnames=True);
rules = association_rules(frequent_itemsets, metric='confidence',
min_threshold=0.5); rules = rules[rules['lift']>1]; sorts by support confidence lift
descending to get actionable rules
B) No Python code needed
C) Python code same as no code
D) Python code deletes data
Answer: A
Rationale: Option A correct mlxtend code apriori association_rules min_support
confidence lift>1 sorting. Option B wrong code needed for Task 3. Option C
wrong code implements algorithm vs no code no implementation. Option D
wrong generates rules not deletes.
5. What is one-hot encoding for market basket analysis?
A) One-hot encoding transforms transaction list into binary matrix rows
transactions columns items values True/False or 1/0 if item present, required input
for apriori function, e.g., TransactionEncoder or pd.get_dummies
B) No one-hot encoding needed
C) One-hot same as no encoding
D) One-hot deletes items
Answer: A
Rationale: Option A correct one-hot encoding definition and purpose for apriori
input. Option B wrong encoding required for apriori. Option C wrong encoding
transforms list to matrix vs no encoding list. Option D wrong encoding
represents presence not deletes.