source: orange/Orange/doc/ofb/disc.py @ 9671:a7b056375472

Revision 9671:a7b056375472, 818 bytes checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

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.