source: orange/Orange/doc/modules/feature-construction.py @ 9671:a7b056375472

Revision 9671:a7b056375472, 1.4 KB checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

Line 
1# Description: Demonstrates the use of attribute construction
2# Category:    feature induction
3# Classes:     FeatureByMinComplexity, FeatureByIM, FeatureByKramer, FeatureByCartesianProduct
4# Uses:        monks-2.tab
5
6import orange
7import orngCI
8
9data = orange.ExampleTable("../datasets/monks-2")
10
11ab, quality = orngCI.FeatureByMinComplexity(data, ["a", "b"])
12print "Quality: %.3f" % quality 
13print "Values", ab.values
14
15data2 = orngCI.addAnAttribute(ab, data)
16
17c = orange.ContingencyAttrClass(ab, data)
18for i in c:
19    print i
20   
21   
22ab, quality = orngCI.FeatureByIM(data, ["a", "b"])
23print "Quality: %.3f" % quality 
24print "Values", ab.values
25
26data2 = orngCI.addAnAttribute(ab, data)
27
28c = orange.ContingencyAttrClass(ab, data)
29for i in c:
30    print i
31
32   
33ab, quality = orngCI.FeatureByKramer(data, ["a", "b"])
34print "Quality: %.3f" % quality 
35print "Values", ab.values
36
37data2 = orngCI.addAnAttribute(ab, data)
38
39c = orange.ContingencyAttrClass(ab, data)
40for i in c:
41    print i
42 
43#Does not work
44#ab, quality = orngCI.FeatureByRandom(data, ["a", "b"])
45#print "Quality: %.3f" % quality 
46#print "Values", ab.values
47#
48#data2 = orngCI.addAnAttribute(ab, data)
49#
50#c = orange.ContingencyAttrClass(ab, data)
51#for i in c:
52#    print i
53   
54   
55ab, quality = orngCI.FeatureByCartesianProduct(data, ["a", "b"])
56print "Quality: %.3f" % quality 
57print "Values", ab.values
58
59data2 = orngCI.addAnAttribute(ab, data)
60
61c = orange.ContingencyAttrClass(ab, data)
62for i in c:
63    print i
Note: See TracBrowser for help on using the repository browser.