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

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

Made XPM version of the icon 32x32.

Line 
1# Description: Shows how to add class noise to data
2# Category:    preprocessing
3# Uses:        imports-85
4# Classes:     Preprocessor_addClassNoise, orngTest.crossValidation
5# Referenced:  domain.htm
6
7import orange, orngTest, orngStat
8
9filename = "promoters.tab"
10data = orange.ExampleTable(filename)
11data.name = "unspoiled"
12datasets = [data]
13
14add_noise = orange.Preprocessor_addClassNoise()
15for noiselevel in (0.2, 0.4, 0.6):
16  add_noise.proportion = noiselevel
17  add_noise.randomGenerator = 42
18  d = add_noise(data)
19  d.name = "class noise %4.2f" % noiselevel
20  datasets.append(d)
21
22learner = orange.BayesLearner()
23
24for d in datasets:
25  results = orngTest.crossValidation([learner], d, folds=10)
26  print "%20s   %5.3f" % (d.name, orngStat.CA(results)[0])
Note: See TracBrowser for help on using the repository browser.