Class BoundaryVisualizer

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, TechnicalInformationHandler

public class BoundaryVisualizer extends JPanel implements TechnicalInformationHandler
BoundaryVisualizer. Allows the visualization of classifier decision boundaries in two dimensions. A supplied classifier is first trained on supplied training data, then a data generator (currently using kernels) is used to generate new instances at points fixed in the two visualization dimensions but random in the other dimensions. These instances are classified by the classifier and plotted as points with colour corresponding to the probability distribution predicted by the classifier. At present, 2 * 2^(# non-fixed dimensions) points are generated from each kernel per pixel in the display. In practice, fewer points than this are actually classified because kernels are weighted (on a per-pixel basis) according to the fixexd dimensions and kernels corresponding to the lowest 1% of the weight mass are discarded. Predicted probability distributions are weighted (acording to the fixed visualization dimensions) and averaged to produce an RGB value for the pixel. For more information, see

Eibe Frank and Mark Hall (2003). Visualizing Class Probability Estimators. Working Paper 02/03, Department of Computer Science, University of Waikato.

Since:
1.0
Version:
$Revision: 15104 $
Author:
Mark Hall
See Also:
  • Constructor Details

    • BoundaryVisualizer

      public BoundaryVisualizer()
      Creates a new BoundaryVisualizer instance.
  • Method Details

    • globalInfo

      public String globalInfo()
      Returns a string describing this tool
      Returns:
      a description of the tool suitable for displaying in various Weka GUIs
    • getTechnicalInformation

      public TechnicalInformation getTechnicalInformation()
      Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
      Specified by:
      getTechnicalInformation in interface TechnicalInformationHandler
      Returns:
      the technical information about this class
    • setClassifier

      public void setClassifier(Classifier newClassifier) throws Exception
      Set a classifier to use
      Parameters:
      newClassifier - the classifier to use
      Throws:
      Exception - if an error occurs
    • getInstances

      public Instances getInstances()
      Get the training instances
      Returns:
      the training instances
    • setInstances

      public void setInstances(Instances inst) throws Exception
      Set the training instances
      Parameters:
      inst - the instances to use
      Throws:
      Exception
    • setInstancesFromFileQ

      public void setInstancesFromFileQ()
      Queries the user for a file to load instances from, then loads the instances in a background process. This is done in the IO thread, and an error message is popped up if the IO thread is busy.
    • setUpBoundaryPanel

      public int setUpBoundaryPanel() throws Exception
      Sets up the BoundaryPanel object so that it is ready for plotting.
      Returns:
      an error code:
      0 - SUCCESS
      1 - ERROR - Kernel bandwidth < 0
      2 - ERROR - Kernel bandwidth >= number of training instances.
      Throws:
      Exception
    • plotTrainingData

      public void plotTrainingData() throws Exception
      Plots the training data on-screen. Also does all of the setup required for this to work.
      Throws:
      Exception
    • stopPlotting

      public void stopPlotting()
      Stops the plotting thread.
    • setExitIfNoWindowsOpen

      public static void setExitIfNoWindowsOpen(boolean value)
      Sets whether System.exit gets called when no more windows are open.
      Parameters:
      value - if TRUE then a System.exit call is ossued after the last window gets closed.
    • getExitIfNoWindowsOpen

      public static boolean getExitIfNoWindowsOpen()
      Gets whether System.exit gets called after the last window gets closed
      Returns:
      TRUE if System.exit gets called after last window got closed.
    • createNewVisualizerWindow

      public static void createNewVisualizerWindow(Classifier classifier, Instances instances) throws Exception
      Creates a new GUI window with all of the BoundaryVisualizer trappings,
      Parameters:
      classifier - The classifier to use in the new window. May be null.
      instances - The dataset to visualize on in the new window. May be null.
      Throws:
      Exception
    • main

      public static void main(String[] args)
      Main method for testing this class
      Parameters:
      args - a String[] value