Notebook 2: Association Rule Mining Flashcards
Iterable
an object that can be interated over (like in a for loop)
ex: lists, tuples, sets, strings, dictionaries, ranges
-needs to implement __iter__()
-You can pass an iterable to functions like list(), tuple(), and for loops because they can be converted to an iterator.
iterator
An object used to perform the actual iteration.
-Implements both __iter__() (returns itself) and __next__() (returns the next value in the sequence or raises StopIteration when done).
-Iterators are stateful, meaning they remember their current position in the sequence.
-it’s a one time thing, need a new iterator once exhasted
default dictionary
-requires a factory function to add a key when it does not exist (could be built in type like into or list, custom function)
-available from collections.defaultdict
-Python’s built-in dictionaries, you always to have to check whether a key exists before updating it
itertools.permutations(iterable, r=None)
returns all possible ordered arrangements of r elements from the iterable
itertools.combinations(iterable, r)
Generates all possible unordered combinations of r elements from the iterable.
association rule mining - confidence formula
confidence a -> b = support(A U B) / support (A)
association rule mining - support
Support is how often an item (or itemset) shows up in the data
frequency or prevalence of an itemset (or items) in the dataset
association rule mining - itemset
individual items in itemset
association rule mining - pair count
items in the itemset that appear together
dictionary comprehension formatting
{key_expression: value_expression for item in iterable if condition}
range
range(start, stop, step)
XOR or exlusive or
**
exponentiation