public class JythonClassifier extends Classifier
-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 consoleOptions after "--" will be passed onto the Jython module. Partially based on this code.
Constructor and Description |
---|
JythonClassifier()
default constructor
|
Modifier and Type | Method and Description |
---|---|
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.
|
debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
public java.lang.String globalInfo()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public java.lang.String jythonModuleTipText()
public void setJythonModule(java.io.File value)
value
- the Jython modulepublic java.io.File getJythonModule()
public java.lang.String jythonOptionsTipText()
public void setJythonOptions(java.lang.String value)
value
- the optionspublic java.lang.String getJythonOptions()
public java.lang.String jythonPathsTipText()
public void setJythonPaths(java.lang.String value)
value
- the paths (comma-separated list)public java.lang.String getJythonPaths()
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Classifier
Capabilities
public void buildClassifier(Instances instances) throws java.lang.Exception
buildClassifier
in class Classifier
instances
- set of instances serving as training datajava.lang.Exception
- if the classifier has not been generated successfullypublic double classifyInstance(Instance instance) throws java.lang.Exception
classifyInstance
in class Classifier
instance
- the instance to be classifiedjava.lang.Exception
- if an error occurred during the predictionpublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance
in class Classifier
instance
- the instance to be classifiedjava.lang.Exception
- if class is numericpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Classifier
public static void main(java.lang.String[] args)
args
- the options