public class DatabaseResultProducer extends DatabaseResultListener implements ResultProducer, OptionHandler, AdditionalMeasureProducer
-F <field name> The name of the database field to cache over. eg: "Fold" (default none)
-W <class name> The full class name of a ResultProducer. eg: weka.experiment.CrossValidationResultProducer
Options specific to result producer weka.experiment.CrossValidationResultProducer:
-X <number of folds> The number of folds to use for the cross-validation. (default 10)
-D Save raw split evaluator output.
-O <file/directory name/path> The filename where raw output will be stored. If a directory name is specified then then individual outputs will be gzipped, otherwise all output will be zipped to the named file. Use in conjuction with -D. (default splitEvalutorOut.zip)
-W <class name> The full class name of a SplitEvaluator. eg: weka.experiment.ClassifierSplitEvaluator
Options specific to split evaluator weka.experiment.ClassifierSplitEvaluator:
-W <class name> The full class name of the classifier. eg: weka.classifiers.bayes.NaiveBayes
-C <index> The index of the class for which IR statistics are to be output. (default 1)
-I <index> The index of an attribute to output in the results. This attribute should identify an instance in order to know which instances are in the test set of a cross validation. if 0 no output (default 0).
-P Add target and prediction columns to the result for each fold.
Options specific to classifier weka.classifiers.rules.ZeroR:
-D If set, classifier is run in debug mode and may output additional info to the console
BOOL, BYTE, DATE, DOUBLE, EXP_INDEX_TABLE, EXP_RESULT_COL, EXP_RESULT_PREFIX, EXP_SETUP_COL, EXP_TYPE_COL, FLOAT, INTEGER, LONG, PROPERTY_FILE, SHORT, STRING, TEXT, TIME, TIMESTAMP
Constructor and Description |
---|
DatabaseResultProducer()
Creates the DatabaseResultProducer, letting the parent constructor do it's
thing.
|
Modifier and Type | Method and Description |
---|---|
void |
acceptResult(ResultProducer rp,
java.lang.Object[] key,
java.lang.Object[] result)
Accepts results from a ResultProducer.
|
void |
doRun(int run)
Gets the results for a specified run number.
|
void |
doRunKeys(int run)
Gets the keys for a specified run number.
|
java.util.Enumeration |
enumerateMeasures()
Returns an enumeration of any additional measure names that might be in the
result producer
|
java.lang.String |
getCompatibilityState()
Gets a description of the internal settings of the result producer,
sufficient for distinguishing a ResultProducer instance from another with
different settings (ignoring those settings set through this interface).
|
java.lang.String[] |
getKeyNames()
Gets the names of each of the columns produced for a single run.
|
java.lang.Object[] |
getKeyTypes()
Gets the data types of each of the columns produced for a single run.
|
double |
getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure
|
java.lang.String[] |
getOptions()
Gets the current settings of the result producer.
|
java.lang.String[] |
getResultNames()
Gets the names of each of the columns produced for a single run.
|
ResultProducer |
getResultProducer()
Get the ResultProducer.
|
java.lang.Object[] |
getResultTypes()
Gets the data types of each of the columns produced for a single run.
|
java.lang.String |
getRevision()
Returns the revision string.
|
java.lang.String |
globalInfo()
Returns a string describing this result producer
|
boolean |
isResultRequired(ResultProducer rp,
java.lang.Object[] key)
Determines whether the results for a specified key must be generated.
|
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options..
|
void |
postProcess()
When this method is called, it indicates that no more requests to generate
results for the current experiment will be sent.
|
void |
postProcess(ResultProducer rp)
When this method is called, it indicates that no more results will be sent
that need to be grouped together in any way.
|
void |
preProcess()
Prepare to generate results.
|
void |
preProcess(ResultProducer rp)
Prepare for the results to be received.
|
java.lang.String |
resultProducerTipText()
Returns the tip text for this property
|
void |
setAdditionalMeasures(java.lang.String[] additionalMeasures)
Set a list of method names for additional measures to look for in
SplitEvaluators.
|
void |
setInstances(Instances instances)
Sets the dataset that results will be obtained for.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setResultListener(ResultListener listener)
Sets the object to send results of each run to.
|
void |
setResultProducer(ResultProducer newResultProducer)
Set the ResultProducer.
|
java.lang.String |
toString()
Gets a text descrption of the result producer.
|
cacheKeyNameTipText, determineColumnConstraints, getCacheKeyName, setCacheKeyName
arrayToString, close, close, connectToDatabase, createExperimentIndex, createExperimentIndexEntry, createResultsTable, databaseURLTipText, debugTipText, disconnectFromDatabase, execute, experimentIndexExists, getDatabaseURL, getDebug, getKeywords, getKeywordsMaskChar, getPassword, getResultFromTable, getResultSet, getResultsTableName, getSupportedCursorScrollType, getUsername, isConnected, isCursorScrollable, isCursorScrollSensitive, isKeyword, maskKeyword, passwordTipText, processKeyString, putResultInTable, select, setDatabaseURL, setDebug, setKeywords, setKeywordsMaskChar, setPassword, setUsername, tableExists, translateDBColumnType, typeName, update, usernameTipText
public DatabaseResultProducer() throws java.lang.Exception
java.lang.Exception
- if an error occurspublic java.lang.String globalInfo()
globalInfo
in class DatabaseResultListener
public void doRunKeys(int run) throws java.lang.Exception
doRunKeys
in interface ResultProducer
run
- the run number to get keys for.java.lang.Exception
- if a problem occurs while getting the keyspublic void doRun(int run) throws java.lang.Exception
doRun
in interface ResultProducer
run
- the run number to get results for.java.lang.Exception
- if a problem occurs while getting the resultspublic void preProcess(ResultProducer rp) throws java.lang.Exception
preProcess
in interface ResultListener
preProcess
in class DatabaseResultListener
rp
- the ResultProducer that will generate the resultsjava.lang.Exception
- if an error occurs during preprocessing.public void postProcess(ResultProducer rp) throws java.lang.Exception
postProcess
in interface ResultListener
postProcess
in class DatabaseResultListener
rp
- the ResultProducer that generated the resultsjava.lang.Exception
- if an error occurspublic void preProcess() throws java.lang.Exception
preProcess
in interface ResultProducer
java.lang.Exception
- if an error occurs during preprocessing.public void postProcess() throws java.lang.Exception
postProcess
in interface ResultProducer
java.lang.Exception
- if an error occurspublic void acceptResult(ResultProducer rp, java.lang.Object[] key, java.lang.Object[] result) throws java.lang.Exception
acceptResult
in interface ResultListener
acceptResult
in class DatabaseResultListener
rp
- the ResultProducer that generated the resultskey
- an array of Objects (Strings or Doubles) that uniquely identify
a result for a given ResultProducer with given compatibilityStateresult
- the results stored in an array. The objects stored in the
array may be Strings, Doubles, or null (for the missing value).java.lang.Exception
- if the result could not be accepted.public boolean isResultRequired(ResultProducer rp, java.lang.Object[] key) throws java.lang.Exception
isResultRequired
in interface ResultListener
isResultRequired
in class DatabaseResultListener
rp
- the ResultProducer wanting to generate the resultskey
- an array of Objects (Strings or Doubles) that uniquely identify
a result for a given ResultProducer with given compatibilityStatejava.lang.Exception
- if it could not be determined if the result is needed.public java.lang.String[] getKeyNames() throws java.lang.Exception
getKeyNames
in interface ResultProducer
java.lang.Exception
- if something goes wrong.public java.lang.Object[] getKeyTypes() throws java.lang.Exception
getKeyTypes
in interface ResultProducer
java.lang.Exception
- if something goes wrong.public java.lang.String[] getResultNames() throws java.lang.Exception
getResultNames
in interface ResultProducer
java.lang.Exception
- if something goes wrong.public java.lang.Object[] getResultTypes() throws java.lang.Exception
getResultTypes
in interface ResultProducer
java.lang.Exception
- if something goes wrong.public java.lang.String getCompatibilityState()
getCompatibilityState
in interface ResultProducer
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-F <field name> The name of the database field to cache over. eg: "Fold" (default none)
-W <class name> The full class name of a ResultProducer. eg: weka.experiment.CrossValidationResultProducer
Options specific to result producer weka.experiment.CrossValidationResultProducer:
-X <number of folds> The number of folds to use for the cross-validation. (default 10)
-D Save raw split evaluator output.
-O <file/directory name/path> The filename where raw output will be stored. If a directory name is specified then then individual outputs will be gzipped, otherwise all output will be zipped to the named file. Use in conjuction with -D. (default splitEvalutorOut.zip)
-W <class name> The full class name of a SplitEvaluator. eg: weka.experiment.ClassifierSplitEvaluator
Options specific to split evaluator weka.experiment.ClassifierSplitEvaluator:
-W <class name> The full class name of the classifier. eg: weka.classifiers.bayes.NaiveBayes
-C <index> The index of the class for which IR statistics are to be output. (default 1)
-I <index> The index of an attribute to output in the results. This attribute should identify an instance in order to know which instances are in the test set of a cross validation. if 0 no output (default 0).
-P Add target and prediction columns to the result for each fold.
Options specific to classifier weka.classifiers.rules.ZeroR:
-D If set, classifier is run in debug mode and may output additional info to the consoleAll option after -- will be passed to the result producer.
setOptions
in interface OptionHandler
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
public void setAdditionalMeasures(java.lang.String[] additionalMeasures)
setAdditionalMeasures
in interface ResultProducer
additionalMeasures
- an array of measure names, null if nonepublic java.util.Enumeration enumerateMeasures()
enumerateMeasures
in interface AdditionalMeasureProducer
public double getMeasure(java.lang.String additionalMeasureName)
getMeasure
in interface AdditionalMeasureProducer
additionalMeasureName
- the name of the measure to query for its valuejava.lang.IllegalArgumentException
- if the named measure is not supportedpublic void setInstances(Instances instances)
setInstances
in interface ResultProducer
instances
- a value of type 'Instances'.public void setResultListener(ResultListener listener)
setResultListener
in interface ResultProducer
listener
- a value of type 'ResultListener'public java.lang.String resultProducerTipText()
public ResultProducer getResultProducer()
public void setResultProducer(ResultProducer newResultProducer)
newResultProducer
- new ResultProducer to use.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class DatabaseResultListener