weka.knowledgeflow.steps

## Class BoundaryPlotter

- java.lang.Object
- - weka.knowledgeflow.steps.BaseStep
  - - weka.knowledgeflow.steps.BoundaryPlotter

- All Implemented Interfaces:
    java.io.Serializable, BaseStepExtender, DataCollector, Step

      @KFStep(name="BoundaryPlotter",
              category="Visualization",
              toolTipText="Visualize class/cluster decision boundaries in a 2D plot",
              iconPath="weka/gui/knowledgeflow/icons/DefaultDataVisualizer.gif")
      public class BoundaryPlotter
      extends BaseStep
      implements DataCollector

  A step that computes visualization data for class/cluster decision boundaries.
  Version:
    $Revision: $
  Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `BoundaryPlotter.RenderingUpdateListener` Interface for something that wants to be informed of rendering progress updates

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.awt.Color[]` | `DEFAULT_COLORS` default colours for classes

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BoundaryPlotter()` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getBaseForSampling()` Get the base for sampling
    `int` | `getComputeMaxRowsInParallel()` Get the maximum number of threads to use when computing image rows
    `java.awt.image.BufferedImage` | `getCurrentImage()` Get the currently rendering image
    `java.lang.String` | `getCustomEditorForStep()` Return the fully qualified name of a custom editor component (JComponent) to use for editing the properties of the step.
    `int` | `getImageHeight()` Get the image height (in pixels)
    `java.util.Map<java.lang.String,java.awt.image.BufferedImage>` | `getImages()` Get the completed images
    `int` | `getImageWidth()` Get the image width (in pixels)
    `java.util.List<java.lang.String>` | `getIncomingConnectionTypes()` Get a list of incoming connection types that this step can accept.
    `java.util.Map<java.lang.String,java.lang.String>` | `getInteractiveViewers()` When running in a graphical execution environment a step can make one or more popup Viewer components available.
    `java.lang.String` | `getKernelBandwidth()` Get the kernel bandwidth
    `java.lang.String` | `getNumLocationsPerPixel()` Get the number of locations/samples per pixel
    `java.util.List<java.lang.String>` | `getOutgoingConnectionTypes()` Get a list of outgoing connection types that this step can produce.
    `boolean` | `getPlotTrainingData()` Get whether to superimpose the training data points on the plot or not
    `java.lang.String` | `getXAttName()` Get the name/index of the X axis attribute
    `java.lang.String` | `getYAttName()` Get the name/index of the Y axis attribute
    `void` | `plotTrainingData(Instances trainingData)`
    `void` | `processIncoming(Data data)` Process an incoming data payload (if the step accepts incoming connections)
    `void` | `removeRenderingListener(BoundaryPlotter.RenderingUpdateListener l)` Remove the rendering update listener
    `void` | `restoreData(java.lang.Object data)` Set a map of images.
    `java.lang.Object` | `retrieveData()` Get the map of completed images
    `void` | `setBaseForSampling(java.lang.String base)` Set the base for sampling
    `void` | `setComputeMaxRowsInParallel(int max)` Set the maximum number of threads to use when computing image rows
    `void` | `setImageHeight(int height)` Set the image height (in pixels)
    `void` | `setImageWidth(int width)` Set the image width (in pixels)
    `void` | `setKernelBandwidth(java.lang.String band)` Set the kernel bandwidth
    `void` | `setNumLocationsPerPixel(java.lang.String num)` Set the number of locations/samples per pixel
    `void` | `setPlotTrainingData(boolean plot)` Set whether to superimpose the training data points on the plot or not
    `void` | `setRenderingListener(BoundaryPlotter.RenderingUpdateListener l)` Set a listener to receive rendering updates
    `void` | `setXAttName(java.lang.String xAttName)` Set the name/index of the X axis attribute
    `void` | `setYAttName(java.lang.String attName)` Set the name/index of the Y axis attribute
    `void` | `stepInit()` Initialize the step.

    - ### Methods inherited from class weka.knowledgeflow.steps.BaseStep

      `environmentSubstitute, getDefaultSettings, getInteractiveViewersImpls, getName, getStepManager, globalInfo, isResourceIntensive, isStopRequested, outputStructureForConnectionType, setName, setStepIsResourceIntensive, setStepManager, setStepMustRunSingleThreaded, start, stepMustRunSingleThreaded, stop`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_COLORS

          public static final java.awt.Color[] DEFAULT_COLORS

      default colours for classes

  - ### Constructor Detail

    - #### BoundaryPlotter

          public BoundaryPlotter()

      Constructor

  - ### Method Detail

    - #### setXAttName

          @ProgrammaticProperty
           @OptionMetadata(displayName="X attribute",
                          description="Attribute to visualize on the x-axis",
                          displayOrder=1)
          public void setXAttName(java.lang.String xAttName)

      Set the name/index of the X axis attribute
      Parameters:
        `xAttName` - name/index of the X axis attribute

    - #### getXAttName

          public java.lang.String getXAttName()

      Get the name/index of the X axis attribute
      Returns:
        the name/index of the X axis attribute

    - #### setYAttName

          @ProgrammaticProperty
           @OptionMetadata(displayName="Y attribute",
                          description="Attribute to visualize on the y-axis",
                          displayOrder=2)
          public void setYAttName(java.lang.String attName)

      Set the name/index of the Y axis attribute
      Parameters:
        `attName` - name/index of the Y axis attribute

    - #### getYAttName

          public java.lang.String getYAttName()

      Get the name/index of the Y axis attribute
      Returns:
        the name/index of the Y axis attribute

    - #### setBaseForSampling

          @OptionMetadata(displayName="Base for sampling (r)",
                          description="The base for sampling",
                          displayOrder=3)
          public void setBaseForSampling(java.lang.String base)

      Set the base for sampling
      Parameters:
        `base` - the base to use

    - #### getBaseForSampling

          public java.lang.String getBaseForSampling()

      Get the base for sampling
      Returns:
        the base to use

    - #### setNumLocationsPerPixel

          @OptionMetadata(displayName="Num. locations per pixel",
                          description="Number of locations per pixel",
                          displayOrder=4)
          public void setNumLocationsPerPixel(java.lang.String num)

      Set the number of locations/samples per pixel
      Parameters:
        `num` - the number of samples to use

    - #### getNumLocationsPerPixel

          public java.lang.String getNumLocationsPerPixel()

      Get the number of locations/samples per pixel
      Returns:
        the number of samples to use

    - #### setKernelBandwidth

          @OptionMetadata(displayName="Kernel bandwidth (k)",
                          description="Kernel bandwidth",
                          displayOrder=4)
          public void setKernelBandwidth(java.lang.String band)

      Set the kernel bandwidth
      Parameters:
        `band` - the bandwidth

    - #### getKernelBandwidth

          public java.lang.String getKernelBandwidth()

      Get the kernel bandwidth
      Returns:
        the bandwidth

    - #### setImageWidth

          @OptionMetadata(displayName="Image width (pixels)",
                          description="Image width in pixels",
                          displayOrder=5)
          public void setImageWidth(int width)

      Set the image width (in pixels)
      Parameters:
        `width` - the width to use

    - #### getImageWidth

          public int getImageWidth()

      Get the image width (in pixels)
      Returns:
        the width to use

    - #### setImageHeight

          @OptionMetadata(displayName="Image height (pixels)",
                          description="Image height in pixels",
                          displayOrder=6)
          public void setImageHeight(int height)

      Set the image height (in pixels)
      Parameters:
        `height` - the height to use

    - #### getImageHeight

          public int getImageHeight()

      Get the image height (in pixels)
      Returns:
        the height to use

    - #### setComputeMaxRowsInParallel

          @OptionMetadata(displayName="Max image rows to compute in parallel",
                          description="Use this many tasks for computing rows of the image",
                          displayOrder=7)
          public void setComputeMaxRowsInParallel(int max)

      Set the maximum number of threads to use when computing image rows
      Parameters:
        `max` - maximum number of rows to compute in parallel

    - #### getComputeMaxRowsInParallel

          public int getComputeMaxRowsInParallel()

      Get the maximum number of threads to use when computing image rows
      Returns:
        the maximum number of rows to compute in parallel

    - #### setPlotTrainingData

          @OptionMetadata(displayName="Plot training points",
                          description="Superimpose the training data over the top of the plot",
                          displayOrder=8)
          public void setPlotTrainingData(boolean plot)

      Set whether to superimpose the training data points on the plot or not
      Parameters:
        `plot` - true to plot the training data

    - #### getPlotTrainingData

          public boolean getPlotTrainingData()

      Get whether to superimpose the training data points on the plot or not
      Returns:
        true if plotting the training data

    - #### stepInit

          public void stepInit()
                        throws WekaException

      Initialize the step.
      Specified by:
        `stepInit` in interface `BaseStepExtender`
      Specified by:
        `stepInit` in interface `Step`
      Throws:
        `WekaException` - if a problem occurs during initialization

    - #### processIncoming

          public void processIncoming(Data data)
                               throws WekaException

      Description copied from class: `BaseStep`
      Process an incoming data payload (if the step accepts incoming connections)
      Specified by:
        `processIncoming` in interface `BaseStepExtender`
      Specified by:
        `processIncoming` in interface `Step`
      Overrides:
        `processIncoming` in class `BaseStep`
      Parameters:
        `data` - the payload to process
      Throws:
        `WekaException` - if a problem occurs

    - #### plotTrainingData

          public void plotTrainingData(Instances trainingData)

    - #### getIncomingConnectionTypes

          public java.util.List<java.lang.String> getIncomingConnectionTypes()

      Get a list of incoming connection types that this step can accept. Ideally (and if appropriate), this should take into account the state of the step and any existing incoming connections. E.g. a step might be able to accept one (and only one) incoming batch data connection.
      Specified by:
        `getIncomingConnectionTypes` in interface `BaseStepExtender`
      Specified by:
        `getIncomingConnectionTypes` in interface `Step`
      Returns:
        a list of incoming connections that this step can accept given its current state

    - #### getOutgoingConnectionTypes

          public java.util.List<java.lang.String> getOutgoingConnectionTypes()

      Get a list of outgoing connection types that this step can produce. Ideally (and if appropriate), this should take into account the state of the step and the incoming connections. E.g. depending on what incoming connection is present, a step might be able to produce a trainingSet output, a testSet output or neither, but not both.
      Specified by:
        `getOutgoingConnectionTypes` in interface `BaseStepExtender`
      Specified by:
        `getOutgoingConnectionTypes` in interface `Step`
      Returns:
        a list of outgoing connections that this step can produce

    - #### getImages

          public java.util.Map<java.lang.String,java.awt.image.BufferedImage> getImages()

      Get the completed images
      Returns:
        a map of completed images

    - #### getCurrentImage

          public java.awt.image.BufferedImage getCurrentImage()

      Get the currently rendering image
      Returns:
        the current image

    - #### setRenderingListener

          public void setRenderingListener(BoundaryPlotter.RenderingUpdateListener l)

      Set a listener to receive rendering updates
      Parameters:
        `l` - the `RenderingUpdateListener` to add

    - #### removeRenderingListener

          public void removeRenderingListener(BoundaryPlotter.RenderingUpdateListener l)

      Remove the rendering update listener
      Parameters:
        `l` - the `RenderingUpdateListener` to remove

    - #### getInteractiveViewers

          public java.util.Map<java.lang.String,java.lang.String> getInteractiveViewers()

      When running in a graphical execution environment a step can make one or more popup Viewer components available. These might be used to display results, graphics etc. Returning null indicates that the step has no such additional graphical views. The map returned by this method should be keyed by action name (e.g. "View results"), and values should be fully qualified names of the corresponding StepInteractiveView implementation. Furthermore, the contents of this map can (and should) be dependent on whether a particular viewer should be made available - i.e. if execution hasn't occurred yet, or if a particular incoming connection type is not present, then it might not be possible to view certain results. Viewers can implement StepInteractiveView directly (in which case they need to extends JPanel), or extends the AbstractInteractiveViewer class. The later extends JPanel, uses a BorderLayout, provides a "Close" button and a method to add additional buttons.
      Specified by:
        `getInteractiveViewers` in interface `Step`
      Overrides:
        `getInteractiveViewers` in class `BaseStep`
      Returns:
        a map of viewer component names, or null if this step has no graphical views

    - #### getCustomEditorForStep

          public java.lang.String getCustomEditorForStep()

      Return the fully qualified name of a custom editor component (JComponent) to use for editing the properties of the step. This method can return null, in which case the system will dynamically generate an editor using the GenericObjectEditor
      Specified by:
        `getCustomEditorForStep` in interface `Step`
      Overrides:
        `getCustomEditorForStep` in class `BaseStep`
      Returns:
        the fully qualified name of a step editor component

    - #### retrieveData

          public java.lang.Object retrieveData()

      Get the map of completed images
      Specified by:
        `retrieveData` in interface `DataCollector`
      Returns:
        the map of completed images

    - #### restoreData

          public void restoreData(java.lang.Object data)
                           throws WekaException

      Set a map of images.
      Specified by:
        `restoreData` in interface `DataCollector`
      Parameters:
        `data` - the images to set
      Throws:
        `WekaException` - if a problem occurs