public abstract class AbstractClassifier extends Object implements Classifier, BatchPredictor, Cloneable, Serializable, OptionHandler, CapabilitiesHandler, RevisionHandler, CapabilitiesIgnorer, CommandlineRunnable
| Modifier and Type | Field and Description |
|---|---|
static int |
NUM_DECIMAL_PLACES_DEFAULT
The number of decimal places used when printing numbers in the model.
|
| Constructor and Description |
|---|
AbstractClassifier() |
| Modifier and Type | Method and Description |
|---|---|
String |
batchSizeTipText()
Returns the tip text for this property
|
double |
classifyInstance(Instance instance)
Classifies the given test instance.
|
String |
debugTipText()
Returns the tip text for this property
|
double[] |
distributionForInstance(Instance instance)
Predicts the class memberships for a given instance.
|
double[][] |
distributionsForInstances(Instances batch)
Batch prediction method.
|
String |
doNotCheckCapabilitiesTipText()
Returns the tip text for this property
|
static Classifier |
forName(String classifierName,
String[] options)
Creates a new instance of a classifier given it's class name and (optional)
arguments to pass to it's setOptions method.
|
String |
getBatchSize()
Get the preferred batch size for batch prediction.
|
Capabilities |
getCapabilities()
Returns the Capabilities of this classifier.
|
boolean |
getDebug()
Get whether debugging is turned on.
|
boolean |
getDoNotCheckCapabilities()
Get whether capabilities checking is turned off.
|
int |
getNumDecimalPlaces()
Get the number of decimal places.
|
String[] |
getOptions()
Gets the current settings of the Classifier.
|
String |
getRevision()
Returns the revision string.
|
boolean |
implementsMoreEfficientBatchPrediction()
Return true if this classifier can generate batch predictions in an
efficient manner.
|
Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static Classifier[] |
makeCopies(Classifier model,
int num)
Creates a given number of deep copies of the given classifier using
serialization.
|
static Classifier |
makeCopy(Classifier model)
Creates a deep copy of the given classifier using serialization.
|
String |
numDecimalPlacesTipText()
Returns the tip text for this property
|
void |
postExecution()
Perform any teardown stuff that might need to happen after execution.
|
void |
preExecution()
Perform any setup stuff that might need to happen before commandline
execution.
|
void |
run(Object toRun,
String[] options)
Execute the supplied object.
|
static void |
runClassifier(Classifier classifier,
String[] options)
runs the classifier instance with the given options.
|
void |
setBatchSize(String size)
Set the preferred batch size for batch prediction.
|
void |
setDebug(boolean debug)
Set debugging mode.
|
void |
setDoNotCheckCapabilities(boolean doNotCheckCapabilities)
Set whether not to check capabilities.
|
void |
setNumDecimalPlaces(int num)
Set the number of decimal places.
|
void |
setOptions(String[] options)
Parses a given list of options.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuildClassifierpublic static int NUM_DECIMAL_PLACES_DEFAULT
public static Classifier forName(String classifierName, String[] options) throws Exception
classifierName - the fully qualified class name of the classifieroptions - an array of options suitable for passing to setOptions. May
be null.Exception - if the classifier name is invalid, or the options
supplied are not acceptable to the classifierpublic static Classifier makeCopy(Classifier model) throws Exception
model - the classifier to copyException - if an error occurspublic static Classifier[] makeCopies(Classifier model, int num) throws Exception
model - the classifier to copynum - the number of classifier copies to create.Exception - if an error occurspublic static void runClassifier(Classifier classifier, String[] options)
classifier - the classifier to runoptions - the commandline optionspublic double classifyInstance(Instance instance) throws Exception
classifyInstance in interface Classifierinstance - the instance to be classifiedException - if an error occurred during the predictionpublic double[] distributionForInstance(Instance instance) throws Exception
distributionForInstance in interface Classifierinstance - the instance to be classifiedException - if distribution could not be computed successfullypublic Enumeration<Option> listOptions()
listOptions in interface OptionHandlerpublic String[] getOptions()
getOptions in interface OptionHandlerpublic void setOptions(String[] options) throws Exception
-D
If set, classifier is run in debug mode and may output additional info to
the console.
-do-not-check-capabilities
If set, classifier capabilities are not checked before classifier is built
(use with caution).
setOptions in interface OptionHandleroptions - the list of options as an array of stringsException - if an option is not supportedpublic boolean getDebug()
public void setDebug(boolean debug)
debug - true if debug output should be printedpublic String debugTipText()
public boolean getDoNotCheckCapabilities()
getDoNotCheckCapabilities in interface CapabilitiesIgnorerpublic void setDoNotCheckCapabilities(boolean doNotCheckCapabilities)
setDoNotCheckCapabilities in interface CapabilitiesIgnorerdoNotCheckCapabilities - true if capabilities are not to be checked.public String doNotCheckCapabilitiesTipText()
public String numDecimalPlacesTipText()
public int getNumDecimalPlaces()
public void setNumDecimalPlaces(int num)
public String batchSizeTipText()
public void setBatchSize(String size)
setBatchSize in interface BatchPredictorsize - the batch size to usepublic String getBatchSize()
getBatchSize in interface BatchPredictorpublic boolean implementsMoreEfficientBatchPrediction()
implementsMoreEfficientBatchPrediction in interface BatchPredictorpublic double[][] distributionsForInstances(Instances batch) throws Exception
distributionsForInstances in interface BatchPredictorbatch - the instances to get predictions forException - if a problem occurs.public Capabilities getCapabilities()
getCapabilities in interface ClassifiergetCapabilities in interface CapabilitiesHandlerCapabilitiespublic String getRevision()
getRevision in interface RevisionHandlerpublic void preExecution()
throws Exception
preExecution in interface CommandlineRunnableException - if a problem occurs during setuppublic void run(Object toRun, String[] options) throws Exception
run in interface CommandlineRunnabletoRun - the object to executeoptions - any options to pass to the objectException - if the object is not of the expected type.public void postExecution()
throws Exception
postExecution in interface CommandlineRunnableException - if a problem occurs during teardownCopyright © 2016 University of Waikato, Hamilton, NZ. All Rights Reserved.