A simple example of Association Rule Mining based on http://orange.biolab.si/docs/latest/reference/rst/Orange.associate.html


In [ ]:
import Orange #pip install orange
data = Orange.data.Table("market-basket.basket")

In [ ]:
for d in data:
    print d

In [ ]:
rules = Orange.associate.AssociationRulesSparseInducer(data, support=0.3)
print "%4s %4s  %s" % ("Supp", "Conf", "Rule")
for r in rules[:5]:
    print "%4.1f %4.1f  %s" % (r.support, r.confidence, r)

Spanish Inquisition example


In [ ]:
data = Orange.data.Table("inquisition.basket")

In [ ]:
for d in data:
    print d

In [ ]:
rules = Orange.associate.AssociationRulesSparseInducer(data, support = 0.5)

print "%5s   %5s" % ("supp", "conf")
for r in rules:
    print "%5.3f   %5.3f   %s" % (r.support, r.confidence, r)