Question: FP- Growth Implementation def item_support(dataset, min_support): A helper function that returns the support count of each item in the dataset. The dictionary is further sorted

FP- Growth Implementation

FP- Growth Implementation def item_support(dataset, min_support): A helper function that returns the

def item_support(dataset, min_support): A helper function that returns the support count of each item in the dataset. The dictionary is further sorted based on maximum support of each item and pruned based on min_support. Input: 1. dataset - A python dictionary containing the transactions. 2. items - A python list representing all the items that are part of all the transactions. 3. min_support - A floating point variable representing the min_support value for the set of transactions. Output: 1. support_dict - A dictionary representing the support count of each item in the dataset. len_transactions = len (dataset) support_dict = dict() for key, value in dataset.items(): # your code here in Python sorted_support = dict(sorted (support_dict.items(), key=lambda item: item[1], reverse=True)) pruned_support = {key:val for key, val in sorted_support.items() if val/len_transactions >= min_support} return support_dict

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!