Changeset 9746:f2ff17dfd86e in orange


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.

Location:
docs/tutorial/rst/code
Files:
4 edited

Legend:

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

    r9374 r9746  
    1010  n = 0 
    1111  for i in data: 
    12     if int(i.getclass())==0: 
     12    if int(i.getclass()) == 0: 
    1313      n = n + 1 
    14   print "p(%s)=%5.3f" % (data.domain.classVar.values[0], float(n)/len(data)) 
     14  print "p(%s)=%5.3f" % (data.domain.classVar.values[0], float(n) / len(data)) 
    1515 
    16 filename = "../../datasets/adult_sample.tab" 
     16filename = "adult_sample.tab" 
    1717data = orange.ExampleTable(filename) 
    1818report_prob('original data set', data) 
  • docs/tutorial/rst/code/domain5.py

    r9374 r9746  
    88 
    99def report_prob(header, data): 
    10   print 'Size of %s: %i instances; ' % (header, len(data)),  
     10  print 'Size of %s: %i instances; ' % (header, len(data)), 
    1111  n = 0 
    1212  for i in data: 
    13     if int(i.getclass())==0: 
     13    if int(i.getclass()) == 0: 
    1414      n = n + 1 
    1515  if len(data): 
    16     print "p(%s)=%5.3f" % (data.domain.classVar.values[0], float(n)/len(data)) 
     16    print "p(%s)=%5.3f" % (data.domain.classVar.values[0], float(n) / len(data)) 
    1717  else: 
    1818    print 
    1919 
    20 filename = "../../datasets/adult_sample.tab" 
     20filename = "adult_sample.tab" 
    2121data = orange.ExampleTable(filename) 
    2222report_prob('data', data) 
  • docs/tutorial/rst/code/domain6.py

    r9374 r9746  
    88 
    99def report_prob(header, data): 
    10   print 'Size of %s: %i instances; ' % (header, len(data)),  
     10  print 'Size of %s: %i instances; ' % (header, len(data)), 
    1111  n = 0 
    1212  for i in data: 
    13     if int(i.getclass())==0: 
     13    if int(i.getclass()) == 0: 
    1414      n = n + 1 
    1515  if len(data): 
    16     print "p(%s)=%5.3f" % (data.domain.classVar.values[0], float(n)/len(data)) 
     16    print "p(%s)=%5.3f" % (data.domain.classVar.values[0], float(n) / len(data)) 
    1717  else: 
    1818    print 
    1919 
    20 filename = "../../datasets/adult_sample.tab" 
     20filename = "adult_sample.tab" 
    2121data = orange.ExampleTable(filename) 
    2222report_prob('data', data) 
    2323 
    24 data1 = data.select(age=(30,40)) 
     24data1 = data.select(age=(30, 40)) 
    2525report_prob('data1, age from 30 to 40', data1) 
    2626 
    27 data2 = data.select(age=(40,30)) 
     27data2 = data.select(age=(40, 30)) 
    2828report_prob('data2, younger than 30 or older than 40', data2) 
  • 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.