from org.jdmp.core.dataset import DataSet
from org.jdmp.core.algorithm.classification.bayes import NaiveBayesClassifier
# load example data set
dataSet = DataSet.Factory.IRIS()
dataSet.showGUI()
# create a classifier
classifier = NaiveBayesClassifier()
# train the classifier using all data
classifier.trainAll(dataSet)
# use the classifier to make predictions
classifier.predictAll(dataSet)
# get the results
accuracy = dataSet.getAccuracy()
print "accuracy: ", accuracy
Ads help maintain this website.