source: orange/Orange/testing/regression/tests_20/reference_transformvalue-o2c.py @ 9952:986e9cd806f4

Revision 9952:986e9cd806f4, 810 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Tests moved and renamed from orange 20.

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.