Classifier Integration in Weka

Weka (Waikato Environment for Knowledge Analysis) is a widely accessed open source software used in machine learning tasks. Weka, being an open source software, we are allowed to modify its source to create an entirely new weka distribution with a new set of classifiers or other features.

I am not covering any further in the basics of weka. This tutorial is intended for those who want to integrate a new classifier algorithm written in java into the weka software. For demonstration purposes, I am showing the procedure to add ART(Adaptive Resonance Theory), a neural network based classifier to Weka.

Required Tools

You need the following before you start the integration process.




You need the JDK (Java Development Kit) for compiling the updated/modified weka source packages. The installation folder of Weka would contain the weka source code archive, which we will be modifying to create a new distribution of weka. ANT is a command line tool and a java library used for building java applications.

Step 1: Create a folder “weka” in C:\

Step 2: Go to the weka installation folder and Extract the contents of weka-src.jar to C:\weka

Step 3: Go to C:\weka\src\main\java\weka\gui

Step 4: Open the file GenericObjectEditor.props in any editor for editing.

Step 5: The file GenericObjectEditor.props is like a configuration file used by weka. In this file we are going to add a line that declares that a new classifier named “Artmap” should be displayed in the classifier tab of Weka GUI. We need to add an entry corresponding to our new classifier in the “List of Classifiers” section of the file. The addition of the new entry should follow an alphabetical order of classifier name. In the following example, line number 6 indicates our new entry.

Step 6: Now we can add the source code of the new classifier. In this example, I have two source files (of same classifier); and

We can add them to the source folders; in this example we are adding to the folder C:\weka\src\main\java\weka\classifiers\bayes

Step 7: We need to download ANT from the following website and then extract the contents to C:\ant

Step 8: Create a batch file weka.bat with the following content

set ANT_HOME=C:\antset JAVA_HOME=c:\jdk1.6set PATH=%PATH%;%ANT_HOME%\bincd \cd weka

We created this bat file for an easy build process. As you can see in its contents, we are setting the PATH to make the path of java and ANT globally known to the computer.

Step 9: Run Command Prompt.

Step 10: Navigate to C:\ and then execute the batch file weka.bat

Step 11: Type the following in the Command Prompt to start the build process.

Step 12: If you had all set correctly you will get a “BUILD SUCCEEDED” message at the end.

Step 13: Your new Weka distribution will be created in a new folder C:\weka\dist and you can start the executable jar created which should have your new classifier integrated

Leave a Reply