Orange Forum • View topic - How to apply Entropy-based Discretization on new data

How to apply Entropy-based Discretization on new data

A place to ask questions about methods in Orange and how they are used and other general support.

How to apply Entropy-based Discretization on new data

Postby michael.hecht » Sat Feb 06, 2010 17:42

Hello,

it is not clear to me, how to apply Entropy-based Discretization on new data if e.g. a BayesLearner was trained on discretized data an shall now be applied on new continuous examples which were not part of the original discretization.

RTFM

Postby michael.hecht » Sat Feb 06, 2010 18:24

Ok, I read the manual (by chance I came just along the right chapter). For others, here is the code:
Code: Select all

import orange
data = orange.ExampleTable("iris")

#split the data to learn and test set
ind = orange.MakeRandomIndices2(data, p0=6)
learn = data.select(ind, 0)
test = data.select(ind, 1)

# discretize learning set, then use its new domain
# to discretize the test set
learnD = orange.Preprocessor_discretize(data, method=orange.EntropyDiscretization())
testD = orange.ExampleTable(learnD.domain, test)

print "Test set, original:"
for i in range(3):
    print test[i]

print "Test set, discretized:"
for i in range(3):
    print testD[i]



Return to Questions & Support