source: orange/docs/reference/rst/code/classifier-from-var-example.py @ 10361:2c8d6b739b3d

Revision 10361:2c8d6b739b3d, 658 bytes checked in by Lan Zagar <lan.zagar@…>, 2 years ago (diff)

Corrected some links in classfromvar documentation. But a lot of it should be rewritten.

Line 
1import Orange
2
3monks = Orange.data.Table("monks-1")
4e = monks.domain["e"]
5e1 = Orange.feature.Discrete("e1", values = ["1", "not 1"])
6
7def eTransformer(value):
8    if int(value) == 0:
9        return 0
10    else:
11        return 1
12
13e1.get_value_from = Orange.classification.ClassifierFromVar()
14e1.get_value_from.whichVar = e
15e1.get_value_from.transformer = eTransformer
16
17monks2 = monks.select(["a", "b", "e", e1, "y"])
18for i in monks2:
19    print i
20
21e1.get_value_from = Orange.classification.ClassifierFromVarFD()
22e1.get_value_from.domain = monks.domain
23e1.get_value_from.position = monks.domain.attributes.index(e)
24e1.get_value_from.transformer = eTransformer
25
Note: See TracBrowser for help on using the repository browser.