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')