Question: My transction.csv file look like please use this dataset and write python code Quantity,Transaction,Store,Product 1.0,12359.0,2.0,Candy Bar 2.0,12362.0,9.0,Pain Reliever 2.0,12362.0,9.0,Pain Reliever 1.0,12365.0,5.0,Toothpaste 2.0,12371.0,2.0,Bow 1.0,12380.0,6.0,Greeting Cards 3.0,12383.0,1.0,Pain
My transction.csv file look like please use this dataset and write python code
| Quantity,Transaction,Store,Product | |||
| 1.0,12359.0,2.0,Candy Bar | |||
| 2.0,12362.0,9.0,Pain Reliever | |||
| 2.0,12362.0,9.0,Pain Reliever | |||
| 1.0,12365.0,5.0,Toothpaste | |||
| 2.0,12371.0,2.0,Bow | |||
| 1.0,12380.0,6.0,Greeting Cards | |||
| 3.0,12383.0,1.0,Pain Reliever | |||
| 3.0,12383.0,1.0,Pain Reliever | |||
| 1.0,12386.0,7.0,Pain Reliever | |||
| 2.0,12386.0,7.0,Pain Reliever | |||
| 1.0,12392.0,7.0,Shampoo | |||
| 1.0,12392.0,7.0,Magazine | |||
| 1.0,12401.0,6.0,Candy Bar | |||
| 1.0,12401.0,6.0,Candy Bar | |||
| 1.0,12401.0,6.0,Pencils | |||
| 1.0,12401.0,6.0,Magazine | |||
| 1.0,12404.0,2.0,Candy Bar | |||
| 2.0,12410.0,2.0,Pens | |||
| 1.0,12413.0,10.0,Magazine | |||
| 1.0,12470.0,4.0,Candy Bar | |||
| 1.0,12473.0,7.0,Shampoo | |||
| 1.0,12476.0,2.0,Shampoo | |||
| 1.0,12482.0,2.0,Toothpaste | |||
| 8.0,12563.0,1.0,Deodorant | |||
| 2.0,12563.0,1.0,Deodorant | |||
| 1.0,12563.0,1.0,Deodorant | |||
| 8.0,12563.0,1.0,Deodorant | |||
| 8.0,12563.0,1.0,Deodorant | |||
| 1.0,12572.0,6.0,Candy Bar | |||
| 1.0,12572.0,6.0,Candy Bar | |||
| 1.0,12572.0,6.0,Greeting Cards | |||
| 1.0,12572.0,6.0,Greeting Cards |
Part I: Association Rules Use the mlxtend.frequent_patterns module to analyze association rules. Setup Instructions 1. Use the provided transactions dataset (Only the two variables Transaction and Product should be used). 2. Install required libraries: Task Instructions 1. Load the dataset and perform one-hot encoding. 2. Generate frequent itemsets using the Apriori algorithm (min_support = 0.05). 3. Generate association rules with min_threshold = 0.6.
Basic Understanding 1. Top Support Rules: Which two rules have the highest support? What are their confidence values?
2. Maximum Lift: What is the maximum lift observed? Which rule has this lift value? Interpret what this rule implies.
3. Rule 10: What are the antecedents and consequents of Rule 10? Interpret this rule clearly.
4. write the code for a rule matrix using a heatmap where: o Rows = LHS (antecedents) o Columns = RHS (consequents) o Values = lift
From this heatmap: o What is the most common right-hand item in the rules? o What are the left-hand items from the second row of the heatmap?
Advanced and Analytical Questions 5. Redundant Rules: Use rule pruning techniques to remove redundant rules (rules where a more general rule has equal or higher confidence). List 3 redundant rules that you removed, and explain why.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
