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

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

Made XPM version of the icon 32x32.

Line 
1# Description: Read data, build naive Bayesian classifier, and output class probabilities for the first few instances
2# Category:    modelling
3# Uses:        voting.tab
4# Referenced:  c_basics.htm
5
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.