Add a new algorithm

Basically you can add an algorithm to Weka4WS by adding it to Weka and replacing its jar located in the lib/ subdirectory both of the client and the service packages. Here you have more detailed instructions:

  1. download Weka 3.4.12 package from here;
  2. inside the package ‘weka-3-4-12.zip’ you will find a file named ‘weka-src.jar’: extract its content in a directory of your choice (e.g. <path>/weka/);
  3. write your own algorithm following either one of the following instructions:

    you can write your own Clusterer or Associator as well following the same instructions;

  4. add your algorithm into the directory corresponding to the algorithms category to which it belongs.
    Supposing we want to add an algorithm named ‘J48Mod’, belonging to the package weka.classifiers.trees, then we will put its code file ‘J48Mod.java’ inside the directory <path>/weka/classifiers/trees/
    If your scheme is outside the usual Weka packages, you need to make Weka aware of this package in order to be able to use it in the GUI as well: to do so add the appropriate superclass/interface key into the <path>/weka/gui/GenericProperitesCreator.props file. For more information have a look at the following pages:

  5. compile the Weka source code, together with the added algorithm, following the instructions posted at this page, using ANT or your favorite IDE (Eclipse, NetBeans or JBuilder). You will not find the build file into the weka 3.4.12 sources package, so you will have to get it from the latest nightbuild which you can download from here (you need to get only the ‘build.xml’ file from this package: you can find it inside the ‘weka-src.jar’ archive, inside the ‘weka’ directory);
  6. once you have created the new ‘weka.jar’ file, copy it inside the lib/ subdirectory of both the client and service directories

One Response to “Add a new algorithm”

  1. […] Modifying Weka (Easy Version) By amyhurst Sometimes, you just have to write your own classifier… This post is based on instructions I found here. […]