# source:orange/Orange/testing/regression/tests_20/reference_ClassifierByExampleTable.py@9952:986e9cd806f4

Revision 9952:986e9cd806f4, 992 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 construct an orange.ClassifierFromExampleTable
2# Category:    classification, lookup classifiers, constructive induction, feature construction
3# Classes:     ClassifierByExampleTable, LookupLearner
4# Uses:        monk1
5# Referenced:  lookup.htm
6
7import orange
8
9data = orange.ExampleTable("monk1")
10a, b, e = data.domain["a"], data.domain["b"], data.domain["e"]
11
12data_s = data.select([a, b, e, data.domain.classVar])
13abe = orange.LookupLearner(data_s)
14
15print len(data_s)
16print len(abe.sortedExamples)
17
18for i in abe.sortedExamples[:10]:
19    print i
20print
21
22for i in abe.sortedExamples[:10]:
23    print i, i.getclass().svalue
24print
25
26y2 = orange.EnumVariable("y2", values = ["0", "1"])
27abe2 = orange.LookupLearner(y2, [a, b, e], data)
28for i in abe2.sortedExamples[:10]:
29    print i, i.getclass().svalue
30print
31
32y2 = orange.EnumVariable("y2", values = ["0", "1"])
33abe2 = orange.LookupLearner(y2, [a, b], data)
34for i in abe2.sortedExamples:
35    print i, i.getclass().svalue
Note: See TracBrowser for help on using the repository browser.