|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.experiment.AveragingResultProducer
AveragingResultProducer takes the results from a ResultProducer and submits the average to the result listener. For non-numeric result fields, the first value is used.
Field Summary | |
protected java.lang.String[] |
m_AdditionalMeasures
The names of any additional measures to look for in SplitEvaluators |
protected boolean |
m_CalculateStdDevs
True if standard deviation fields should be produced |
protected java.lang.String |
m_CountFieldName
The name of the field that will contain the number of results averaged over. |
protected int |
m_ExpectedResultsPerAverage
The number of results expected to average over for each run |
protected Instances |
m_Instances
The dataset of interest |
protected java.lang.String |
m_KeyFieldName
The name of the key field to average over |
protected int |
m_KeyIndex
The index of the field to average over in the resultproducers key |
protected FastVector |
m_Keys
Collects the keys from a single run |
protected ResultListener |
m_ResultListener
The ResultListener to send results to |
protected ResultProducer |
m_ResultProducer
The ResultProducer used to generate results |
protected FastVector |
m_Results
Collects the results from a single run |
Constructor Summary | |
AveragingResultProducer()
|
Method Summary | |
void |
acceptResult(ResultProducer rp,
java.lang.Object[] key,
java.lang.Object[] result)
Accepts results from a ResultProducer. |
java.lang.String |
calculateStdDevsTipText()
Returns the tip text for this property |
protected void |
checkForDuplicateKeys(java.lang.Object[] template)
Checks whether any duplicate results (with respect to a key template) were received. |
protected void |
checkForMultipleDifferences()
Checks that the keys for a run only differ in one key field. |
java.lang.String[] |
determineColumnConstraints(ResultProducer rp)
Determines if there are any constraints (imposed by the destination) on the result columns to be produced by resultProducers. |
protected java.lang.Object[] |
determineTemplate(int run)
Simulates a run to collect the keys the sub-resultproducer could generate. |
protected void |
doAverageResult(java.lang.Object[] template)
Asks the resultlistener whether an average result is required, and if so, calculates it. |
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 |
expectedResultsPerAverageTipText()
Returns the tip text for this property |
protected int |
findKeyIndex()
Scans through the key field names of the result producer to find the index of the key field to average over. |
boolean |
getCalculateStdDevs()
Get the value of CalculateStdDevs. |
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). |
int |
getExpectedResultsPerAverage()
Get the value of ExpectedResultsPerAverage. |
java.lang.String |
getKeyFieldName()
Get the value of KeyFieldName. |
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 |
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.lang.String |
keyFieldNameTipText()
Returns the tip text for this property |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options.. |
protected boolean |
matchesTemplate(java.lang.Object[] template,
java.lang.Object[] test)
Compares a key to a template to see whether they match. |
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 |
setCalculateStdDevs(boolean newCalculateStdDevs)
Set the value of CalculateStdDevs. |
void |
setExpectedResultsPerAverage(int newExpectedResultsPerAverage)
Set the value of ExpectedResultsPerAverage. |
void |
setInstances(Instances instances)
Sets the dataset that results will be obtained for. |
void |
setKeyFieldName(java.lang.String newKeyFieldName)
Set the value of KeyFieldName. |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Instances m_Instances
protected ResultListener m_ResultListener
protected ResultProducer m_ResultProducer
protected java.lang.String[] m_AdditionalMeasures
protected int m_ExpectedResultsPerAverage
protected boolean m_CalculateStdDevs
protected java.lang.String m_CountFieldName
protected java.lang.String m_KeyFieldName
protected int m_KeyIndex
protected FastVector m_Keys
protected FastVector m_Results
Constructor Detail |
public AveragingResultProducer()
Method Detail |
public java.lang.String globalInfo()
protected int findKeyIndex()
public java.lang.String[] determineColumnConstraints(ResultProducer rp) throws java.lang.Exception
determineColumnConstraints
in interface ResultListener
rp
- the ResultProducer to which the constraints will apply
java.lang.Exception
- if constraints can't be determinedprotected java.lang.Object[] determineTemplate(int run) throws java.lang.Exception
run
- the run number
java.lang.Exception
- if an error occurspublic 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 resultsprotected boolean matchesTemplate(java.lang.Object[] template, java.lang.Object[] test)
template
- the template to match againsttest
- the key to test
protected void doAverageResult(java.lang.Object[] template) throws java.lang.Exception
template
- the template to match keys against when calculating the
average
java.lang.Exception
- if an error occursprotected void checkForDuplicateKeys(java.lang.Object[] template) throws java.lang.Exception
template
- the template key.
java.lang.Exception
- if duplicate results are detectedprotected void checkForMultipleDifferences() throws java.lang.Exception
java.lang.Exception
- if the keys differ on fields other than the
key averaging fieldpublic void preProcess(ResultProducer rp) throws java.lang.Exception
preProcess
in interface ResultListener
rp
- the ResultProducer that will generate the results
java.lang.Exception
- if an error occurs during preprocessing.public void preProcess() throws java.lang.Exception
preProcess
in interface ResultProducer
java.lang.Exception
- if an error occurs during preprocessing.public void postProcess(ResultProducer rp) throws java.lang.Exception
postProcess
in interface ResultListener
rp
- the ResultProducer that generated the results
java.lang.Exception
- if an error occurspublic 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
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
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 compatibilityState
java.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 key names cannot be generatedpublic java.lang.Object[] getKeyTypes() throws java.lang.Exception
getKeyTypes
in interface ResultProducer
java.lang.Exception
- if the key types could not be determined (perhaps
because of a problem from a nested sub-resultproducer)public java.lang.String[] getResultNames() throws java.lang.Exception
getResultNames
in interface ResultProducer
java.lang.Exception
- if the result names could not be determined (perhaps
because of a problem from a nested sub-resultproducer)public java.lang.Object[] getResultTypes() throws java.lang.Exception
getResultTypes
in interface ResultProducer
java.lang.Exception
- if the result types could not be determined (perhaps
because of a problem from a nested sub-resultproducer)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 name
The field name that will be unique for a run (default "Fold")
-X num_results
The expected number of results per run. (default 10)
-S
Calculate standard deviations. (default only averages)
-W classname
Specify the full class name of the result producer.
All option after -- will be passed to the result producer.
setOptions
in interface OptionHandler
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
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 value
java.lang.IllegalArgumentException
- if the named measure is not supportedpublic void setInstances(Instances instances)
setInstances
in interface ResultProducer
instances
- a value of type 'Instances'.public java.lang.String calculateStdDevsTipText()
public boolean getCalculateStdDevs()
public void setCalculateStdDevs(boolean newCalculateStdDevs)
newCalculateStdDevs
- Value to assign to CalculateStdDevs.public java.lang.String expectedResultsPerAverageTipText()
public int getExpectedResultsPerAverage()
public void setExpectedResultsPerAverage(int newExpectedResultsPerAverage)
newExpectedResultsPerAverage
- Value to assign to
ExpectedResultsPerAverage.public java.lang.String keyFieldNameTipText()
public java.lang.String getKeyFieldName()
public void setKeyFieldName(java.lang.String newKeyFieldName)
newKeyFieldName
- Value to assign to KeyFieldName.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()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |