https stackoverflow com questions 58385765 recursion-in-fp-growth-algorithm

0 votes

I am trying to implement FP-Growth (frequent pattern mining) algorithm in Java. I have built the tree, but have difficulties with conditional FP tree construction; I do not understand what recursive function should do. Given a list of frequent items (in increasing order of frequency counts) - a header, and a tree (list of Node class instances) what steps should the function take? image retrieved from https://www.google.com/url?sa=i&source=images&cd=&cad=rja&uact=8&ved=2ahUKEwiT4Oeeg53lAhWPhOAKHUdSAmkQjRx6BAgBEAQ&url=https%3A%2F%2Fwww.researchgate.net%2Ffigure%2FPseudocode-FP-tree-Purba-30_fig2_330783065&psig=AOvVaw3fyRRKroFZwnASsE-vuMZy&ust=1571186297476542

I have hard time understanding this pseudocode above. Are alpha and Betha nodes in the Tree, and what do generate and construct functions do? I can do FP-Growth by hand, but find the implementation extremely confusing. If that could help, I can share my code for FP-Tree generation. Thanks in advance.

Apr 4, 2022 in Machine Learning by Dev
• 6,000 points
779 views

1 answer to this question.

0 votes

The create line indicates something like: alpha is the prefix that leads to this specific prefix tree
 beta is the new prefix (of the tree to be constructed) 
add to result is what the generate line means. support anItem by setting the pattern beta.
The construct function generates new patterns from which a new tree can be generated.

An example of the construct function (from the bottom up) might be:

function construct(Tree, anItem)   
    conditional_pattern_base = empty list
    in Tree find all nodes with tag = anItem
    for each node found:
       support = node.support
       conditional_pattern = empty list
       while node.parent != root_node
            conditional_pattern.append(node.parent)
            node = node.parent
       conditional_pattern_base.append( (conditional_pattern, support))
    return conditional_pattern_base
answered Apr 4, 2022 by Nandini
• 5,480 points

Related Questions In Machine Learning

0 votes
1 answer

What is greedy approach in Decision tree algorithm?

“Greedy Approach is based on the concept ...READ MORE

answered May 13, 2019 in Machine Learning by Upadhya
14,889 views
0 votes
1 answer
0 votes
1 answer

Classification in Naive Bayes algorithm

Hi@Ogun, The Numpy module doesn't have a predict attribute. ...READ MORE

answered Oct 5, 2020 in Machine Learning by MD
• 95,460 points
1,330 views
0 votes
1 answer

Persisting data in sklearn

If you want to find some fixed ...READ MORE

answered Jul 10, 2019 in Python by SDeb
• 13,300 points
780 views
0 votes
1 answer
0 votes
1 answer

What is the difference between linear regression and logistic regression?

Hi Dev, to answer your question Linear Regression ...READ MORE

answered Feb 2, 2022 in Machine Learning by Nandini
• 5,480 points
1,183 views
0 votes
1 answer

Hierarchical clustering of 1 million objects

Consider switching the algorithm instead of using ...READ MORE

answered Feb 24, 2022 in Machine Learning by Nandini
• 5,480 points
527 views
0 votes
1 answer
0 votes
1 answer

What is inductive bias in machine learning?

Inductive bias can be understood as an ...READ MORE

answered Feb 10, 2022 in Machine Learning by Nandini
• 5,480 points
3,601 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP