Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home | Weka's home | Weka's home | Weka's home | Weka's home | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.classifiers
Class JythonClassifier

    java.lang.Object
      weka.classifiers.Classifier
          weka.classifiers.JythonClassifier

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, CapabilitiesHandler, OptionHandler, RevisionHandler

    public class JythonClassifier

extends Classifier

A wrapper class for Jython code. Even though the classifier is serializable, the trained classifier cannot be stored persistently. I.e., one cannot store a model file and re-load it at a later point in time again to make predictions.

Valid options are:

     -J <filename>
      The Jython module to load (full path)
      Options after '--' will be passed on to the Jython module.

     -P <directory[,directory,...]>
      The paths to add to 'sys.path' (comma-separated list).

     -D
      If set, classifier is run in debug mode and
      may output additional info to the console

Options after "--" will be passed onto the Jython module.

Partially based on this code.

Version:
  $Revision: 5536 $
Author:
  FracPete (fracpete at waikato dot ac dot nz)
See Also:
  Serialized Form

Constructor Summary
`JythonClassifier()` default constructor

Method Summary
`void` | `buildClassifier(Instances instances)` Generates the classifier.
`double` | `classifyInstance(Instance instance)` Classifies a given instance.
`double[]` | `distributionForInstance(Instance instance)` Calculates the class membership probabilities for the given test instance.
`Capabilities` | `getCapabilities()` Returns default capabilities of the classifier.
`java.io.File` | `getJythonModule()` Gets the Jython module.
`java.lang.String` | `getJythonOptions()` Gets the Jython module options.
`java.lang.String` | `getJythonPaths()` Gets the additional Jython paths.
`java.lang.String[]` | `getOptions()` Gets the current settings of the Classifier.
`java.lang.String` | `getRevision()` Returns the revision string.
`java.lang.String` | `globalInfo()` Returns a string describing classifier
`java.lang.String` | `jythonModuleTipText()` Returns the tip text for this property
`java.lang.String` | `jythonOptionsTipText()` Returns the tip text for this property
`java.lang.String` | `jythonPathsTipText()` Returns the tip text for this property
`java.util.Enumeration` | `listOptions()` Returns an enumeration describing the available options.
`static void` | `main(java.lang.String[] args)` Main method for testing this class.
`void` | `setJythonModule(java.io.File value)` Sets the Jython module.
`void` | `setJythonOptions(java.lang.String value)` Sets the Jython module options.
`void` | `setJythonPaths(java.lang.String value)` Sets the additional Jython paths.
`void` | `setOptions(java.lang.String[] options)` Parses a given list of options.
`java.lang.String` | `toString()` Returns a description of the classifier.

Methods inherited from class weka.classifiers.Classifier
`debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### JythonClassifier

    public JythonClassifier()

  default constructor

Method Detail

### globalInfo

    public java.lang.String globalInfo()

  Returns a string describing classifier

  Returns:
    a description suitable for displaying in the explorer/experimenter gui

### listOptions

    public java.util.Enumeration listOptions()

  Returns an enumeration describing the available options.

  Specified by:
    `listOptions` in interface `OptionHandler`
  Overrides:
    `listOptions` in class `Classifier`
  Returns:
    an enumeration of all the available options.

### setOptions

    public void setOptions(java.lang.String[] options)
                    throws java.lang.Exception

  Parses a given list of options.

  Specified by:
    `setOptions` in interface `OptionHandler`
  Overrides:
    `setOptions` in class `Classifier`
  Parameters:
    `options` - the list of options as an array of strings
  Throws:
    `java.lang.Exception` - if an option is not supported

### getOptions

    public java.lang.String[] getOptions()

  Gets the current settings of the Classifier.

  Specified by:
    `getOptions` in interface `OptionHandler`
  Overrides:
    `getOptions` in class `Classifier`
  Returns:
    an array of strings suitable for passing to setOptions

### jythonModuleTipText

    public java.lang.String jythonModuleTipText()

  Returns the tip text for this property

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### setJythonModule

    public void setJythonModule(java.io.File value)

  Sets the Jython module.

  Parameters:
    `value` - the Jython module

### getJythonModule

    public java.io.File getJythonModule()

  Gets the Jython module.

  Returns:
    the Jython module

### jythonOptionsTipText

    public java.lang.String jythonOptionsTipText()

  Returns the tip text for this property

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### setJythonOptions

    public void setJythonOptions(java.lang.String value)

  Sets the Jython module options.

  Parameters:
    `value` - the options

### getJythonOptions

    public java.lang.String getJythonOptions()

  Gets the Jython module options.

  Returns:
    the options

### jythonPathsTipText

    public java.lang.String jythonPathsTipText()

  Returns the tip text for this property

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### setJythonPaths

    public void setJythonPaths(java.lang.String value)

  Sets the additional Jython paths.

  Parameters:
    `value` - the paths (comma-separated list)

### getJythonPaths

    public java.lang.String getJythonPaths()

  Gets the additional Jython paths.

  Returns:
    the paths

### getCapabilities

    public Capabilities getCapabilities()

  Returns default capabilities of the classifier.

  Specified by:
    `getCapabilities` in interface `CapabilitiesHandler`
  Overrides:
    `getCapabilities` in class `Classifier`
  Returns:
    the capabilities of this classifier
  See Also:
    `Capabilities`

### buildClassifier

    public void buildClassifier(Instances instances)
                         throws java.lang.Exception

  Generates the classifier.

  Specified by:
    `buildClassifier` in class `Classifier`
  Parameters:
    `instances` - set of instances serving as training data
  Throws:
    `java.lang.Exception` - if the classifier has not been generated successfully

### classifyInstance

    public double classifyInstance(Instance instance)
                            throws java.lang.Exception

  Classifies a given instance.

  Overrides:
    `classifyInstance` in class `Classifier`
  Parameters:
    `instance` - the instance to be classified
  Returns:
    index of the predicted class
  Throws:
    `java.lang.Exception` - if an error occurred during the prediction

### distributionForInstance

    public double[] distributionForInstance(Instance instance)
                                     throws java.lang.Exception

  Calculates the class membership probabilities for the given test instance.

  Overrides:
    `distributionForInstance` in class `Classifier`
  Parameters:
    `instance` - the instance to be classified
  Returns:
    predicted class probability distribution
  Throws:
    `java.lang.Exception` - if class is numeric

### toString

    public java.lang.String toString()

  Returns a description of the classifier.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a description of the classifier as a string.

### getRevision

    public java.lang.String getRevision()

  Returns the revision string.

  Specified by:
    `getRevision` in interface `RevisionHandler`
  Overrides:
    `getRevision` in class `Classifier`
  Returns:
    the revision

### main

    public static void main(java.lang.String[] args)

  Main method for testing this class.

  Parameters:
    `args` - the options

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home | Weka's home | Weka's home | Weka's home | Weka's home | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD