source: orange/docs/reference/rst/code/correspondence1.py @ 9638:eb3af38491f2

Revision 9638:eb3af38491f2, 689 bytes checked in by umek@…, 2 years ago (diff)

Changed table to data or name of the data set.

For example - instead of

table = Orange.data.Table("housing")

is changed to

housing = Orange.data.Table("housing")

Line 
1# Description: Demonstrates the use of correspondence analysis
2# Category:    correspondence, projection
3# Classes:     CA
4# Uses:        bridges.tab
5
6import Orange
7import Orange.projection.correspondence as corr
8import Orange.statistics.contingency as cont
9
10bridges = Orange.data.Table("bridges")
11cm = cont.VarVar("PURPOSE", "MATERIAL", bridges)
12ca = corr.CA(cm)
13
14def report(coors, labels):
15    for coor, label in zip(coors, labels):
16        print %-10s (%.3f, %.3f)" % (label + ":", coor[0, 0], coor[0, 1])
17       
18print "PURPOSE"
19report(ca.column_factors(), bridges.domain["PURPOSE"].values)
20print 
21
22print "MATERIAL"
23report(ca.row_factors(), bridges.domain["PURPOSE"].values)
24print 
Note: See TracBrowser for help on using the repository browser.