Question: This question is for frequent pattern mining algorithm Apriori and closed pattern mining algorithm like CLOSET. Implement Apriori algorithm to mine frequent pattern from a

This question is for frequent pattern mining algorithm Apriori and closed pattern mining algorithm like CLOSET.

Implement Apriori algorithm to mine frequent pattern from a transaction dataset

Implement an algorithm to mine closed frequent pattern from the same dataset. You can either write a code to extract closed patterns from the result that you got in Part 1 or code CLOSET.

Input Format

The input dataset is a transaction dataset.

The first line of the input corresponds to the minimum support.

Each following line of the input corresponds to one transaction. Items in each transaction are seperated by a space.

Please refer to the sample input below. In sample input 0, the minimum support is 2, and the dataset contains 3 transactions and 5 item types (A, B, C, D and E).

Constraints

NA

Output Format

The output are the frequent patterns you mined out from the input dataset.

Each line in the output should be of the format :

Support [frequent pattern]

Frequent patterns should be listed in a descending order based on support. e.g. 3 [C] is listed before 2 [A].

Ties should be resolved based on lexicographical order. e.g. 2 [A] is listed before 2 [A C]

Items within each pattern should be listed in lexicographical order as well seperated by a single space. e.g. 2 [B C D]

First print the frequent patterns and then closed pattern. Seperate the output for two parts by an empty line. In sample output 0, first 9 lines correspond to frequent patterns and last 3 lines correspond to closed pattern.

Sample Input 0

2 B A C E D A C C B D 

Sample Output 0

3 [C] 2 [A] 2 [A C] 2 [B] 2 [B C] 2 [B C D] 2 [B D] 2 [C D] 2 [D] 3 [C] 2 [A C] 2 [B C D] 

Sample Input 1

2 data mining frequent pattern mining mining frequent patterns from the transaction dataset closed and maximal pattern mining 

Sample Output 1

4 [mining] 2 [frequent] 2 [frequent mining] 2 [mining pattern] 2 [pattern] 4 [mining] 2 [frequent mining] 2 [mining pattern]

Note: The solution is expected in python 3.

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!