Package weka.knowledgeflow.steps
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Interface for something that wants to be informed of rendering progress updates -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the base for samplingint
Get the maximum number of threads to use when computing image rowsGet the currently rendering imageReturn the fully qualified name of a custom editor component (JComponent) to use for editing the properties of the step.int
Get the image height (in pixels)Get the completed imagesint
Get the image width (in pixels)Get a list of incoming connection types that this step can accept.When running in a graphical execution environment a step can make one or more popup Viewer components available.Get the kernel bandwidthGet the number of locations/samples per pixelGet a list of outgoing connection types that this step can produce.boolean
Get whether to superimpose the training data points on the plot or notGet the name/index of the X axis attributeGet the name/index of the Y axis attributevoid
plotTrainingData
(Instances trainingData) void
processIncoming
(Data data) Process an incoming data payload (if the step accepts incoming connections)void
Remove the rendering update listenervoid
restoreData
(Object data) Set a map of images.Get the map of completed imagesvoid
setBaseForSampling
(String base) Set the base for samplingvoid
setComputeMaxRowsInParallel
(int max) Set the maximum number of threads to use when computing image rowsvoid
setImageHeight
(int height) Set the image height (in pixels)void
setImageWidth
(int width) Set the image width (in pixels)void
setKernelBandwidth
(String band) Set the kernel bandwidthvoid
Set the number of locations/samples per pixelvoid
setPlotTrainingData
(boolean plot) Set whether to superimpose the training data points on the plot or notvoid
Set a listener to receive rendering updatesvoid
setXAttName
(String xAttName) Set the name/index of the X axis attributevoid
setYAttName
(String attName) Set the name/index of the Y axis attributevoid
stepInit()
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
-
Field Details
-
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
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
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
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
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
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
Initialize the step.- Specified by:
stepInit
in interfaceBaseStepExtender
- Specified by:
stepInit
in interfaceStep
- Throws:
WekaException
- if a problem occurs during initialization
-
processIncoming
Description copied from class:BaseStep
Process an incoming data payload (if the step accepts incoming connections)- Specified by:
processIncoming
in interfaceBaseStepExtender
- Specified by:
processIncoming
in interfaceStep
- Overrides:
processIncoming
in classBaseStep
- Parameters:
data
- the payload to process- Throws:
WekaException
- if a problem occurs
-
plotTrainingData
-
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 interfaceBaseStepExtender
- Specified by:
getIncomingConnectionTypes
in interfaceStep
- Returns:
- a list of incoming connections that this step can accept given its current state
-
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 interfaceBaseStepExtender
- Specified by:
getOutgoingConnectionTypes
in interfaceStep
- Returns:
- a list of outgoing connections that this step can produce
-
getImages
Get the completed images- Returns:
- a map of completed images
-
getCurrentImage
Get the currently rendering image- Returns:
- the current image
-
setRenderingListener
Set a listener to receive rendering updates- Parameters:
l
- theRenderingUpdateListener
to add
-
removeRenderingListener
Remove the rendering update listener- Parameters:
l
- theRenderingUpdateListener
to remove
-
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 interfaceStep
- Overrides:
getInteractiveViewers
in classBaseStep
- Returns:
- a map of viewer component names, or null if this step has no graphical views
-
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 interfaceStep
- Overrides:
getCustomEditorForStep
in classBaseStep
- Returns:
- the fully qualified name of a step editor component
-
retrieveData
Get the map of completed images- Specified by:
retrieveData
in interfaceDataCollector
- Returns:
- the map of completed images
-
restoreData
Set a map of images.- Specified by:
restoreData
in interfaceDataCollector
- Parameters:
data
- the images to set- Throws:
WekaException
- if a problem occurs
-