Table of Contents

How to build weka classifiers using ECJ library, the faster way ?

A detailed version is available here.

Prerequisites:

Class diagram:

Here is a short diagram representing what is contained in the jar file and how it is connected to ECJ's core.

Usage:

For your ECJ Algorithm:

  1. Use a derived class of ec.weka.EvolutionStateForWeka as EvolutionState for your algorithm.
  2. Use a derived class of ec.weka.StatisticsForWeka for the Statistics class of your algorithm.
  3. When building parts of your algorithm you can call the getLearningDataSet method to get a weka.Core.Instance object containing a set of data that must be given by your weka algorithm (if you need it).

When building your algorithm in weka, ou will launch your ecj algorithm by creating an ec.weka.Evolve object. Then you can call the setLearningDataSet method on it, giving it an Instances object, if your weka algorithm needs any data. Finally, to launch the algorithm you'll call the run method on the Evolve object, giving it the same argument you would give when invoking the algorithm from the command line. This mehod will return the results of the computation as an Individual[][] representing the best individuals of each subpopulation for each job. You can use these results as you wish within your weka algorithm.

written by Romaric Pighetti in 2012/01.