Skip to content

Is it a error in generateRules? #15

@brisksea

Description

@brisksea

In chapter 11

def generateRules(L, supportData, minConf=0.7):  #supportData is a dict coming from scanD
    bigRuleList = []
    for i in range(1, len(L)):#only get the sets with two or more items
        for freqSet in L[i]:
            H1 = [frozenset([item]) for item in freqSet]
            if (i > 1):
                rulesFromConseq(freqSet, H1, supportData, bigRuleList, minConf)
            else:
                calcConf(freqSet, H1, supportData, bigRuleList, minConf)
    return bigRuleList

When the frequent set is like {1,2,3}, it can't generate the rules like {1,2}->3.
Shoule the snippet

            if (i > 1):
                rulesFromConseq(freqSet, H1, supportData, bigRuleList, minConf)
            else:
                calcConf(freqSet, H1, supportData, bigRuleList, minConf)

change to

            rulesFromConseq(freqSet, H1, supportData, bigRuleList, minConf)
            if (i > 1):
                calcConf(freqSet, H1, supportData, bigRuleList, minConf)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions