Package 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 Description static interfaceBoundaryPlotter.RenderingUpdateListenerInterface for something that wants to be informed of rendering progress updates
-
Field Summary
Fields Modifier and Type Field Description static java.awt.Color[]DEFAULT_COLORSdefault colours for classes
-
Constructor Summary
Constructors Constructor Description BoundaryPlotter()Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBaseForSampling()Get the base for samplingintgetComputeMaxRowsInParallel()Get the maximum number of threads to use when computing image rowsjava.awt.image.BufferedImagegetCurrentImage()Get the currently rendering imagejava.lang.StringgetCustomEditorForStep()Return the fully qualified name of a custom editor component (JComponent) to use for editing the properties of the step.intgetImageHeight()Get the image height (in pixels)java.util.Map<java.lang.String,java.awt.image.BufferedImage>getImages()Get the completed imagesintgetImageWidth()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.StringgetKernelBandwidth()Get the kernel bandwidthjava.lang.StringgetNumLocationsPerPixel()Get the number of locations/samples per pixeljava.util.List<java.lang.String>getOutgoingConnectionTypes()Get a list of outgoing connection types that this step can produce.booleangetPlotTrainingData()Get whether to superimpose the training data points on the plot or notjava.lang.StringgetXAttName()Get the name/index of the X axis attributejava.lang.StringgetYAttName()Get the name/index of the Y axis attributevoidplotTrainingData(Instances trainingData)voidprocessIncoming(Data data)Process an incoming data payload (if the step accepts incoming connections)voidremoveRenderingListener(BoundaryPlotter.RenderingUpdateListener l)Remove the rendering update listenervoidrestoreData(java.lang.Object data)Set a map of images.java.lang.ObjectretrieveData()Get the map of completed imagesvoidsetBaseForSampling(java.lang.String base)Set the base for samplingvoidsetComputeMaxRowsInParallel(int max)Set the maximum number of threads to use when computing image rowsvoidsetImageHeight(int height)Set the image height (in pixels)voidsetImageWidth(int width)Set the image width (in pixels)voidsetKernelBandwidth(java.lang.String band)Set the kernel bandwidthvoidsetNumLocationsPerPixel(java.lang.String num)Set the number of locations/samples per pixelvoidsetPlotTrainingData(boolean plot)Set whether to superimpose the training data points on the plot or notvoidsetRenderingListener(BoundaryPlotter.RenderingUpdateListener l)Set a listener to receive rendering updatesvoidsetXAttName(java.lang.String xAttName)Set the name/index of the X axis attributevoidsetYAttName(java.lang.String attName)Set the name/index of the Y axis attributevoidstepInit()Initialize the step.-
Methods inherited from class weka.knowledgeflow.steps.BaseStep
environmentSubstitute, getDefaultSettings, getInteractiveViewersImpls, getName, getStepManager, globalInfo, isResourceIntensive, isStopRequested, outputStructureForConnectionType, outputStructureForConnectionType, setName, setStepIsResourceIntensive, setStepManager, setStepMustRunSingleThreaded, start, stepMustRunSingleThreaded, stop
-
-
-
-
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 WekaExceptionInitialize the step.- Specified by:
stepInitin interfaceBaseStepExtender- Specified by:
stepInitin interfaceStep- Throws:
WekaException- if a problem occurs during initialization
-
processIncoming
public void processIncoming(Data data) throws WekaException
Description copied from class:BaseStepProcess an incoming data payload (if the step accepts incoming connections)- Specified by:
processIncomingin interfaceBaseStepExtender- Specified by:
processIncomingin interfaceStep- Overrides:
processIncomingin classBaseStep- 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:
getIncomingConnectionTypesin interfaceBaseStepExtender- Specified by:
getIncomingConnectionTypesin interfaceStep- 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:
getOutgoingConnectionTypesin interfaceBaseStepExtender- Specified by:
getOutgoingConnectionTypesin interfaceStep- 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- theRenderingUpdateListenerto add
-
removeRenderingListener
public void removeRenderingListener(BoundaryPlotter.RenderingUpdateListener l)
Remove the rendering update listener- Parameters:
l- theRenderingUpdateListenerto 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:
getInteractiveViewersin interfaceStep- Overrides:
getInteractiveViewersin classBaseStep- 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:
getCustomEditorForStepin interfaceStep- Overrides:
getCustomEditorForStepin classBaseStep- Returns:
- the fully qualified name of a step editor component
-
retrieveData
public java.lang.Object retrieveData()
Get the map of completed images- Specified by:
retrieveDatain interfaceDataCollector- Returns:
- the map of completed images
-
restoreData
public void restoreData(java.lang.Object data) throws WekaExceptionSet a map of images.- Specified by:
restoreDatain interfaceDataCollector- Parameters:
data- the images to set- Throws:
WekaException- if a problem occurs
-
-