source: orange/docs/reference/rst/code/transformvalue-nc.py @ 9924:69d0ac45ad93

Revision 9924:69d0ac45ad93, 644 bytes checked in by janezd <janez.demsar@…>, 2 years ago (diff)

Added documentation on TransformValue

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.Continous(attr.name+"_n")
9    attr_c.getValueFrom = Orange.core.ClassifierFromVar(whichVar = attr)
10    transformer = Orange.core.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.