January 2019
Intermediate to advanced
294 pages
6h 43m
English
In order to perform validation we will import the library and build the transactions as shown here:
import pyfpgrowth
We build our transactions like so:
transaction = [["bread", "butter", "cereal"], ["butter", "milk"], ["bread", "milk"], ["butter", "cereal", "milk"], ["egg", "bread"], ["egg", "butter"], ["cereal", "milk"], ["bread", "butter", "cereal", "egg"], ["cereal", "bread", "butter"]]
Minimum support is defined now to find the pattern. find_frequent_patterns(), where transactions are the list of items bought at each transaction, and 2 is the minimum threshold set for support count:
patterns = pyfpgrowth.find_frequent_patterns(transaction, 2)
Finally, we have to define the confidence to get the rules. Rules are ...
Read now
Unlock full access