source: orange/docs/reference/rst/code/som-mapping.py @ 10633:fb05a6f3a235

Revision 10633:fb05a6f3a235, 607 bytes checked in by mstajdohar, 2 years ago (diff)

Changed obsolete names.

Line 
1# Description: Self Organizing Maps on iris data set
2# Category:    projection
3# Uses:        iris
4# Referenced:  Orange.projection.som
5# Classes:     Orange.projection.som.SOMLearner
6
7import Orange
8
9import random
10random.seed(0)
11
12som = Orange.projection.som.SOMLearner(map_shape=(3, 3),
13                initialize=Orange.projection.som.InitializeRandom)
14map = som(Orange.data.Table("iris.tab"))
15
16print "Node    Instances"
17print "\n".join(["%s  %d" % (str(n.pos), len(n.instances)) for n in map])
18
19i, j = 0, 1
20print
21print "Data instances in cell (%d, %d):" % (i, j)
22for e in map[i, j].instances:
23    print e
Note: See TracBrowser for help on using the repository browser.