Orange Forum • View topic - How-to discretize data for use by orngFSS

How-to discretize data for use by orngFSS

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

How-to discretize data for use by orngFSS

Postby dimitrs » Wed Sep 16, 2009 7:52

Hi,

What would be the correct way to discretize data for use by orngFSS ? I tried the following but it gave me an error (see below)

c45 = orange.C45Learner(name="C4.5")

discretizedData = orange.Preprocessor_discretize(data, method=orange.EquiNDiscretization(numberOfIntervals=6))

gainRatio = orange.MeasureAttribute_gainRatio()
ma_gr = orngFSS.attMeasure(discretizedData, gainRatio)

fss = orngFSS.FilterBestNAtts(ma_gr, n=10) <---------- error

fc45 = orngFSS.FilteredLearner(c45, filter=fss, name='c45 & fss')

learners = [c45, fc45]
results = orngTest.crossValidation(learners, data, folds=10, storeClassifiers=1)


fss = orngFSS.FilterBestNAtts(ma_gr, n=10)
File "/usr/lib64/python2.6/site-packages/orange/orngFSS.py", line 105, in FilterBestNAtts
if data: return filter(data)
File "/usr/lib64/python2.6/site-packages/orange/orngFSS.py", line 113, in __call__
ma = attMeasure(data, self.measure)
File "/usr/lib64/python2.6/site-packages/orange/orngFSS.py", line 15, in attMeasure
for i in data.domain.attributes:
AttributeError: 'list' object has no attribute 'domain'

BR,
Dimitti

Postby Guest » Wed Sep 16, 2009 9:17

This seems to work:

discretizedData = orange.Preprocessor_discretize(data, method=orange.EquiNDiscretization(numberOfIntervals=6))

# Attr selection criteria
gainRatio = orange.MeasureAttribute_gainRatio()
#info_gain = orange.MeasureAttribute_info()
#relief = orange.MeasureAttribute_relief(k=20, m=50)

#fss = orngFSS.FilterAttsAboveThresh(threshold=0.05)
fss = orngFSS.FilterBestNAtts(measure=gainRatio, n=10)

# Learners
c45 = orange.C45Learner(name="C4.5")
discC45 = orngDisc.DiscretizedLearner(c45, name='disc c45')
fc45 = orngFSS.FilteredLearner(discC45, filter=fss, name='c45 & fss')

learners = [discC45, fc45]

# Run it ...
folds=10
results = orngTest.crossValidation(learners, discretizedData, folds=folds, storeClassifiers=1)


Return to Questions & Support



cron