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

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

Moved orange to Orange (part 2)

Line 
1# Author:      B Zupan
2# Version:     1.0
3# Description: Same as fss5.py but uses FilterRelieff class from orngFSS
4# Category:    preprocessing
5# Uses:        adult_saple.tab
6# Referenced:  o_fss.htm
7
8import orange, orngFSS
9data = orange.ExampleTable("../datasets/adult_sample")
10
11def report_relevance(data):
12  m = orngFSS.attMeasure(data)
13  for i in m:
14    print "%5.3f %s" % (i[1], i[0])
15
16print "Before feature subset selection (%d attributes):" % len(data.domain.attributes)
17report_relevance(data)
18data = orange.ExampleTable("../datasets/adult_sample")
19
20marg = 0.01
21filter = orngFSS.FilterRelief(margin=marg)
22ndata = filter(data)
23print "\nAfter feature subset selection with margin %5.3f (%d attributes):" % (marg, len(ndata.domain.attributes))
24report_relevance(ndata)
Note: See TracBrowser for help on using the repository browser.