source: orange/orange/doc/ofb/disc7.py @ 2679:40bdbcf2d284

Revision 2679:40bdbcf2d284, 770 bytes checked in by blaz <blaz.zupan@…>, 8 years ago (diff)

included in o_categorization.htm

Line 
1# Description: Discretize the test set based on discretization of the training set.
2# Category:    preprocessing
3# Uses:        iris
4# Classes:     Preprocessor_discretize, EntropyDiscretization
5# Referenced:  o_categorization.htm
6
7import orange
8data = orange.ExampleTable("iris")
9
10#split the data to learn and test set
11ind = orange.MakeRandomIndices2(data, p0=6)
12learn = data.select(ind, 0)
13test = data.select(ind, 1)
14
15# discretize learning set, then use its new domain
16# to discretize the test set
17learnD = orange.Preprocessor_discretize(data, method=orange.EntropyDiscretization())
18testD = orange.ExampleTable(learnD.domain, test)
19
20print "Test set, original:"
21for i in range(3):
22    print test[i]
23
24print "Test set, discretized:"
25for i in range(3):
26    print testD[i]
Note: See TracBrowser for help on using the repository browser.