source: orange/docs/tutorial/rst/code/domain8.py @ 9374:59bac7ddd8a2

Revision 9374:59bac7ddd8a2, 756 bytes checked in by mitar, 2 years ago (diff)

Tutorial documentation structure.

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.