Changeset 9838:bde35afd7a6a in orange for docs/reference/rst/code/mdsscatterplot.py
 Timestamp:
 02/06/12 20:14:37 (2 years ago)
 Branch:
 default
 Parents:
 9837:0592cf8b6840 (diff), 9827:71697b7e31c7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.  Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

docs/reference/rst/code/mdsscatterplot.py
r9827 r9838 8 8 9 9 # Load some data 10 table= Orange.data.Table("iris.tab")10 iris = Orange.data.Table("iris.tab") 11 11 12 12 # Construct a distance matrix using Euclidean distance 13 euclidean = Orange.distance.Euclidean( table)14 distance = Orange.core.SymMatrix(len( table))15 for i in range(len( table)):13 euclidean = Orange.distance.Euclidean(iris) 14 distance = Orange.core.SymMatrix(len(iris)) 15 for i in range(len(iris)): 16 16 for j in range(i + 1): 17 distance[i, j] = euclidean( table[i], table[j])17 distance[i, j] = euclidean(iris[i], iris[j]) 18 18 19 19 # Run 100 steps of MDS optimization … … 27 27 # Construct points (x, y, instanceClass) 28 28 points = [] 29 for (i, d) in enumerate( table):29 for (i, d) in enumerate(iris): 30 30 points.append((mds.points[i][0], mds.points[i][1], d.getclass())) 31 31 32 32 # Paint each class separately 33 for c in range(len( table.domain.class_var.values)):33 for c in range(len(iris.domain.class_var.values)): 34 34 sel = filter(lambda x: x[1] == c, points) 35 35 x = [s[0] for s in sel] 
docs/reference/rst/code/mdsscatterplot.py
r9823 r9838 11 11 12 12 # Construct a distance matrix using Euclidean distance 13 euclidean = Orange.distance. instances.EuclideanConstructor(iris)13 euclidean = Orange.distance.Euclidean(iris) 14 14 distance = Orange.core.SymMatrix(len(iris)) 15 15 for i in range(len(iris)): 16 for j in range(i +1):16 for j in range(i + 1): 17 17 distance[i, j] = euclidean(iris[i], iris[j]) 18 18
Note: See TracChangeset
for help on using the changeset viewer.