# FPGrowth is an algorithm for discovering frequent itemsets in a transaction database. It was proposed by Han et al. (2000). FPGrowth is a very fast and memory efficient algorithm. It uses a special internal structure called an FP-Tree. 

from ca.pfv.spmf.algorithms.frequentpatterns.fpgrowth import AlgoFPGrowth;


# create input data
data="""1 3 4 
2 3 5
1 2 3 5
2 5
1 2 3 5
"""
file = open("data.txt", "w")
file.write(data)
file.close()

# use 0.4: means a minsup of 2 transaction (we used a relative support)
out="output.txt"
alg=AlgoFPGrowth()
alg.runAlgorithm("data.txt",out,0.4) 
# alg.printStats()

print "result="
print open(out).read()
