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

Revision 9952:986e9cd806f4, 841 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Tests moved and renamed from orange 20.

Line 
1# Description: Demonstrates the use of interactions
2# Category:    interactions
3# Classes:     Mutual_information
4# Uses:        bridges.tab
5
6import orange
7import orngInteractions
8
9data = orange.ExampleTable("bridges")
10
11x = data.domain["PURPOSE"]
12y = data.domain["MATERIAL"]
13c = data.domain["TYPE"]
14
15mutual = orngInteractions.Mutual_information(data)
16print "H(%s) = %5.5f" % (x.name, orngInteractions._entropy(orngInteractions.p2f(orange.Distribution(x, data))))
17print "H(%s) = %5.5f" % (y.name, orngInteractions._entropy(orngInteractions.p2f(orange.Distribution(y, data))))
18print "H(%s,%s)= %5.5f" % (x.name, y.name, orngInteractions.joint_entropy(x, y, data))
19print "I(%s;%s)= %5.5f" % (x.name, y.name, mutual(x, y))
20print "H(%s|%s)= %5.5f" % (x.name, c.name, mutual(x, c))
21#print "InfoGain = %5.5f" % orange.MeasureAttribute_info(x, data)
Note: See TracBrowser for help on using the repository browser.