WEKA notes

  • CLI: java weka.core.SystemInfo
  • Remote Desktop Linux Ubuntu 10.10: use xdm as desktop manager, ssh -Y ipaddress
  • Libsvm: export CLASSPATH=$CLASSPATH:/usr/share/java/libsvm.jar
  • Arff: use “sparse” format


  • Monodevelop, open console C# project
  • Library ref: weka-3.6.0.dll, IKVM.OpenJDK.Core.dll, IKVM.Runtime.dll, System.dll
  • To obtain weka-3.6.0.dll, change directory to where weka.jar resides, type  >ikvmc -target:library weka-3.6.0.jar

using System;

namespace contohweka
class MainClass
public static void Main (string[] args)
Console.WriteLine (“Hello World from C Java IKVM!”);

const int percentSplit = 66;
public static void classifyTest()
weka.core.Instances insts = new weka.core.Instances(new java.io.FileReader(“iris.arff”));
insts.setClassIndex(insts.numAttributes() – 1);

weka.classifiers.Classifier cl = new weka.classifiers.trees.J48();
Console.WriteLine(“Performing ” + percentSplit + “% split evaluation.”);

//randomize the order of the instances in the dataset.
weka.filters.Filter myRandom = new weka.filters.unsupervised.instance.Randomize();
insts = weka.filters.Filter.useFilter(insts, myRandom);

int trainSize = insts.numInstances() * percentSplit / 100;
int testSize = insts.numInstances() – trainSize;
weka.core.Instances train = new weka.core.Instances(insts, 0, trainSize);

int numCorrect = 0;
for (int i = trainSize;

Posted in Linux, Programming/Notes, Windows

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: