com.rapidminer.tools
Class WekaTools

java.lang.Object
  extended by com.rapidminer.tools.WekaTools

public class WekaTools
extends java.lang.Object

This class contains static methods for converting Weka Instances to RapidMiner ExampleSet and vice versa.

Author:
Ingo Mierswa

Field Summary
static java.lang.String WEKA_OPERATOR_PREFIX
          This prefix indicates all Weka operators.
 
Constructor Summary
WekaTools()
           
 
Method Summary
static void addParameterTypes(weka.core.OptionHandler handler, java.util.List<ParameterType> types, java.util.List<ParameterType> wekaParameters, boolean meta, java.lang.String metaParameter)
          Add the parameter type for the options of a Weka option handler.
static java.lang.String[] getWekaClasses(java.lang.Class superclass)
           
static java.lang.String[] getWekaClasses(java.lang.Class superclass, java.lang.String[] searchConstraints, boolean positive)
           
static java.lang.String[] getWekaClasses(java.lang.Class superclass, java.lang.String[] positiveSearchConstraints, java.lang.String[] negativeSearchConstraints)
          If Weka is not found, this method silently returns an empty string array.
static java.lang.String[] getWekaClasses(java.lang.Class superclass, java.lang.String seachConstraint, boolean includeConstraint)
           
static java.util.jar.JarFile getWekaJar()
          This method retrieves the jar file of Weka as a file and wraps it into a JarFile.
static java.io.File getWekaJarAsFile()
          Checks if the user has defined the position of Weka in an environment variable.
static java.lang.String[] getWekaParametersFromList(java.util.List rapidMinerParameters)
          Returns the Weka parameters for a RapidMiner parameter list.
static java.lang.String[] getWekaParametersFromTypes(Operator operator, java.util.List parameterTypes)
          Returns all Weka parameters as String array from the given list of parameter types.
static ParameterType guessParameterType(weka.core.Option option, java.lang.String[] options)
          Tries to guess the type of the given option.
static void registerWekaOperators(java.lang.ClassLoader classLoader, java.lang.String[] classNames, java.util.Map<java.lang.String,java.lang.String> deprecationInfos, java.lang.String operatorClass, java.lang.String firstDescription, java.lang.String firstGroup, java.lang.String icon)
          Registers all given Weka operators.
static void registerWekaOperators(java.lang.ClassLoader classLoader, java.lang.String[] classNames, java.lang.String operatorClass, java.lang.String firstDescription, java.lang.String firstGroup, java.lang.String icon)
          Registers all given Weka operators.
static ExampleSet toRapidMinerExampleSet(weka.core.Instances instances)
          Invokes toRapidMinerExampleSet(instances, null, DataRowFactory.TYPE_DOUBLE_ARRAY).
static ExampleSet toRapidMinerExampleSet(weka.core.Instances instances, java.lang.String attributeNamePrefix)
          Invokes toRapidMinerExampleSet(instances, attributeNamePrefix, DataRowFactory.TYPE_DOUBLE_ARRAY).
static ExampleSet toRapidMinerExampleSet(weka.core.Instances instances, java.lang.String attributeNamePrefix, int datamanagement)
          Creates a RapidMiner example set from Weka instances.
static weka.core.Instances toWekaInstances(ExampleSet exampleSet, java.lang.String name, int taskType)
          Creates Weka instances with the given name from the given example set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WEKA_OPERATOR_PREFIX

public static final java.lang.String WEKA_OPERATOR_PREFIX
This prefix indicates all Weka operators. It also allows RapidMiner operators with the same name.

See Also:
Constant Field Values
Constructor Detail

WekaTools

public WekaTools()
Method Detail

toRapidMinerExampleSet

public static ExampleSet toRapidMinerExampleSet(weka.core.Instances instances)
Invokes toRapidMinerExampleSet(instances, null, DataRowFactory.TYPE_DOUBLE_ARRAY).


toRapidMinerExampleSet

public static ExampleSet toRapidMinerExampleSet(weka.core.Instances instances,
                                                java.lang.String attributeNamePrefix)
Invokes toRapidMinerExampleSet(instances, attributeNamePrefix, DataRowFactory.TYPE_DOUBLE_ARRAY).


toRapidMinerExampleSet

public static ExampleSet toRapidMinerExampleSet(weka.core.Instances instances,
                                                java.lang.String attributeNamePrefix,
                                                int datamanagement)
Creates a RapidMiner example set from Weka instances. Only a label can be used as special attributes, other types of special attributes are not supported. If attributeNamePrefix is not null, the given string prefix plus a number is used as attribute names.


toWekaInstances

public static weka.core.Instances toWekaInstances(ExampleSet exampleSet,
                                                  java.lang.String name,
                                                  int taskType)
                                           throws OperatorException
Creates Weka instances with the given name from the given example set. The taskType defines for which task the instances object should be used.

Throws:
OperatorException

getWekaParametersFromList

public static java.lang.String[] getWekaParametersFromList(java.util.List rapidMinerParameters)
Returns the Weka parameters for a RapidMiner parameter list.


getWekaParametersFromTypes

public static java.lang.String[] getWekaParametersFromTypes(Operator operator,
                                                            java.util.List parameterTypes)
Returns all Weka parameters as String array from the given list of parameter types.


guessParameterType

public static ParameterType guessParameterType(weka.core.Option option,
                                               java.lang.String[] options)
Tries to guess the type of the given option. If the number of arguments is zero, than a boolean type is assumed. In other cases it will be tried to parse the default value in the options array as a number and on success a Double type is returned. If this fails, a ParameterTypeString is returned.


addParameterTypes

public static void addParameterTypes(weka.core.OptionHandler handler,
                                     java.util.List<ParameterType> types,
                                     java.util.List<ParameterType> wekaParameters,
                                     boolean meta,
                                     java.lang.String metaParameter)
Add the parameter type for the options of a Weka option handler.


getWekaJarAsFile

public static java.io.File getWekaJarAsFile()
                                     throws java.io.IOException
Checks if the user has defined the position of Weka in an environment variable. If this is the case, the system uses the Jar file of Weka located at the given position. Otherwise this method assumes that Weka is at the default place in the lib directory under RapidMiner's home dir. If this is also not possible a runtime exception will be thrown.

Throws:
java.io.IOException

getWekaJar

public static java.util.jar.JarFile getWekaJar()
                                        throws java.io.IOException
This method retrieves the jar file of Weka as a file and wraps it into a JarFile.

Throws:
java.io.IOException

getWekaClasses

public static java.lang.String[] getWekaClasses(java.lang.Class superclass)

getWekaClasses

public static java.lang.String[] getWekaClasses(java.lang.Class superclass,
                                                java.lang.String seachConstraint,
                                                boolean includeConstraint)

getWekaClasses

public static java.lang.String[] getWekaClasses(java.lang.Class superclass,
                                                java.lang.String[] searchConstraints,
                                                boolean positive)

getWekaClasses

public static java.lang.String[] getWekaClasses(java.lang.Class superclass,
                                                java.lang.String[] positiveSearchConstraints,
                                                java.lang.String[] negativeSearchConstraints)
If Weka is not found, this method silently returns an empty string array.


registerWekaOperators

public static void registerWekaOperators(java.lang.ClassLoader classLoader,
                                         java.lang.String[] classNames,
                                         java.lang.String operatorClass,
                                         java.lang.String firstDescription,
                                         java.lang.String firstGroup,
                                         java.lang.String icon)
Registers all given Weka operators. The parameter firstDescription will be prepended to the name and firstGroup should have its last point if the last package should form a subgroup and no ending point if the given group should be definitely the group of the operators. Invokes the method without deprecated operators.


registerWekaOperators

public static void registerWekaOperators(java.lang.ClassLoader classLoader,
                                         java.lang.String[] classNames,
                                         java.util.Map<java.lang.String,java.lang.String> deprecationInfos,
                                         java.lang.String operatorClass,
                                         java.lang.String firstDescription,
                                         java.lang.String firstGroup,
                                         java.lang.String icon)
Registers all given Weka operators. The parameter firstDescription will be prepended to the name and firstGroup should have its last point if the last package should form a subgroup and no ending point if the given group should be definitely the group of the operators.



Copyright © 2001-2009 by Rapid-I