Search code examples
python-3.xorange

Orange Data Mining version 3.3 (Python) Association Rules


Orange Data Mining version 2.7 (Python) has the following example for Association Rules:

import Orange
data = Orange.data.Table("market-basket.basket")

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)

However this does not work in Orange Data Mining version 3.3. How can I do this example in version 3.3?

help(Orange) was also not very helpful.

I get:

AttributeError: 'module' object has no attribute 'associate'

on:

rules = Orange.associate.AssociationRulesSparseInducer(data, support=0.3)

Alternatively, when using the Association Rules widget in Oracle Canvas I'm not sure what widget can be used to display the output of the Association Rules widget.


Solution

  • With Orange 3, the association rules had been moved into an add-on: https://pypi.python.org/pypi/Orange3-Associate

    Documentation: https://orange3-associate.readthedocs.io/en/latest/scripting.html

    It is used a bit differently and is in my experience much, much faster.