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

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

Tutorial documentation structure.

1# Description: Read data, build naive Bayesian classifier, and output class probabilities for the first few instances
2# Category:    modelling
3# Uses:
4# Referenced:  c_basics.htm
6import orange
7data = orange.ExampleTable("voting")
8classifier = orange.BayesLearner(data)
9print "Possible classes:", data.domain.classVar.values
10print "Probabilities for democrats:"
11for i in range(5):
12    p = classifier(data[i], orange.GetProbabilities)
13    print "%d: %5.3f (originally %s)" % (i+1, p[1], data[i].getclass())
Note: See TracBrowser for help on using the repository browser.