0
supportData = {('nas','fat'): 0.5, ('nas'): 1.0, ('fat'):0.6, ('van'):0.72,
         ('jos'):0.55,('van','jos'):0.10}

L = [('nas','fat'),('van','jos')]

for freqSet in L:
H = [''.join(list(i)) for i in freqSet]

prunedH = [] #create new list to return
for conseq in H:
    freqsetlist = list(freqSet)
    freqsetlist.remove(conseq)

    conf = supportData[freqSet]/supportData[tuple(freqsetlist)[0]]
    if conf >= 0.5:
          print freqsetlist,'-->',conseq,'conf:',conf

When I run the code I only get:

['fat'] --> nas conf: 0.833333333333

['nas'] --> fat conf: 0.5

It seems the inner loop doesn't iterate and calculate the confidence for the second tuple in L i.e Inline Code Example Here ('Van','jos')

Edited by pyTony: Text moved out or code snippet

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by Schol-R-LEA
0

You may want to edit the code a bit; the indentation is off.

I was able to reproduce the results described, but without knowing what it means, or what it was supposed to come out with, I can't tell you why it isn't giving the desired results.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.