Question: FP Tree def build_fp_tree (updated_dataset): Input: 1. updated_dataset - A python dictionary containing the updated set of transactions based on the pruned support Output: 1.
FP Tree

def build_fp_tree (updated_dataset): Input: 1. updated_dataset - A python dictionary containing the updated set of transactions based on the pruned support Output: 1. fp_tree - A dictionary representing the fp_tree. Each node should have a count and children attribute. HINT: 1. Loop over each transaction in the dataset and make an update to the fp_tree dictionary. 2. For each loop iteration store a pointer to the previously visited node and update it's children in the next 3. Update the root pointer when you start processing items in each transaction. 4. Reset the root pointer for each transaction. Sample Tree Output: {'Y': {'count': 3, 'children': {'V': {'count': 1, 'children': {}}}}, 'X': {'count': 2, 'children': {'R': {'count': 1, 'children': {'F': {'count': 1, 'children': {}}}}}}} fp_tree = dict() for key, value in updated_dataset.items(): # your code here in Python return fp_tree
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
