source: orange/orange/doc/ofb/domain4.py @ 6538:a5f65d7f0b2c

Revision 6538:a5f65d7f0b2c, 671 bytes checked in by Mitar <Mitar@…>, 4 years ago (diff)

Made XPM version of the icon 32x32.

Line 
1# Description: Shows how to select examples based on their attribute values
2# Category:    preprocessing
3# Uses:        imports-85
4# Referenced:  domain.htm
5
6import orange
7
8def report_prob(header, data):
9  print 'Size of %s: %i instances' % (header, len(data))
10  n = 0
11  for i in data:
12    if int(i.getclass())==0:
13      n = n + 1
14  print "p(%s)=%5.3f" % (data.domain.classVar.values[0], float(n)/len(data))
15
16filename = "../datasets/adult_sample.tab"
17data = orange.ExampleTable(filename)
18report_prob('original data set', data)
19
20data1 = data.select(sex='Male')
21report_prob('data1', data1)
22
23data2 = data.select(sex='Male', education='Masters')
24report_prob('data2', data2)
25
Note: See TracBrowser for help on using the repository browser.