adams.data.conversion
Class WekaPredictionContainerToSpreadSheet

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.data.conversion.AbstractConversion
              extended by adams.data.conversion.WekaPredictionContainerToSpreadSheet
All Implemented Interfaces:
CleanUpHandler, Debuggable, Destroyable, OptionHandler, ShallowCopySupporter<AbstractConversion>, SizeOfHandler, Conversion, Serializable

public class WekaPredictionContainerToSpreadSheet
extends AbstractConversion

Turns a WEKA prediction container into a SpreadSheet object.

Valid options are:

-D <int> (property: debugLevel)
    The greater the number the more additional info the scheme may output to
    the console (0 = off).
    default: 0
    minimum: 0
 
-title-name-column <java.lang.String> (property: titleNameColumn)
    The title of the first column.
    default: Name
 
-title-value-column <java.lang.String> (property: titleValueColumn)
    The title of the second column.
    default: Value
 
-add-classification (property: addClassification)
    If enabled, then the numeric classification (index of class label for nominal
    classes) is added to the spreadsheet.
 
-classification-entry <java.lang.String> (property: classificationEntry)
    The value to use in the 'Name' column for the numeric classification.
    default: Classification
 
-add-classification-label (property: addClassificationLabel)
    If enabled, then the classification label (only for nominal classes) is
    added to the spreadsheet.
 
-classification-label-entry <java.lang.String> (property: classificationLabelEntry)
    The value to use in the 'Name' column for the classification label.
    default: Class
 
-add-distribution (property: addDistribution)
    If enabled, then the class distribution (only for nominal classes) is added
    to the spreadsheet.
 
-distribution-format <java.lang.String> (property: distributionFormat)
    The format to use in the 'Name' column for the class distribution; '{INDEX
    }' can be used for the 1-based index, '{LABEL}' can be used for the class
    label (if available; if not, the 1-based index is used instead)
    default: {LABEL}
 
-distribution-sorting <NONE|DESCENDING|ASCENDING> (property: distributionSorting)
    The type of sorting to apply to the distribution array.
    default: NONE
 

Version:
$Revision: 4584 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Nested Class Summary
static class WekaPredictionContainerToSpreadSheet.SortContainer
          Helper class for sorting the distribution.
static class WekaPredictionContainerToSpreadSheet.Sorting
          How to sort the distribution.
 
Field Summary
static String COLUMN_NAME
          the name column in the spreadsheet.
static String COLUMN_VALUE
          the value column in the spreadsheet.
protected  boolean m_AddClassification
          whether to add the numeric classification to the output.
protected  boolean m_AddClassificationLabel
          whether to add the classification label to the output (nominal classes only).
protected  boolean m_AddDistribution
          whether to add the distribution to the output (nominal classes only).
protected  String m_ClassificationEntry
          the entry to use for the numeric classification in the spreadsheet.
protected  String m_ClassificationLabelEntry
          the entry to use for the classification label in the spreadsheet.
protected  String m_DistributionFormat
          the format to use for the distribution entries in the spreadsheet.
protected  WekaPredictionContainerToSpreadSheet.Sorting m_DistributionSorting
          the type of sorting to apply to the distribution array (if applicable).
protected  String m_TitleNameColumn
          the title of the name column.
protected  String m_TitleValueColumn
          the title of the value column.
static String PLACEHOLDER_INDEX
          the placeholder for the class index in the distribution format.
static String PLACEHOLDER_LABEL
          the placeholder for the class label in the distribution format.
 
Fields inherited from class adams.data.conversion.AbstractConversion
m_Input, m_Output, m_Owner
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
WekaPredictionContainerToSpreadSheet()
           
 
Method Summary
 Class accepts()
          Returns the class that is accepted as input.
 String addClassificationLabelTipText()
          Returns the tip text for this property.
 String addClassificationTipText()
          Returns the tip text for this property.
 String addDistributionTipText()
          Returns the tip text for this property.
 String classificationEntryTipText()
          Returns the tip text for this property.
 String classificationLabelEntryTipText()
          Returns the tip text for this property.
 void defineOptions()
          Adds options to the internal list of options.
 String distributionFormatTipText()
          Returns the tip text for this property.
 String distributionSortingTipText()
          Returns the tip text for this property.
protected  Object doConvert()
          Performs the actual conversion.
 Class generates()
          Returns the class that is generated as output.
 boolean getAddClassification()
          Returns whether to add the numeric classification (label index for nominal classes).
 boolean getAddClassificationLabel()
          Returns whether to add the classification label (only for nominal classes).
 boolean getAddDistribution()
          Returns whether to add the class distribution (only for nominal classes).
 String getClassificationEntry()
          Returns the value for the 'Name' column for the numeric classification.
 String getClassificationLabelEntry()
          Returns the value for the 'Name' column for the classification label.
 String getDistributionFormat()
          Returns the format for the 'Name' column for the numeric classification.
 WekaPredictionContainerToSpreadSheet.Sorting getDistributionSorting()
          Returns the format for the 'Name' column for the numeric classification.
 String getTitleNameColumn()
          Returns the title of the "Name" column, i.e., the first column.
 String getTitleValueColumn()
          Returns the title of the "Value" column, i.e., the first column.
 String globalInfo()
          Returns a string describing the object.
 void setAddClassification(boolean value)
          Sets whether to add the numeric classification (label index for nominal classes).
 void setAddClassificationLabel(boolean value)
          Sets whether to add the classification label (only for nominal classes).
 void setAddDistribution(boolean value)
          Sets whether to add the class distribution (only for nominal classes).
 void setClassificationEntry(String value)
          Sets the value for the 'Name' column for the numeric classification.
 void setClassificationLabelEntry(String value)
          Sets the value for the 'Name' column for the classification label.
 void setDistributionFormat(String value)
          Sets the format for the 'Name' column for the class distribution.
 void setDistributionSorting(WekaPredictionContainerToSpreadSheet.Sorting value)
          Sets the sorting for the distribution array.
 void setTitleNameColumn(String value)
          Sets the title of the "Name" column, i.e., the first column.
 void setTitleValueColumn(String value)
          Sets the title of the "Value" column, i.e., the first column.
 String titleNameColumnTipText()
          Returns the tip text for this property.
 String titleValueColumnTipText()
          Returns the tip text for this property.
 
Methods inherited from class adams.data.conversion.AbstractConversion
checkData, cleanUp, convert, getInput, getOutput, getOwner, reset, setInput, setOwner, shallowCopy, shallowCopy
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, destroy, finishInit, getDebugLevel, getOptionManager, initialize, isDebugOn, newOptionManager, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut, sizeOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PLACEHOLDER_LABEL

public static final String PLACEHOLDER_LABEL
the placeholder for the class label in the distribution format.

See Also:
Constant Field Values

PLACEHOLDER_INDEX

public static final String PLACEHOLDER_INDEX
the placeholder for the class index in the distribution format.

See Also:
Constant Field Values

COLUMN_NAME

public static final String COLUMN_NAME
the name column in the spreadsheet.

See Also:
Constant Field Values

COLUMN_VALUE

public static final String COLUMN_VALUE
the value column in the spreadsheet.

See Also:
Constant Field Values

m_TitleNameColumn

protected String m_TitleNameColumn
the title of the name column.


m_TitleValueColumn

protected String m_TitleValueColumn
the title of the value column.


m_AddClassification

protected boolean m_AddClassification
whether to add the numeric classification to the output.


m_ClassificationEntry

protected String m_ClassificationEntry
the entry to use for the numeric classification in the spreadsheet.


m_AddClassificationLabel

protected boolean m_AddClassificationLabel
whether to add the classification label to the output (nominal classes only).


m_ClassificationLabelEntry

protected String m_ClassificationLabelEntry
the entry to use for the classification label in the spreadsheet.


m_AddDistribution

protected boolean m_AddDistribution
whether to add the distribution to the output (nominal classes only).


m_DistributionFormat

protected String m_DistributionFormat
the format to use for the distribution entries in the spreadsheet.


m_DistributionSorting

protected WekaPredictionContainerToSpreadSheet.Sorting m_DistributionSorting
the type of sorting to apply to the distribution array (if applicable).

Constructor Detail

WekaPredictionContainerToSpreadSheet

public WekaPredictionContainerToSpreadSheet()
Method Detail

globalInfo

public String globalInfo()
Returns a string describing the object.

Specified by:
globalInfo in class 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 interface OptionHandler
Overrides:
defineOptions in class AbstractOptionHandler

setTitleNameColumn

public void setTitleNameColumn(String value)
Sets the title of the "Name" column, i.e., the first column.

Parameters:
value - the title

getTitleNameColumn

public String getTitleNameColumn()
Returns the title of the "Name" column, i.e., the first column.

Returns:
the title

titleNameColumnTipText

public String titleNameColumnTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setTitleValueColumn

public void setTitleValueColumn(String value)
Sets the title of the "Value" column, i.e., the first column.

Parameters:
value - the title

getTitleValueColumn

public String getTitleValueColumn()
Returns the title of the "Value" column, i.e., the first column.

Returns:
the title

titleValueColumnTipText

public String titleValueColumnTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setAddClassification

public void setAddClassification(boolean value)
Sets whether to add the numeric classification (label index for nominal classes).

Parameters:
value - true if to add numeric classification

getAddClassification

public boolean getAddClassification()
Returns whether to add the numeric classification (label index for nominal classes).

Returns:
true if numeric classification is added

addClassificationTipText

public String addClassificationTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setClassificationEntry

public void setClassificationEntry(String value)
Sets the value for the 'Name' column for the numeric classification.

Parameters:
value - the name

getClassificationEntry

public String getClassificationEntry()
Returns the value for the 'Name' column for the numeric classification.

Returns:
the name

classificationEntryTipText

public String classificationEntryTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setAddClassificationLabel

public void setAddClassificationLabel(boolean value)
Sets whether to add the classification label (only for nominal classes).

Parameters:
value - true if to add classification label

getAddClassificationLabel

public boolean getAddClassificationLabel()
Returns whether to add the classification label (only for nominal classes).

Returns:
true if classification label is added

addClassificationLabelTipText

public String addClassificationLabelTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setClassificationLabelEntry

public void setClassificationLabelEntry(String value)
Sets the value for the 'Name' column for the classification label.

Parameters:
value - the name

getClassificationLabelEntry

public String getClassificationLabelEntry()
Returns the value for the 'Name' column for the classification label.

Returns:
the name

classificationLabelEntryTipText

public String classificationLabelEntryTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setAddDistribution

public void setAddDistribution(boolean value)
Sets whether to add the class distribution (only for nominal classes).

Parameters:
value - true if to add class distribution

getAddDistribution

public boolean getAddDistribution()
Returns whether to add the class distribution (only for nominal classes).

Returns:
true if class distribution is added

addDistributionTipText

public String addDistributionTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setDistributionFormat

public void setDistributionFormat(String value)
Sets the format for the 'Name' column for the class distribution.

Parameters:
value - the format
See Also:
PLACEHOLDER_INDEX, PLACEHOLDER_LABEL

getDistributionFormat

public String getDistributionFormat()
Returns the format for the 'Name' column for the numeric classification.

Returns:
the format
See Also:
PLACEHOLDER_INDEX, PLACEHOLDER_LABEL

distributionFormatTipText

public String distributionFormatTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setDistributionSorting

public void setDistributionSorting(WekaPredictionContainerToSpreadSheet.Sorting value)
Sets the sorting for the distribution array.

Parameters:
value - the sorting

getDistributionSorting

public WekaPredictionContainerToSpreadSheet.Sorting getDistributionSorting()
Returns the format for the 'Name' column for the numeric classification.

Returns:
the format
See Also:
PLACEHOLDER_INDEX, PLACEHOLDER_LABEL

distributionSortingTipText

public String distributionSortingTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

accepts

public Class accepts()
Returns the class that is accepted as input.

Specified by:
accepts in interface Conversion
Specified by:
accepts in class AbstractConversion
Returns:
the class

generates

public Class generates()
Returns the class that is generated as output.

Specified by:
generates in interface Conversion
Specified by:
generates in class AbstractConversion
Returns:
the class

doConvert

protected Object doConvert()
                    throws Exception
Performs the actual conversion.

Specified by:
doConvert in class AbstractConversion
Returns:
the converted data
Throws:
Exception - if something goes wrong with the conversion


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.