|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.JythonClassifier
public class JythonClassifier
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 consoleOptions after "--" will be passed onto the Jython module. Partially based on this code.
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 |
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 |
---|
public JythonClassifier()
Method Detail |
---|
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 strings
java.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 data
java.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 classified
java.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 classified
java.lang.Exception
- if class is numericpublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
args
- the options
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |