This commit is contained in:
jiangzhonglian
2017-03-03 17:35:40 +08:00
7 changed files with 78 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
def loadDataSet():
return [[1,3,4],[2,3,5],[1,2,3,5],[2,5]]
def createC1(dataSet):
c1=[]
for transaction in dataSet:
for item in transaction:
if not [item] in c1:
c1.append([item])
c1.sort()
return map(frozenset,c1)
def scanD(D,ck,minSupport):
ssCnt = {}

View File

@@ -0,0 +1,19 @@
class treeNode:
def __init__(self,nameValue,numOccur,parentNode):
self.name = nameValue
self.count = numOccur
self.nodeLink = None
self.parent = parentNode
self.children = {}
def inc(self,numOccur):
self.count += numOccur
def disp(self,ind=1):
print(' '*ind,self.name,' ',self.count)
for child in self.children.values():
child.disp(ind+1)
if __name__ == "__main__":
import fpGrowth
rootNode = fpGrowth.treeNode('pyramid',9,None)
rootNode.children['eye']=fpGrowth.treeNode('eye',13,None)
rootNode.disp()

View File

@@ -0,0 +1,5 @@
class Test:
if __name__ == "__main__":
fza=frozenset(['a','bc'])
adict={fza:1,'b':2}
print(adict)