GenericObjectEditor+(book+version)

toc

= Introduction = As of version 3.4.4 it is possible for WEKA to dynamically discover classes at runtime (rather than using only those specified in the (GOE) file).

If dynamic class discovery is too slow, e.g., due to an enormous CLASSPATH, you can generate a new file and then turn dynamic class discovery off. It is assumed that you already placed the (GPC) file in your home directory (this file is located in directory  of either the  or  ZIP archive) and that the  jar archive with the WEKA classes is in your CLASSPATH (otherwise you have to add it to the  call using the  option).

For generating the GOE file, execute the following steps: code format="bash" java weka.gui.GenericPropertiesCreator \ $HOME/GenericPropertiesCreator.props \ $HOME/GenericObjectEditor.props code code format="bash" java weka.gui.GenericPropertiesCreator %USERPROFILE%\GenericPropertiesCreator.props %USERPROFILE%\GenericObjectEditor.props code
 * generate a new file using the following command:
 * Linux/Unix
 * Windows (command must be in one line)
 * edit the file in your home directory and set  to.

For disabling dynamic class discovery, you need to set the boolean constant of the  class to. See article Compiling WEKA for more information on how to compile a modified version of WEKA.

A limitation of the GOE prior to 3.4.4 was, that additional classifiers, filters, etc., had to fit into the same package structure as the already existing ones, i.e., all had to be located below. WEKA can now display multiple class hierarchies in the GUI, which makes adding new functionality quite easy as we will see later in an example (it is not restricted to classifiers only, but also works with all the other entries in the GPC file).

= File Structure = The structure of the GOE so far was a key-value-pair, separated by an //equals//-sign. The //value// is a comma separated list of classes that are all derived from the superclass/superinterface //key//. The GPC is slightly different, instead of declaring all the classes/interfaces one need only to specify all the packages descendants are located in (only non-abstract ones are then listed). E.g., the entry in the GOE file looks like this: code format="ini" weka.classifiers.Classifier=\ weka.classifiers.bayes.AODE,\ weka.classifiers.bayes.BayesNet,\ weka.classifiers.bayes.ComplementNaiveBayes,\ weka.classifiers.bayes.NaiveBayes,\ weka.classifiers.bayes.NaiveBayesMultinomial,\ weka.classifiers.bayes.NaiveBayesSimple,\ weka.classifiers.bayes.NaiveBayesUpdateable,\ weka.classifiers.functions.LeastMedSq,\ weka.classifiers.functions.LinearRegression,\ weka.classifiers.functions.Logistic,\ ... code The entry producing the same output for the classifiers in the GPC looks like this (7 lines instead of over 70!): code format="ini" weka.classifiers.Classifier=\ weka.classifiers.bayes,\ weka.classifiers.functions,\ weka.classifiers.lazy,\ weka.classifiers.meta,\ weka.classifiers.trees,\ weka.classifiers.rules code

 = Class Discovery = Unlike the method that grabs the first class it can find in the CLASSPATH, and therefore fixes the location of the package it found the class in, the dynamic discovery examines the complete [CLASSPATH]] you're starting the Java Virtual Machine (= JVM) with. This means that you can have several parallel directories with the same WEKA package structure, e.g. the standard release of WEKA in one directory (= ) and another one with your own classes (= ), and display all of the classifiers in the GUI. In case of a name conflict, i.e. two directories contain the same class, the first one that can be found is used. In a nutshell, your call of the GUIChooser could look like this: code format="bash" java -classpath "/development:/distribution/weka.jar" weka.gui.GUIChooser code //Note:// Windows users have to replace the ":" with ";" and the forward slashes with backslashes.

 = Multiple Class Hierarchies = In case you're developing your own framework, but still want to use your classifiers within WEKA that wasn't possible so far. With the release **3.4.4** it is possible to have multiple class hierarchies being displayed in the GUI. If you've developed a modified version of J48, let's call it //MyJ48// and it's located in the package then you'll have to add this package to the classifiers list in the GPC file like this: code format="ini" weka.classifiers.Classifier=\ weka.classifiers.bayes,\ weka.classifiers.functions,\ weka.classifiers.lazy,\ weka.classifiers.meta,\ weka.classifiers.trees,\ weka.classifiers.rules,\ dummy.classifiers code Your call for the GUIChooser might look like this: code format="bash" java -classpath "weka.jar:dummy.jar" weka.gui.GUIChooser code //Note:// Windows users have to replace the ":" with ";" and the forward slashes with backslashes.

Starting up the GUI you'll now have another root node in the tree view of the classifiers, called //root//, and below it the //weka// and the //dummy// package hierarchy as you can see here:



= Links =
 * GenericObjectEditor (developer version)
 * CLASSPATH
 * Properties file
 * GenericPropertiesCreator.props