Setting up and running WEKA
for CS 391L: Machine Learning
[A] Editing your shell's initialization file
The instructions below describe how to make WEKA run under your CS account. They involve some commands, such as
creating aliases and setting environment variables, that you will not want to repeat every time you use WEKA.
To avoid this, you can add those commands to your shell's initialization file (.cshrc for tcsh or csh shell and .bashrc
for bash shell) so that everything will be configured automatically when your shell is run.
[A] Setting up Java:
First check that you are running Java 2 (Java 5 will not work with Weka). Type the following commands at the prompt:
If these commands do not return "/lusr/java2/bin/java" and "/lusr/java2/bin/javac", respectively, then you
are not using the correct version of Java. You can fix this by creating aliases as follows.
For tcsh or csh shells:
alias javac /lusr/java2/bin/javac
alias java /lusr/java2/bin/java
For bash shell:
[B] Running the code from Dr. Mooney's installation:
1. Setting up the classpath for Java
To run WEKA classes, Java needs to be able to find them somewhere in your CLASSPATH environment variable.
If you are using tcsh or csh shells type: setenv CLASSPATH
If you are using bash shell type: export CLASSPATH=".:/u/mooney/cs391L-code/weka"
If your CLASSPATH already contains directories you don't want to eliminate, you can just append
":/u/mooney/cs391L-code/weka" to your existing CLASSPATH. You can view your current CLASSPATH by typing
echo $CLASSPATH at the prompt.
2. Running the code
As a test of your configuration, try to run Dr. Mooney's version-space code. First, copy a data file to your
cp /u/mooney/cs391L-code/weka/data/figure.arff .
Then run Dr. Mooney's version-space code:
java weka.classifiers.vspace.ConjunctiveVersionSpace -t figure.arff -T figure.arff -v -P
The output should match the beginning of the
Homework #1 Trace File. The trace file also gives examples of other commands to run. Remember to copy the
data files to your local directory first or to supply the full pathname in your command.
[C] Creating your own WEKA installation:
In order to edit Dr. Mooney's code and add the features required in the homework assignments, you will need to
create your own WEKA installation.
1. Copy Dr. Mooney's WEKA directory to your home
At the command prompt, type: cp -R /u/mooney/cs391L-code/weka ~
2. Setting up the classpath for Java
Now make your CLASSPATH point to WEKA's new location.
On tcsh or csh shells type:
setenv CLASSPATH ".:$HOME/weka"
On bash shell type:
As above, you can simply append ":$HOME/weka" to your CLASSPATH if it lists other directories you need.
3. Running the code
Now run the version-space code again but specify the new location of the data file:
java weka.classifiers.vspace.ConjunctiveVersionSpace -t weka/data/figure.arff -T weka/data/figure.arff -v -P
4. Recompiling after modifications
Now that you have your own copy of the WEKA code, you can make modifications to it. To recompile a file