source: orange/orange/doc/ofb/assoc2.py @ 6538:a5f65d7f0b2c

Revision 6538:a5f65d7f0b2c, 880 bytes checked in by Mitar <Mitar@…>, 4 years ago (diff)

Made XPM version of the icon 32x32.

Line 
1# Description: Association rule sorting and filtering
2# Category:    description
3# Uses:        imports-85
4# Classes:     orngAssoc.build, Preprocessor_discretize, EquiNDiscretization
5# Referenced:  assoc.htm
6
7import orange, orngAssoc
8
9data = orange.ExampleTable("imports-85")
10data = orange.Preprocessor_discretize(data, \
11  method=orange.EquiNDiscretization(numberOfIntervals=3))
12data = data.select(range(10))
13
14rules = orange.AssociationRulesInducer(data, support = 0.4)
15
16n = 5
17print "%i most confident rules:" % (n)
18orngAssoc.sort(rules, ["confidence"])
19orngAssoc.printRules(rules[0:n], ['confidence','support','lift'])
20
21conf = 0.8; lift = 1.1
22print "\nRules with confidence>%5.3f and lift>%5.3f" % (conf, lift)
23rulesC=rules.filter(lambda x: x.confidence>conf and x.lift>lift)
24orngAssoc.sort(rulesC, ['confidence'])
25orngAssoc.printRules(rulesC, ['confidence','support','lift'])
Note: See TracBrowser for help on using the repository browser.