source: orange/docs/reference/rst/code/statistics-contingency5.py @ 9823:7f9c3f3c6474

Revision 9823:7f9c3f3c6474, 773 bytes checked in by lanumek, 2 years ago (diff)

Changed names of data sets (table replaced with data or name of the data set).

Line 
1import Orange
2
3bridges = Orange.data.Table("bridges.tab")
4cont = Orange.statistics.contingency.VarVar("SPAN", "MATERIAL", bridges)
5
6print "Distributions:"
7for val in cont.outer_variable:
8    print "  p(.|%s) = %s" % (val.native(), cont.p_attr(val))
9print
10
11cont.normalize()
12for val in cont.outer_variable:
13    print "%s:" % val.native()
14    for inval, p in cont[val].items():
15        if p:
16            print "   %s (%i%%)" % (inval, int(100*p+0.5))
17    print
18
19cont = Orange.statistics.contingency.VarVar(bridges.domain["SPAN"], bridges.domain["MATERIAL"])
20for ins in bridges:
21    cont.add(ins["SPAN"], ins["MATERIAL"])
22
23print "Distributions from a matrix computed manually:"
24for val in cont.outer_variable:
25    print "  p(.|%s) = %s" % (val.native(), cont.p_attr(val))
26print
Note: See TracBrowser for help on using the repository browser.