ML | Frequent pattern growth algorithm


The above data is a hypothetical dataset of transactions, each letter which the element represents. The frequency of each individual element is calculated:

Let the minimum support be 3. Built a set of frequent patterns, which will contain all elements whose frequency is greater than or equal to the minimum support. These elements are stored in descending order of their respective frequencies. After inserting the appropriate elements, the set L looks like this:

L = {K: 5, E: 4, M: 3, O: 3, Y: 3}

A corresponding set of ordered items is now generated for each transaction. This is done by iterating over a set of frequent patterns and checking if the current item is contained in the transaction in question. If the current item is contained, it is inserted into the Ordered Item set for the current transaction. The following table is built for all transactions:

Now all sets of ordered elements are inserted into the structure data Trie.

a) Inserting the set {K, E, M, O, Y}:

All elements here simply linked one by one in the order they appear in the set and initialize the backing counter for each item as 1.

b) Inserting the set {K, E, O, Y}:

Before inserting the elements K and E, the backing counter is simply incremented by 1. When we we see that there is no direct connection between E and O, so the new node for the O element is initialized using the backing counter. as 1 and element E is associated with this new node. By inserting Y, we first initialize a new node for element Y with a backing count of 1 and bind the new node O to the new node Y.

c) Inserting the set {K, E, M}:

Here simply the amount of support for each element is increased by 1. >

d) Insert set {K, M, Y}:

As in step b), the backing counter K is incremented first, then new nodes for M and Y are initialized and linked.