Class BoundaryPlotter

java.lang.Object
weka.knowledgeflow.steps.BaseStep
weka.knowledgeflow.steps.BoundaryPlotter
All Implemented Interfaces:
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:
  • Field Details

    • DEFAULT_COLORS

      public static final Color[] DEFAULT_COLORS
      default colours for classes
  • Constructor Details

    • BoundaryPlotter

      public BoundaryPlotter()
      Constructor
  • Method Details

    • setXAttName

      @ProgrammaticProperty @OptionMetadata(displayName="X attribute", description="Attribute to visualize on the x-axis", displayOrder=1) public void setXAttName(String xAttName)
      Set the name/index of the X axis attribute
      Parameters:
      xAttName - name/index of the X axis attribute
    • getXAttName

      public 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(String attName)
      Set the name/index of the Y axis attribute
      Parameters:
      attName - name/index of the Y axis attribute
    • getYAttName

      public 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(String base)
      Set the base for sampling
      Parameters:
      base - the base to use
    • getBaseForSampling

      public 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(String num)
      Set the number of locations/samples per pixel
      Parameters:
      num - the number of samples to use
    • getNumLocationsPerPixel

      public 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(String band)
      Set the kernel bandwidth
      Parameters:
      band - the bandwidth
    • getKernelBandwidth

      public 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 List<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 List<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 Map<String,BufferedImage> getImages()
      Get the completed images
      Returns:
      a map of completed images
    • getCurrentImage

      public 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 Map<String,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 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 Object retrieveData()
      Get the map of completed images
      Specified by:
      retrieveData in interface DataCollector
      Returns:
      the map of completed images
    • restoreData

      public void restoreData(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