Class Predictions
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.tools.wekainvestigator.output.AbstractOutputGenerator<ResultItem>
-
- adams.gui.tools.wekainvestigator.tab.classifytab.output.AbstractOutputGenerator
-
- adams.gui.tools.wekainvestigator.tab.classifytab.output.Predictions
-
- All Implemented Interfaces:
adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.SizeOfHandler
,Serializable
public class Predictions extends AbstractOutputGenerator
Displays the predictions.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
INSTANCE_INDEX
protected boolean
m_AddLabelIndex
whether to prefix the labels with a 1-based index (only nominal classes).protected int
m_LastID
the ID of the last dataset selected.protected boolean
m_ShowDistribution
whether to output the class distribution (only nominal classes).protected boolean
m_ShowError
whether to add an error colunm.protected boolean
m_ShowProbability
whether to output the probability of the prediction (only nominal classes).protected boolean
m_ShowRelativeError
whether to add a relative error column (numeric class only).protected boolean
m_ShowWeight
whether to output the weight as well.protected boolean
m_UseAbsoluteError
whether to use absolute errors.
-
Constructor Summary
Constructors Constructor Description Predictions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
addLabelIndexTipText()
Returns the tip text for this property.boolean
canGenerateOutput(ResultItem item)
Checks whether output can be generated from this item.JComponent
createOutput(ResultItem item, adams.core.MessageCollection errors)
Generates output from the item.protected TableContentPanel
createOutput(ResultItem item, weka.classifiers.Evaluation eval, int[] originalIndices, adams.data.spreadsheet.SpreadSheet additionalAttributes, adams.core.MessageCollection errors)
Generates the output from the evaluation.void
defineOptions()
Adds options to the internal list of options.protected int
determineLastSelectedRow(ClassifyTab tab)
Determines the last selected row.boolean
getAddLabelIndex()
Returns whether to show the error as well.boolean
getShowDistribution()
Returns whether to show the class distribution as well.boolean
getShowError()
Returns whether to show the error as well.boolean
getShowProbability()
Returns whether to show the probability as well.boolean
getShowRelativeError()
Returns whether to show the relative error as well.boolean
getShowWeight()
Returns whether to show the weight as well.String
getTitle()
The title to use for the tab.boolean
getUseAbsoluteError()
Returns whether to use an absolute error (ie no direction).String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.protected void
removeData(ResultItem item, adams.data.spreadsheet.SpreadSheet data)
Removes the instances from the current dataset.void
setAddLabelIndex(boolean value)
Sets whether to prefix the labels with the index.void
setShowDistribution(boolean value)
Sets whether to show the class distribution as well.void
setShowError(boolean value)
Sets whether to show the error as well.void
setShowProbability(boolean value)
Sets whether to show the probability of the prediction as well.void
setShowRelativeError(boolean value)
Sets whether to show the relative error as well.void
setShowWeight(boolean value)
Sets whether to show the weight as well.void
setUseAbsoluteError(boolean value)
Sets whether to use an absolute error (ie no direction).String
showDistributionTipText()
Returns the tip text for this property.String
showErrorTipText()
Returns the tip text for this property.String
showProbabilityTipText()
Returns the tip text for this property.String
showRelativeErrorTipText()
Returns the tip text for this property.String
showWeightTipText()
Returns the tip text for this property.String
useAbsoluteErrorTipText()
Returns the tip text for this property.-
Methods inherited from class adams.gui.tools.wekainvestigator.tab.classifytab.output.AbstractOutputGenerator
addPage, newMultiPagePane
-
Methods inherited from class adams.gui.tools.wekainvestigator.output.AbstractOutputGenerator
addTab, generateOutput
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
INSTANCE_INDEX
public static final String INSTANCE_INDEX
- See Also:
- Constant Field Values
-
m_AddLabelIndex
protected boolean m_AddLabelIndex
whether to prefix the labels with a 1-based index (only nominal classes).
-
m_ShowError
protected boolean m_ShowError
whether to add an error colunm.
-
m_ShowRelativeError
protected boolean m_ShowRelativeError
whether to add a relative error column (numeric class only).
-
m_UseAbsoluteError
protected boolean m_UseAbsoluteError
whether to use absolute errors.
-
m_ShowProbability
protected boolean m_ShowProbability
whether to output the probability of the prediction (only nominal classes).
-
m_ShowDistribution
protected boolean m_ShowDistribution
whether to output the class distribution (only nominal classes).
-
m_ShowWeight
protected boolean m_ShowWeight
whether to output the weight as well.
-
m_LastID
protected int m_LastID
the ID of the last dataset selected.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.core.option.AbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.core.option.AbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classadams.core.option.AbstractOptionHandler
-
setAddLabelIndex
public void setAddLabelIndex(boolean value)
Sets whether to prefix the labels with the index.- Parameters:
value
- true if the label is prefixed with the index
-
getAddLabelIndex
public boolean getAddLabelIndex()
Returns whether to show the error as well.- Returns:
- true if the label is prefixed with the index
-
addLabelIndexTipText
public String addLabelIndexTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShowError
public void setShowError(boolean value)
Sets whether to show the error as well.- Parameters:
value
- true if the error is to be displayed as well
-
getShowError
public boolean getShowError()
Returns whether to show the error as well.- Returns:
- true if the error is displayed as well
-
showErrorTipText
public String showErrorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShowRelativeError
public void setShowRelativeError(boolean value)
Sets whether to show the relative error as well.- Parameters:
value
- true if the relative error is to be displayed as well
-
getShowRelativeError
public boolean getShowRelativeError()
Returns whether to show the relative error as well.- Returns:
- true if the relative error is displayed as well
-
showRelativeErrorTipText
public String showRelativeErrorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUseAbsoluteError
public void setUseAbsoluteError(boolean value)
Sets whether to use an absolute error (ie no direction).- Parameters:
value
- true if to use absolute error
-
getUseAbsoluteError
public boolean getUseAbsoluteError()
Returns whether to use an absolute error (ie no direction).- Returns:
- true if to use absolute error
-
useAbsoluteErrorTipText
public String useAbsoluteErrorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShowProbability
public void setShowProbability(boolean value)
Sets whether to show the probability of the prediction as well.- Parameters:
value
- true if the probability is to be displayed as well
-
getShowProbability
public boolean getShowProbability()
Returns whether to show the probability as well.- Returns:
- true if the probability is displayed as well
-
showProbabilityTipText
public String showProbabilityTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShowDistribution
public void setShowDistribution(boolean value)
Sets whether to show the class distribution as well.- Parameters:
value
- true if the class distribution is to be displayed as well
-
getShowDistribution
public boolean getShowDistribution()
Returns whether to show the class distribution as well.- Returns:
- true if the class distribution is displayed as well
-
showDistributionTipText
public String showDistributionTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShowWeight
public void setShowWeight(boolean value)
Sets whether to show the weight as well.- Parameters:
value
- true if the weight is to be displayed as well
-
getShowWeight
public boolean getShowWeight()
Returns whether to show the weight as well.- Returns:
- true if the weight is displayed as well
-
showWeightTipText
public String showWeightTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getTitle
public String getTitle()
The title to use for the tab.- Specified by:
getTitle
in classAbstractOutputGenerator<ResultItem>
- Returns:
- the title
-
canGenerateOutput
public boolean canGenerateOutput(ResultItem item)
Checks whether output can be generated from this item.- Specified by:
canGenerateOutput
in classAbstractOutputGenerator<ResultItem>
- Parameters:
item
- the item to check- Returns:
- true if output can be generated
-
createOutput
protected TableContentPanel createOutput(ResultItem item, weka.classifiers.Evaluation eval, int[] originalIndices, adams.data.spreadsheet.SpreadSheet additionalAttributes, adams.core.MessageCollection errors)
Generates the output from the evaluation.- Parameters:
eval
- the evaluation to useoriginalIndices
- the original indices, can be nulladditionalAttributes
- the additional attributes to use, can be nullerrors
- for collecting error messages- Returns:
- the generated output
-
createOutput
public JComponent createOutput(ResultItem item, adams.core.MessageCollection errors)
Generates output from the item.- Specified by:
createOutput
in classAbstractOutputGenerator<ResultItem>
- Parameters:
item
- the item to generate output forerrors
- for collecting error messages- Returns:
- the output component, null if failed to generate
-
determineLastSelectedRow
protected int determineLastSelectedRow(ClassifyTab tab)
Determines the last selected row.- Parameters:
tab
- the classify tab to obtain the data from- Returns:
- the last selected row (0 by default)
-
removeData
protected void removeData(ResultItem item, adams.data.spreadsheet.SpreadSheet data)
Removes the instances from the current dataset.- Parameters:
data
- the data points to remove
-
-