Package adams.data.conversion
Class WekaPredictionContainerToSpreadSheet
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.conversion.AbstractConversion
-
- adams.data.conversion.WekaPredictionContainerToSpreadSheet
-
- All Implemented Interfaces:
AdditionalInformationHandler,CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<AbstractConversion>,SizeOfHandler,Stoppable,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
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWekaPredictionContainerToSpreadSheet.SortContainerHelper class for sorting the distribution.static classWekaPredictionContainerToSpreadSheet.SortingHow to sort the distribution.
-
Field Summary
Fields Modifier and Type Field Description static StringCOLUMN_NAMEthe name column in the spreadsheet.static StringCOLUMN_VALUEthe value column in the spreadsheet.protected booleanm_AddClassificationwhether to add the numeric classification to the output.protected booleanm_AddClassificationLabelwhether to add the classification label to the output (nominal classes only).protected booleanm_AddDistributionwhether to add the distribution to the output (nominal classes only).protected Stringm_ClassificationEntrythe entry to use for the numeric classification in the spreadsheet.protected Stringm_ClassificationLabelEntrythe entry to use for the classification label in the spreadsheet.protected Stringm_DistributionFormatthe format to use for the distribution entries in the spreadsheet.protected WekaPredictionContainerToSpreadSheet.Sortingm_DistributionSortingthe type of sorting to apply to the distribution array (if applicable).protected Stringm_TitleNameColumnthe title of the name column.protected Stringm_TitleValueColumnthe title of the value column.static StringPLACEHOLDER_INDEXthe placeholder for the class index in the distribution format.static StringPLACEHOLDER_LABELthe placeholder for the class label in the distribution format.-
Fields inherited from class adams.data.conversion.AbstractConversion
m_Input, m_Output, m_Owner, m_Stopped
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description WekaPredictionContainerToSpreadSheet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Classaccepts()Returns the class that is accepted as input.StringaddClassificationLabelTipText()Returns the tip text for this property.StringaddClassificationTipText()Returns the tip text for this property.StringaddDistributionTipText()Returns the tip text for this property.StringclassificationEntryTipText()Returns the tip text for this property.StringclassificationLabelEntryTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.StringdistributionFormatTipText()Returns the tip text for this property.StringdistributionSortingTipText()Returns the tip text for this property.protected ObjectdoConvert()Performs the actual conversion.Classgenerates()Returns the class that is generated as output.booleangetAddClassification()Returns whether to add the numeric classification (label index for nominal classes).booleangetAddClassificationLabel()Returns whether to add the classification label (only for nominal classes).booleangetAddDistribution()Returns whether to add the class distribution (only for nominal classes).StringgetClassificationEntry()Returns the value for the 'Name' column for the numeric classification.StringgetClassificationLabelEntry()Returns the value for the 'Name' column for the classification label.StringgetDistributionFormat()Returns the format for the 'Name' column for the numeric classification.WekaPredictionContainerToSpreadSheet.SortinggetDistributionSorting()Returns the format for the 'Name' column for the numeric classification.StringgetTitleNameColumn()Returns the title of the "Name" column, i.e., the first column.StringgetTitleValueColumn()Returns the title of the "Value" column, i.e., the first column.StringglobalInfo()Returns a string describing the object.voidsetAddClassification(boolean value)Sets whether to add the numeric classification (label index for nominal classes).voidsetAddClassificationLabel(boolean value)Sets whether to add the classification label (only for nominal classes).voidsetAddDistribution(boolean value)Sets whether to add the class distribution (only for nominal classes).voidsetClassificationEntry(String value)Sets the value for the 'Name' column for the numeric classification.voidsetClassificationLabelEntry(String value)Sets the value for the 'Name' column for the classification label.voidsetDistributionFormat(String value)Sets the format for the 'Name' column for the class distribution.voidsetDistributionSorting(WekaPredictionContainerToSpreadSheet.Sorting value)Sets the sorting for the distribution array.voidsetTitleNameColumn(String value)Sets the title of the "Name" column, i.e., the first column.voidsetTitleValueColumn(String value)Sets the title of the "Value" column, i.e., the first column.StringtitleNameColumnTipText()Returns the tip text for this property.StringtitleValueColumnTipText()Returns the tip text for this property.-
Methods inherited from class adams.data.conversion.AbstractConversion
checkData, cleanUp, convert, getAdditionalInformation, getInput, getInput, getOutput, getOutput, getOwner, getQuickInfo, reset, setInput, setOwner, shallowCopy, shallowCopy, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
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).
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
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:
acceptsin interfaceConversion- Specified by:
acceptsin classAbstractConversion- Returns:
- the class
-
generates
public Class generates()
Returns the class that is generated as output.- Specified by:
generatesin interfaceConversion- Specified by:
generatesin classAbstractConversion- Returns:
- the class
-
doConvert
protected Object doConvert() throws Exception
Performs the actual conversion.- Specified by:
doConvertin classAbstractConversion- Returns:
- the converted data
- Throws:
Exception- if something goes wrong with the conversion
-
-