Ignore:
Timestamp:
02/05/12 22:37:07 (2 years ago)
Author:
umek@…
Branch:
default
rebase_source:
eb6a120705f3462186b982a698c0a7ad9f947e24
Message:

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")

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/reference/rst/code/distances-test.py

    r9372 r9638  
    22 
    33# Read some data 
    4 table = Orange.data.Table("iris.tab") 
     4iris = Orange.data.Table("iris.tab") 
    55 
    66# Euclidean distance constructor 
    77d2Constr = Orange.distance.instances.EuclideanConstructor() 
    8 d2 = d2Constr(table) 
     8d2 = d2Constr(iris) 
    99 
    1010# Constructs  
    11 dPears = Orange.distance.instances.PearsonRConstructor(table) 
     11dPears = Orange.distance.instances.PearsonRConstructor(iris) 
    1212 
    1313#reference instance 
    14 ref = table[0] 
     14ref = iris[0] 
    1515 
    1616print "Euclidean distances from the first data instance: " 
    1717 
    18 for ins in table[:5]: 
     18for ins in iris[:5]: 
    1919    print "%5.4f" % d2(ins, ref), 
    2020print  
     
    2222print "Pearson correlation distance from the first data instance: " 
    2323 
    24 for ins in table[:5]: 
     24for ins in iris[:5]: 
    2525    print "%5.4f" % dPears(ins, ref), 
    2626print  
Note: See TracChangeset for help on using the changeset viewer.