Skip to main content
Get your brand new Wikispaces Classroom now
and do "back to school" in style.
Pages and Files
Not So FAQ
How to run WEKA schemes from commandline
It is quite often the case that one has to run a classifier, filter, attribute selection, etc. from commandline, leaving the comfort of the GUI (most likely the Explorer). Due to the vast amount of options the Weka schemes offer, it can be quite tedious setting up a scheme on the commandline.
In the following, a few different approaches are listed that can be used for running a scheme from the commandline:
(works for all versions of Weka)
one just uses the
option to display the commandline help with all available options and chooses the ones that apply, e.g.:
java weka.classifiers.functions.SMO -h
The drawback of this method is, that one has to take care of escaping nested quotes oneself. As soon as one has to use meta-classifiers, this gets real messy. An introduction to the commandline use can be found in the
With this approach, one doesn't have to worry about correct nesting, since Weka takes care of that, returning correctly nested and escaped options.
Since version 3.5.3, one can right-click (or
left-click for Mac users) any
panel and select the
Copy configuration to clipboard
option to copy the currently shown configuration to the clipboard and then just paste it into the commandline. One only needs to add the appropriate
call and other general options, like datasets, class index, etc.
Another copy/paste approach is copying the configurations from the
log, which is available since version 3.5.4. Every action in the Explorer, like applying a filter, running a classifier, attribute selection, etc. outputs the command to the log as well. This makes is fairly easy copying it to the clipboard and using it in the console, only the
call and other general options need to be added.
- introduction to Weka from the commandline
- how to load all necessary libraries or welcome to the
- shows how to redirect output in files
help on how to format text
Turn off "Getting Started"