Package weka.classifiers.functions
Class FakeClassifier
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.functions.FakeClassifier
-
- All Implemented Interfaces:
Serializable,Cloneable,weka.classifiers.Classifier,weka.classifiers.UpdateableClassifier,weka.core.BatchPredictor,weka.core.CapabilitiesHandler,weka.core.CapabilitiesIgnorer,weka.core.CommandlineRunnable,weka.core.OptionHandler,weka.core.Randomizable,weka.core.RevisionHandler
public class FakeClassifier extends weka.classifiers.AbstractClassifier implements weka.core.Randomizable, weka.classifiers.UpdateableClassifierFake classifier that requires no dataset for training and just outputs random values within the specified bounds.
Fake build and prediction times can be set as well.
Valid options are:
-seed <int> The seed value to use. (default: 1)
-build-wait <int> The number of msec for the classifier to idle at build time. (default: 0)
-update-wait <int> The number of msec for the classifier to idle at incremental build time. (default: 0)
-predict-wait <int> The number of msec for the classifier to idle at prediction time. (default: 0)
-predict-min <num> The minimum value to use for prediction. (default: 0.0)
-predict-max <num> The maximum value to use for prediction. (default: 1.0)
-output-debug-info 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).
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intm_BuildWaitthe build wait time in msec.protected doublem_PredictMaxthe maximum to use for the predictions.protected doublem_PredictMinthe minimum to use for the predictions.protected intm_PredictWaitthe predict wait time in msec.protected Randomm_Randomfor generating the random numbers.protected intm_Seedthe seed.protected intm_UpdateWaitthe update wait time in msec.
-
Constructor Summary
Constructors Constructor Description FakeClassifier()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildClassifier(weka.core.Instances data)Generates a classifier.StringbuildWaitTipText()Returns the tip text for this property.doubleclassifyInstance(weka.core.Instance instance)Classifies the given test instance.intgetBuildWait()Returns the time in msec to wait when calling buildClassifier.weka.core.CapabilitiesgetCapabilities()Returns the Capabilities of this classifier.String[]getOptions()returns the options of the current setupdoublegetPredictMax()Returns the maximum value to predict.doublegetPredictMin()Returns the minimum value to predict.intgetPredictWait()Returns the time in msec to wait when calling classifyInstance.protected RandomgetRandom()Returns the random number generator to use.StringgetRevision()Returns the revision string.intgetSeed()Returns the seed value for the random values.intgetUpdateWait()Returns the time in msec to wait when calling updateClassifier.StringglobalInfo()Returns a string describing classifierEnumerationlistOptions()Gets an enumeration describing the available options.static voidmain(String[] args)Main method for running this class.StringpredictMaxTipText()Returns the tip text for this property.StringpredictMinTipText()Returns the tip text for this property.StringpredictWaitTipText()Returns the tip text for this property.StringseedTipText()Returns the tip text for this property.voidsetBuildWait(int value)Sets the time in msec to wait when calling buildClassifier.voidsetOptions(String[] options)Parses the options for this object.voidsetPredictMax(double value)Sets the maximum value to predict.voidsetPredictMin(double value)Sets the minimum value to predict.voidsetPredictWait(int value)Sets the time in msec to wait when calling classifyInstance.voidsetSeed(int value)Sets the seed value for the random values.voidsetUpdateWait(int value)Sets the time in msec to wait when calling updateClassifier.StringtoString()Returns a string representation of the built model.voidupdateClassifier(weka.core.Instance instance)Does nothing.StringupdateWaitTipText()Returns the tip text for this property.protected voidwait(int msec)Waits for a specified amount of time.-
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, debugTipText, distributionForInstance, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
-
-
-
Field Detail
-
m_Seed
protected int m_Seed
the seed.
-
m_BuildWait
protected int m_BuildWait
the build wait time in msec.
-
m_UpdateWait
protected int m_UpdateWait
the update wait time in msec.
-
m_PredictWait
protected int m_PredictWait
the predict wait time in msec.
-
m_PredictMin
protected double m_PredictMin
the minimum to use for the predictions.
-
m_PredictMax
protected double m_PredictMax
the maximum to use for the predictions.
-
m_Random
protected Random m_Random
for generating the random numbers.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing classifier- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration listOptions()
Gets an enumeration describing the available options.- Specified by:
listOptionsin interfaceweka.core.OptionHandler- Overrides:
listOptionsin classweka.classifiers.AbstractClassifier- Returns:
- an enumeration of all the available options.
-
getOptions
public String[] getOptions()
returns the options of the current setup- Specified by:
getOptionsin interfaceweka.core.OptionHandler- Overrides:
getOptionsin classweka.classifiers.AbstractClassifier- Returns:
- the current options
-
setOptions
public void setOptions(String[] options) throws Exception
Parses the options for this object.- Specified by:
setOptionsin interfaceweka.core.OptionHandler- Overrides:
setOptionsin classweka.classifiers.AbstractClassifier- Parameters:
options- the options to use- Throws:
Exception- if setting of options fails
-
setSeed
public void setSeed(int value)
Sets the seed value for the random values.- Specified by:
setSeedin interfaceweka.core.Randomizable- Parameters:
value- the seed
-
getSeed
public int getSeed()
Returns the seed value for the random values.- Specified by:
getSeedin interfaceweka.core.Randomizable- Returns:
- the seed
-
seedTipText
public String seedTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setBuildWait
public void setBuildWait(int value)
Sets the time in msec to wait when calling buildClassifier.- Parameters:
value- the time in msec
-
getBuildWait
public int getBuildWait()
Returns the time in msec to wait when calling buildClassifier.- Returns:
- the time in msec
-
buildWaitTipText
public String buildWaitTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setUpdateWait
public void setUpdateWait(int value)
Sets the time in msec to wait when calling updateClassifier.- Parameters:
value- the time in msec
-
getUpdateWait
public int getUpdateWait()
Returns the time in msec to wait when calling updateClassifier.- Returns:
- the time in msec
-
updateWaitTipText
public String updateWaitTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setPredictWait
public void setPredictWait(int value)
Sets the time in msec to wait when calling classifyInstance.- Parameters:
value- the time in msec
-
getPredictWait
public int getPredictWait()
Returns the time in msec to wait when calling classifyInstance.- Returns:
- the time in msec
-
predictWaitTipText
public String predictWaitTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setPredictMin
public void setPredictMin(double value)
Sets the minimum value to predict.- Parameters:
value- the minimum value
-
getPredictMin
public double getPredictMin()
Returns the minimum value to predict.- Returns:
- the minimum value
-
predictMinTipText
public String predictMinTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setPredictMax
public void setPredictMax(double value)
Sets the maximum value to predict.- Parameters:
value- the maximum value
-
getPredictMax
public double getPredictMax()
Returns the maximum value to predict.- Returns:
- the maximum value
-
predictMaxTipText
public String predictMaxTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns the Capabilities of this classifier. Maximally permissive capabilities are allowed by default. Derived classifiers should override this method and first disable all capabilities and then enable just those capabilities that make sense for the scheme.- Specified by:
getCapabilitiesin interfaceweka.core.CapabilitiesHandler- Specified by:
getCapabilitiesin interfaceweka.classifiers.Classifier- Overrides:
getCapabilitiesin classweka.classifiers.AbstractClassifier- Returns:
- the capabilities of this object
- See Also:
Capabilities
-
wait
protected void wait(int msec)
Waits for a specified amount of time.- Parameters:
msec- the time in msec to wait
-
buildClassifier
public void buildClassifier(weka.core.Instances data) throws ExceptionGenerates a classifier.- Specified by:
buildClassifierin interfaceweka.classifiers.Classifier- Parameters:
data- set of instances serving as training data- Throws:
Exception- if the classifier has not been generated successfully
-
getRandom
protected Random getRandom()
Returns the random number generator to use.- Returns:
- the random number generator
-
updateClassifier
public void updateClassifier(weka.core.Instance instance) throws ExceptionDoes nothing.- Specified by:
updateClassifierin interfaceweka.classifiers.UpdateableClassifier- Parameters:
instance-- Throws:
Exception
-
classifyInstance
public double classifyInstance(weka.core.Instance instance) throws ExceptionClassifies the given test instance. The instance has to belong to a dataset when it's being classified.- Specified by:
classifyInstancein interfaceweka.classifiers.Classifier- Overrides:
classifyInstancein classweka.classifiers.AbstractClassifier- Parameters:
instance- the instance to be classified- Returns:
- the predicted most likely class for the instance or Instance.missingValue() if no prediction is made
- Throws:
Exception- if an error occurred during the prediction
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceweka.core.RevisionHandler- Overrides:
getRevisionin classweka.classifiers.AbstractClassifier- Returns:
- the revision
-
toString
public String toString()
Returns a string representation of the built model.
-
main
public static void main(String[] args)
Main method for running this class.- Parameters:
args- the commandline parameters
-
-