Class ConfusionMatrix

  • All Implemented Interfaces:
    Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, SizeOfHandler, PdfProclet, PdfProcletWithAbsolutePosition, PdfProcletWithFilenameOutput, PdfProcletWithOptionalAbsolutePosition, PdfProcletWithPageBreaks, PdfProcletWithVariableFileExtension, Serializable

    public class ConfusionMatrix
    extends AbstractSpreadSheetPdfProclet
    Adds CSV files (or any spreadsheet files that is supported) as table.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -regexp-filename <adams.core.base.BaseRegExp> (property: regExpFilename)
        The regular expression that the filename must match.
        default: .*
        more: https://docs.oracle.com/javase/tutorial/essential/regex/
        https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html
     
    -add-filename <boolean> (property: addFilename)
        Whether to add the file name before the actual file content as separate
        paragraph.
        default: false
     
    -font-filename <adams.core.io.PdfFont> (property: fontFilename)
        The font to use for printing the file name header.
        default: Helvetica-Bold-12
     
    -color-filename <java.awt.Color> (property: colorFilename)
        The color to use for printing the file name header.
        default: #000000
     
    -page-break-before <boolean> (property: pageBreakBefore)
        If true, then a page-break is added before the content of the file is inserted.
        default: false
     
    -page-break-after <boolean> (property: pageBreakAfter)
        If true, then a page-break is added after the content of the file is inserted.
        default: false
     
    -num-files <int> (property: numFilesPerPage)
        The number of files to put on a page before adding an automatic page break;
         use -1 for unlimited.
        default: -1
        minimum: -1
     
    -font-table-header <adams.core.io.PdfFont> (property: fontTableHeader)
        The font to use for the table header.
        default: Helvetica-Bold-12
     
    -color-table-header <java.awt.Color> (property: colorTableHeader)
        The color to use for the table header.
        default: #000000
     
    -background-table-header <java.awt.Color> (property: backgroundTableHeader)
        The background color to use for the table header.
        default: #c0c0c0
     
    -font-general-content <adams.core.io.PdfFont> (property: fontGeneralContent)
        The font to use for non-numeric content in the table.
        default: Helvetica-Normal-12
     
    -color-general-content <java.awt.Color> (property: colorGeneralContent)
        The color to use for general content.
        default: #000000
     
    -font-numeric-content <adams.core.io.PdfFont> (property: fontNumericContent)
        The font to use for numeric content in the table.
        default: Helvetica-Normal-12
     
    -color-numeric-content <java.awt.Color> (property: colorNumericContent)
        The color to use for numeric content.
        default: #000000
     
    -num-decimals <int> (property: numDecimals)
        The number of decimals for numeric values in the table.
        default: 1
        minimum: 0
     
    -extension <adams.core.base.BaseString> [-extension ...] (property: extensions)
        The file extension(s) that the processor will be used for.
        default: csv
     
    -reader <adams.data.io.input.SpreadSheetReader> (property: reader)
        The reader to use for loading the spreadsheet files.
        default: adams.data.io.input.CsvSpreadSheetReader -data-row-type adams.data.spreadsheet.DenseDataRow -spreadsheet-type adams.data.spreadsheet.DefaultSpreadSheet
     
    -width-percentage <float> (property: widthPercentage)
        The percentage of the page width to occupy.
        default: 100.0
        minimum: 0.0
        maximum: 100.0
     
    -horizontal-alignment <LEFT|CENTER|RIGHT> (property: horizontalAlignment)
        How to align the table on the page horizontally when not 100% wide.
        default: CENTER
     
    -use-absolute-position <boolean> (property: useAbsolutePosition)
        If enabled, the absolute position is used (from bottom-left corner).
        default: false
     
    -x <float> (property: X)
        The absolute X position.
        default: 0.0
        minimum: 0.0
     
    -y <float> (property: Y)
        The absolute Y position.
        default: 0.0
        minimum: 0.0
     
    -rel-col-width <adams.core.base.BaseFloat> [-rel-col-width ...] (property: relativeColumnWidths)
        The relative column widths (0-1), ignored if not provided, uses 1 by default.
        default:
     
    -background-diagonal <java.awt.Color> (property: backgroundDiagonal)
        The background color to use for the diagonal.
        default: #c0c0c0
     
    -value-based-background <boolean> (property: valueBasedBackground)
        If enabled, the background of the cells gets colored in based on their value.
        default: false
     
    -background-color-generator <adams.gui.visualization.core.ColorGradientGenerator> (property: backgroundColorGenerator)
        The color generator to use for obtaining the colors for coloring in the
        backgrounds.
        default: adams.gui.visualization.core.BiColorGenerator -first-color #ffffff -second-color #ff0000
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_BackgroundDiagonal

        protected Color m_BackgroundDiagonal
        the background color for the diagonal.
      • m_ValueBasedBackground

        protected boolean m_ValueBasedBackground
        whether to color background based on value.
      • m_BackgroundColorGenerator

        protected ColorGradientGenerator m_BackgroundColorGenerator
        the color provider to use for the background.
      • m_Colors

        protected transient Map<Integer,​Color> m_Colors
        the color values (starting at 0).
    • Constructor Detail

      • ConfusionMatrix

        public ConfusionMatrix()
    • Method Detail

      • setBackgroundDiagonal

        public void setBackgroundDiagonal​(Color value)
        Sets the background color to use for the diagonal.
        Parameters:
        value - the color
      • getBackgroundDiagonal

        public Color getBackgroundDiagonal()
        Returns the background color to use for the diagonal.
        Returns:
        the color
      • backgroundDiagonalTipText

        public String backgroundDiagonalTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setValueBasedBackground

        public void setValueBasedBackground​(boolean value)
        Sets whether to color in backgrounds based on their values.
        Parameters:
        value - true if to color in background
      • getValueBasedBackground

        public boolean getValueBasedBackground()
        Returns whether to color in backgrounds based on their values.
        Returns:
        true if to color in background
      • valueBasedBackgroundTipText

        public String valueBasedBackgroundTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui
      • getDefaultBackgroundColorGenerator

        protected ColorGradientGenerator getDefaultBackgroundColorGenerator()
        Returns the default background color generator.
        Returns:
        the generator
      • setBackgroundColorGenerator

        public void setBackgroundColorGenerator​(ColorGradientGenerator value)
        Sets the color generator for obtaining the colors used for coloring in the background.
        Parameters:
        value - the generator
      • getBackgroundColorGenerator

        public ColorGradientGenerator getBackgroundColorGenerator()
        Returns the color generator for obtaining the colors used for coloring in the background.
        Returns:
        the generator
      • backgroundColorGeneratorTipText

        public String backgroundColorGeneratorTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui
      • initColors

        protected void initColors()
        Initializes the color lookup table.
      • getBackgroundColor

        public Color getBackgroundColor​(SpreadSheet sheet,
                                        int row,
                                        int column)
        For customizing the background color of a spreadsheet cell.
        Parameters:
        sheet - the spreadsheet
        row - the current row
        column - the current column
        Returns:
        the color
      • toBaseColor

        protected com.itextpdf.text.BaseColor toBaseColor​(Color color)
        Converts the color into itextpdf color.
        Overrides:
        toBaseColor in class AbstractSpreadSheetPdfProclet
        Parameters:
        color - the color to convert
        Returns:
        the converted color