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

Revision 526:fe2d65da2b2a, 891 bytes checked in by janezd <janez.demsar@…>, 10 years ago (diff)
  • moved documentation from a separate module to this one
Line 
1# Description: Shows what the contingency matrix looks like and which are its common methods
2# Category:    statistics
3# Classes:     Contingency, ContingencyAttrClass
4# Uses:        monk1
5# Referenced:  contingency.htm
6
7import orange
8data = orange.ExampleTable("monk1")
9cont = orange.ContingencyAttrClass("e", data)
10
11print "Contingency items:"
12for val, dist in cont.items():
13    print val, dist
14print
15
16print "Contingency keys: ", cont.keys()
17print "Contingency values: ", cont.values()
18print "Contingency items: ", cont.items()
19print
20
21print "cont[0] =",cont[0]
22print 'cont[\"1\"] =', cont["1"]
23print 'cont[orange.Value(data.domain["e"], "1")] =', cont[orange.Value(data.domain["e"], "1")]
24print
25
26print "Iteration through contingency:"
27for i in cont:
28    print i
29print
30
31cont.normalize()
32print "Contingency items after normalization:"
33for val, dist in cont.items():
34    print val, dist
35print
Note: See TracBrowser for help on using the repository browser.