source: orange/docs/tutorial/rst/code/disc5.py @ 9374:59bac7ddd8a2

Revision 9374:59bac7ddd8a2, 747 bytes checked in by mitar, 2 years ago (diff)

Tutorial documentation structure.

Line 
1# Description: Shows how to round-off the cut-off points used for categorization.
2# Category:    preprocessing
3# Uses:        iris
4# Classes:     EquiNDiscretization, EntropyDiscretization
5# Referenced:  o_categorization.htm
6
7import orange
8iris = orange.ExampleTable("iris")
9
10equiN = orange.EquiNDiscretization(numberOfIntervals=4)
11entropy = orange.EntropyDiscretization()
12
13pl = equiN("petal length", iris)
14sl = equiN("sepal length", iris)
15sl_ent = entropy("sepal length", iris)
16
17points = pl.getValueFrom.transformer.points
18points2 = map(lambda x:round(x), points)
19pl.getValueFrom.transformer.points = points2
20
21for attribute in [pl, sl, sl_ent]:
22  print "Cut-off points for", attribute.name, \
23    "are", attribute.getValueFrom.transformer.points
Note: See TracBrowser for help on using the repository browser.