Ignore:
Timestamp:
02/06/12 16:09:54 (2 years ago)
Author:
Miha Stajdohar <miha.stajdohar@…>
Branch:
default
rebase_source:
4311e8f03a946a2d7c9617962b042caee71181b7
Message:

Changed data set path.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/tutorial/rst/code/domain7.py

    r9374 r9746  
    77 
    88def report_prob(header, data): 
    9   print 'Size of %s: %i instances; ' % (header, len(data)),  
     9  print 'Size of %s: %i instances; ' % (header, len(data)), 
    1010  n = 0 
    1111  for i in data: 
    12     if int(i.getclass())==0: 
     12    if int(i.getclass()) == 0: 
    1313      n = n + 1 
    1414  if len(data): 
    15     print "p(%s)=%5.3f" % (data.domain.classVar.values[0], float(n)/len(data)) 
     15    print "p(%s)=%5.3f" % (data.domain.classVar.values[0], float(n) / len(data)) 
    1616  else: 
    1717    print 
    1818 
    19 filename = "../../datasets/adult_sample.tab" 
     19filename = "adult_sample.tab" 
    2020data = orange.ExampleTable(filename) 
    2121report_prob('data', data) 
    2222 
    23 selection = [1]*10 + [0]*(len(data)-10) 
     23selection = [1] * 10 + [0] * (len(data) - 10) 
    2424data1 = data.select(selection) 
    2525report_prob('data1, first ten instances', data1) 
     
    2828report_prob('data2, other than first ten instances', data2) 
    2929 
    30 selection = [1]*12 + [2]*12 + [3]*12 + [0]*(len(data)-12*3) 
     30selection = [1] * 12 + [2] * 12 + [3] * 12 + [0] * (len(data) - 12 * 3) 
    3131data3 = data.select(selection, 3) 
    3232report_prob('data3, third dozen of instances', data3) 
Note: See TracChangeset for help on using the changeset viewer.