source: orange/orange/doc/modules/correspondance.py @ 7652:677f449144fd

Revision 7652:677f449144fd, 677 bytes checked in by ales_erjavec <ales.erjavec@…>, 3 years ago (diff)
Line 
1# Description: Demonstrates the use of correspondence analysis
2# Category:    correspondence, projection
3# Classes:     CA
4# Uses:        bridges.tab
5
6import orange
7import orngCA
8
9data = orange.ExampleTable("bridges")
10cm = orange.ContingencyAttrAttr("PURPOSE", "MATERIAL", data)
11ca = orngCA.CA([list(col) for col in cm])
12
13def report(coors, labels):
14    for coor, label in zip(coors, labels):
15        print %-10s (%.3f, %.3f)" % (label + ":", coor[0], coor[1])
16       
17print "PURPOSE"
18report(ca.getPrincipalColProfilesCoordinates(), data.domain["PURPOSE"].values)
19print 
20
21print "MATERIAL"
22report(ca.getPrincipalRowProfilesCoordinates(), data.domain["PURPOSE"].values)
23print 
Note: See TracBrowser for help on using the repository browser.