Classification of data using Bayes and JDMP
Code: "jdmp_iris.py". Programming language: Python DMelt Version 1.8. Last modified: 06/26/1971. License: Pro
https://datamelt.org/code/cache/jdmp_iris_2719.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.


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


You see the box below because you did not login.