@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
| Modifier and Type | Class and Description |
|---|---|
static interface |
BoundaryPlotter.RenderingUpdateListener
Interface for something that wants to be informed of rendering progress
updates
|
protected static class |
BoundaryPlotter.RowResult
Holds computed image data for a row of an image
|
protected static class |
BoundaryPlotter.SchemeRowTask
A task for computing a row of an image using a trained model
|
| Modifier and Type | Field and Description |
|---|---|
static java.awt.Color[] |
DEFAULT_COLORS
default colours for classes
|
protected java.util.List<Classifier> |
m_classifierTemplates
Classifiers to use
|
protected java.util.List<DensityBasedClusterer> |
m_clustererTemplates
Clusterers to use
|
protected java.util.List<java.awt.Color> |
m_Colors
Holds colors to use
|
protected java.util.Map<java.lang.String,java.awt.image.BufferedImage> |
m_completedImages
Completed images
|
protected java.lang.String |
m_currentDescription
The spec of the scheme being used to render the current image
|
protected KDDataGenerator |
m_dataGenerator
The data generator to use
|
protected int |
m_imageHeight
Height of images to generate
|
protected int |
m_imageWidth
Width of images to generate
|
protected boolean |
m_isReset
True if we've been reset
|
protected java.lang.String |
m_kBand
User-specified bandwidth
|
protected int |
m_kernelBandwidth
Parsed bandwidth
|
protected int |
m_maxRowsInParallel
Number of rows of the visualization to compute in parallel.
|
protected double |
m_maxX |
protected double |
m_maxY |
protected double |
m_minX |
protected double |
m_minY |
protected java.lang.String |
m_nSamples
User-specified num samples
|
protected int |
m_numSamplesPerRegion
Parsed samples
|
protected java.awt.image.BufferedImage |
m_osi
The currently rendering image
|
protected double |
m_pixHeight |
protected double |
m_pixWidth |
protected BoundaryPlotter.RenderingUpdateListener |
m_plotListener
Open interactive view?
|
protected boolean |
m_plotTrainingData
Superimpose the training data on the plot?
|
protected double |
m_rangeX |
protected double |
m_rangeY |
protected int |
m_samplesBase
Parsed base
|
protected java.lang.String |
m_sBase
User-specified base for sampling
|
protected Classifier[] |
m_threadClassifiers
Copies of trained classifier to use in parallel for prediction
|
protected Clusterer[] |
m_threadClusterers
Copies of trained clusterer to use in parallel for prediction
|
protected DataGenerator[] |
m_threadGenerators
Data generator copies to use in parallel
|
protected java.lang.String |
m_xAttName
X axis attribute name/index
|
protected int |
m_xAttribute |
protected java.lang.String |
m_yAttName
Y axis attribute name/index
|
protected int |
m_yAttribute |
m_stepIsResourceIntensive, m_stepManager, m_stepName| Constructor and Description |
|---|
BoundaryPlotter()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
computeMinMaxAtts(Instances trainingData) |
protected void |
doScheme(Classifier classifier,
DensityBasedClusterer clust,
Instances trainingData,
int setNum,
int maxSetNum) |
protected int |
getAttIndex(java.lang.String attName,
Instances data) |
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
|
protected void |
initDataGenerator(Instances trainingData) |
protected java.lang.String |
makeSchemeSpec(java.lang.Object scheme,
int setNum,
int maxSetNum) |
protected void |
plotPoint(java.awt.image.BufferedImage osi,
int x,
int y,
double[] probs,
boolean update) |
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.
|
environmentSubstitute, getDefaultSettings, getInteractiveViewersImpls, getName, getStepManager, globalInfo, isResourceIntensive, isStopRequested, outputStructureForConnectionType, setName, setStepIsResourceIntensive, setStepManager, setStepMustRunSingleThreaded, start, stepMustRunSingleThreaded, stoppublic static final java.awt.Color[] DEFAULT_COLORS
protected java.util.List<java.awt.Color> m_Colors
protected int m_maxRowsInParallel
protected int m_imageWidth
protected int m_imageHeight
protected java.lang.String m_xAttName
protected java.lang.String m_yAttName
protected boolean m_plotTrainingData
protected int m_xAttribute
protected int m_yAttribute
protected double m_minX
protected double m_minY
protected double m_maxX
protected double m_maxY
protected double m_rangeX
protected double m_rangeY
protected double m_pixHeight
protected double m_pixWidth
protected transient java.awt.image.BufferedImage m_osi
protected java.lang.String m_currentDescription
protected transient java.util.Map<java.lang.String,java.awt.image.BufferedImage> m_completedImages
protected java.util.List<Classifier> m_classifierTemplates
protected java.util.List<DensityBasedClusterer> m_clustererTemplates
protected Classifier[] m_threadClassifiers
protected Clusterer[] m_threadClusterers
protected DataGenerator[] m_threadGenerators
protected KDDataGenerator m_dataGenerator
protected java.lang.String m_kBand
protected java.lang.String m_nSamples
protected java.lang.String m_sBase
protected int m_kernelBandwidth
protected int m_numSamplesPerRegion
protected int m_samplesBase
protected transient BoundaryPlotter.RenderingUpdateListener m_plotListener
protected boolean m_isReset
@ProgrammaticProperty @OptionMetadata(displayName="X attribute", description="Attribute to visualize on the x-axis", displayOrder=1) public void setXAttName(java.lang.String xAttName)
xAttName - name/index of the X axis attributepublic java.lang.String getXAttName()
@ProgrammaticProperty @OptionMetadata(displayName="Y attribute", description="Attribute to visualize on the y-axis", displayOrder=2) public void setYAttName(java.lang.String attName)
attName - name/index of the Y axis attributepublic java.lang.String getYAttName()
@OptionMetadata(displayName="Base for sampling (r)", description="The base for sampling", displayOrder=3) public void setBaseForSampling(java.lang.String base)
base - the base to usepublic java.lang.String getBaseForSampling()
@OptionMetadata(displayName="Num. locations per pixel", description="Number of locations per pixel", displayOrder=4) public void setNumLocationsPerPixel(java.lang.String num)
num - the number of samples to usepublic java.lang.String getNumLocationsPerPixel()
@OptionMetadata(displayName="Kernel bandwidth (k)", description="Kernel bandwidth", displayOrder=4) public void setKernelBandwidth(java.lang.String band)
band - the bandwidthpublic java.lang.String getKernelBandwidth()
@OptionMetadata(displayName="Image width (pixels)", description="Image width in pixels", displayOrder=5) public void setImageWidth(int width)
width - the width to usepublic int getImageWidth()
@OptionMetadata(displayName="Image height (pixels)", description="Image height in pixels", displayOrder=6) public void setImageHeight(int height)
height - the height to usepublic int getImageHeight()
@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)
max - maximum number of rows to compute in parallelpublic int getComputeMaxRowsInParallel()
@OptionMetadata(displayName="Plot training points", description="Superimpose the training data over the top of the plot", displayOrder=8) public void setPlotTrainingData(boolean plot)
plot - true to plot the training datapublic boolean getPlotTrainingData()
public void stepInit()
throws WekaException
stepInit in interface BaseStepExtenderstepInit in interface StepWekaException - if a problem occurs during initializationprotected void computeMinMaxAtts(Instances trainingData)
protected int getAttIndex(java.lang.String attName,
Instances data)
throws WekaException
WekaExceptionprotected void initDataGenerator(Instances trainingData) throws WekaException
WekaExceptionpublic void processIncoming(Data data) throws WekaException
BaseStepprocessIncoming in interface BaseStepExtenderprocessIncoming in interface StepprocessIncoming in class BaseStepdata - the payload to processWekaException - if a problem occursprotected void doScheme(Classifier classifier, DensityBasedClusterer clust, Instances trainingData, int setNum, int maxSetNum) throws WekaException
WekaExceptionprotected java.lang.String makeSchemeSpec(java.lang.Object scheme,
int setNum,
int maxSetNum)
protected void plotPoint(java.awt.image.BufferedImage osi,
int x,
int y,
double[] probs,
boolean update)
public void plotTrainingData(Instances trainingData)
public java.util.List<java.lang.String> getIncomingConnectionTypes()
getIncomingConnectionTypes in interface BaseStepExtendergetIncomingConnectionTypes in interface Steppublic java.util.List<java.lang.String> getOutgoingConnectionTypes()
getOutgoingConnectionTypes in interface BaseStepExtendergetOutgoingConnectionTypes in interface Steppublic java.util.Map<java.lang.String,java.awt.image.BufferedImage> getImages()
public java.awt.image.BufferedImage getCurrentImage()
public void setRenderingListener(BoundaryPlotter.RenderingUpdateListener l)
l - the RenderingUpdateListener to addpublic void removeRenderingListener(BoundaryPlotter.RenderingUpdateListener l)
l - the RenderingUpdateListener to removepublic java.util.Map<java.lang.String,java.lang.String> getInteractiveViewers()
getInteractiveViewers in interface StepgetInteractiveViewers in class BaseSteppublic java.lang.String getCustomEditorForStep()
getCustomEditorForStep in interface StepgetCustomEditorForStep in class BaseSteppublic java.lang.Object retrieveData()
retrieveData in interface DataCollectorpublic void restoreData(java.lang.Object data)
throws WekaException
restoreData in interface DataCollectordata - the images to setWekaException - if a problem occurs