source: orange/orange/doc/reference/ClassifierByExampleTable.py @ 526:fe2d65da2b2a

Revision 526:fe2d65da2b2a, 992 bytes checked in by janezd <janez.demsar@…>, 10 years ago (diff)
  • moved documentation from a separate module to this one
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.