source: orange/orange/doc/reference/transformvalue-o2c.py @ 822:80bf64dfc34a

Revision 822:80bf64dfc34a, 810 bytes checked in by janezd <janez.demsar@…>, 10 years ago (diff)

* empty log message *

Line 
1# Description: Shows how to use value transformers
2# Category:    preprocessing
3# Classes:     TransformValue, Continuous2Discrete, Discrete2Continuous, MapIntValue
4# Uses:       
5# Referenced:
6
7import orange
8
9data = orange.ExampleTable("lenses")
10
11age = data.domain["age"]
12
13age_c = orange.FloatVariable("age_c")
14age_c.getValueFrom = orange.ClassifierFromVar(whichVar = age)
15age_c.getValueFrom.transformer = orange.Ordinal2Continuous()
16
17age_cn = orange.FloatVariable("age_cn")
18age_cn.getValueFrom = orange.ClassifierFromVar(whichVar = age)
19age_cn.getValueFrom.transformer = orange.Ordinal2Continuous()
20age_cn.getValueFrom.transformer.factor = 0.5
21
22newDomain = orange.Domain([age, age_c, age_cn], data.domain.classVar)
23newData = orange.ExampleTable(newDomain, data)
24for ex in newData:
25    print ex
26print "\n\n"
Note: See TracBrowser for help on using the repository browser.