예제 #1
0
        private ConditionalFPTree CreateConditionalFPTree(uint item, IFPTree fpTree)
        {
            ConditionalFPTree cTree = new ConditionalFPTree(item, fpTree.Itemset.Items);

            foreach (FPTreePrefixPathItem pathItem in fpTree.GetItemPrefixPath(item))
            {
                cTree.Support += pathItem.FPTreeNode.Support;
                cTree.AddTransaction(pathItem.FPTreeNode.ParentNode, pathItem.FPTreeNode.Support);
            }

            // cTree.RemoveInfrequentItems(_options.MinSupport);

            return(cTree);
        }
예제 #2
0
        private void MinePatternsFromFpTreeRecursive(IFPTree fpTree)
        {
            foreach (var item in fpTree.Items.OrderByDescending(item => item))
            {
                ConditionalFPTree cTree = CreateConditionalFPTree(item, fpTree);

                if (cTree.Support >= _options.MinSupport)
                {
                    _frequentItemset.Add(cTree.Itemset);

                    // Recursion
                    MinePatternsFromFpTreeRecursive(cTree);
                }
            }
        }