简体   繁体   English

FP-Growth 算法中的递归

[英]Recursion in FP-Growth Algorithm

I am trying to implement FP-Growth (frequent pattern mining) algorithm in Java.我正在尝试在 Java 中实现 FP-Growth(频繁模式挖掘)算法。 I have built the tree, but have difficulties with conditional FP tree construction;我已经构建了树,但是在条件 FP 树构建时遇到了困难; I do not understand what recursive function should do.我不明白递归 function 应该做什么。 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?给定一个频繁项列表(按频率计数递增的顺序) - header 和一个树(节点 class 实例列表)function 应该采取哪些步骤? 从 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?树中的 alpha 和 Betha 节点是什么,生成和构造函数有什么作用? I can do FP-Growth by hand, but find the implementation extremely confusing.我可以手动进行 FP-Growth,但发现实现非常混乱。 If that could help, I can share my code for FP-Tree generation.如果这有帮助,我可以分享我的 FP-Tree 生成代码。 Thanks in advance.提前致谢。

  1. alpha is the prefix that lead to this specific prefix tree alpha 是通向此特定前缀树的前缀
  2. beta is the new prefix (of the tree to be constructed) beta 是(要构建的树的)新前缀
  3. the generate line means something like: add to result set the pattern beta with support anItem.support生成行的含义类似于:将模式 beta 添加到结果集,支持 anItem.support
  4. the construct function creates the new patterns from which the new tree is created构造 function 创建新模式,从中创建新树

an example of the construct function (bottom up way) would be something like:构造 function (自下而上)的示例如下:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM