Potatoes
Potatoes

Reputation: 23

How to do deep learning through python weka wrapper3?

I am doing a experiment,it is a question about classification,for example,I got the train dataset and test dataset.Every instance has 12 different attributes(id name......) and 1 class (Value = True or False),the train dataset has told us the class value of all instances,test dataset doesn't.It seems that my task is to construct a classifier, can I just use the Classifiers in the Python weka wrapper3,such as the Random forest

Upvotes: 1

Views: 60

Answers (1)

fracpete
fracpete

Reputation: 2608

RandomForest =/= deep learning

With python-weka-wrapper3 you can use any classifier available in Weka (e.g., through the Weka Explorer). All you have to do is copy the command-line from the Weka Explorer via right-click and instantiate your Classifier object from it:

import weka.core.jvm as jvm
from weka.core.classes import from_commandline

jvm.start(packages=True)

# commandline obtained from Weka Explorer via right-click menu
cmdline = "weka.classifiers.trees.RandomForest -P 100 -I 100 -num-slots 1 -K 0 -M 1.0 -V 0.001 -S 1"

# instantiate Classifier object from commandline
cls = from_commandline(cmdline, classname="weka.classifiers.Classifier")

# output commandline again to confirm its correct
print(cls.to_commandline())

jvm.stop()

At the time of writing, this should be output:

weka.classifiers.trees.RandomForest -P 100 -I 100 -num-slots 1 -K 0 -M 1.0 -V 0.001 -S 1

Upvotes: 1

Related Questions