source: orange/docs/reference/rst/code/transformvalue-nc.py @ 10012:4ba1aa91419d

Revision 10012:4ba1aa91419d, 651 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Fixed tests.

Line 
1import Orange
2
3data = Orange.data.Table("iris")
4
5domstat = Orange.statistics.basic.Domain(data)
6newattrs = []
7for attr in data.domain.features:
8    attr_c = Orange.feature.Continuous(attr.name + "_n")
9    attr_c.getValueFrom = Orange.core.ClassifierFromVar(whichVar=attr)
10    transformer = Orange.data.utils.NormalizeContinuous()
11    attr_c.getValueFrom.transformer = transformer
12    transformer.average = domstat[attr].avg
13    transformer.span = domstat[attr].dev
14    newattrs.append(attr_c)
15
16newDomain = Orange.data.Domain(newattrs, data.domain.classVar)
17newData = Orange.data.Table(newDomain, data)
18for ex in newData[:5]:
19    print ex
20print "\n\n"
Note: See TracBrowser for help on using the repository browser.