source: orange/Orange/doc/ofb/ @ 9671:a7b056375472

Revision 9671:a7b056375472, 524 bytes checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

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.