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

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

Made XPM version of the icon 32x32.

Line 
1# Description: Entropy based discretization compared to discretization with equal-frequency
2#              of instances in intervals
3# Category:    preprocessing
4# Uses:        iris.tab
5# Classes:     Preprocessor_discretize, EntropyDiscretization
6# Referenced:  o_categorization.htm
7
8import orange
9
10def show_values(data, heading):
11    print heading
12    for a in data.domain.attributes:
13        print "%s: %s" % (a.name, reduce(lambda x,y: x+', '+y, [i for i in a.values]))
14       
15data = orange.ExampleTable("iris")
16
17data_ent = orange.Preprocessor_discretize(data, method=orange.EntropyDiscretization())
18show_values(data_ent, "Entropy based discretization")
19print
20
21data_n = orange.Preprocessor_discretize(data, method=orange.EquiNDiscretization(numberOfIntervals=3))
22show_values(data_n, "Equal-frequency intervals")
Note: See TracBrowser for help on using the repository browser.