Python Assignment

Home Work 3 – Part B

You will be using a retail store transaction dataset of 5000 transactions for this part. Execute the following commands to read it in a format digestible to the algorithm

Set working directory.


#convert it into a data matrix


#remove the transaction_ID column i.e., column 1


#use logical function to convert binary to T/F


#Now coerce it into a matrix


Use “basket” data with support=0.03, confidence=0.7 and minlen = 2 to extract association rules and save the results to “grules”. How many rules do you have? Which items are most likely to be bought together? (1 Point)

What if you change the minimum support to 0.04? Save the results as “grules2” (1 Point)

Draw a scatterplot with data “basket”. Set support = 0.03 (1 Point)

Draw a scatterplot with data “basket” to show top 20 items (1 Point)

Show the first three rules from “grules”

Sort “grules” by lift and show top 5 association rules

Find subsets of rules containing any “Hot.Coffee” items and save the results to “coffee”

Show top 10 rules in “coffee” subset


Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)