发现在前天转载的Apriori algorithem中存在一点小的瑕疵,特更正如下。
# Apriori algorithem
def Apriori(filename,supct):
#get source data from file
srcdata=getsrcdata(filename)
# get C1
c=getC1(srcdata)
# L
L={}
LR={}
while True:
# temp L,if empty,over
# while not,this is the new L
temp_L=getL(c,supct)
if not temp_L:
break
else:
L=temp_L
for item in temp_L.keys():
LR[item]=temp_L[item] ###修改之处
# get the next candidate from pre L
c=getnextcandi(L,srcdata)
return LR