Classification using random tree and Weka
Code: "weka_random_tree.py". Programming language: Python DMelt Version 2.29. Last modified: 03/03/2021. License: Pro
https://datamelt.org/code/cache/weka_random_tree_5990.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 java.io import FileReader
from weka.core import Instances
from jhplot import Web
xf="iris.arff"
url="https://datamelt.org/examples/data/weka/"+xf
print "Loading ",xf
print Web.get(url)

ifile = FileReader(xf)
data = Instances(ifile)
data.setClassIndex(data.numAttributes() - 1)

print data
from weka.classifiers.trees import RandomTree
rt = RandomTree()
rt.buildClassifier(data)
print rt




Ads help maintain this website.