public class ClustererAssignmentsPlotInstances extends AbstractPlotInstances
Instances train = ... // from somewhere
Instances test = ... // from somewhere
Clusterer cls = ... // from somewhere
// build and evaluate clusterer
cls.buildClusterer(train);
ClusterEvaluation eval = new ClusterEvaluation();
eval.setClusterer(cls);
eval.evaluateClusterer(test);
// generate plot instances
ClustererPlotInstances plotInstances = new ClustererPlotInstances();
plotInstances.setClusterer(cls);
plotInstances.setInstances(test);
plotInstances.setClusterer(cls);
plotInstances.setClusterEvaluation(eval);
plotInstances.setUp();
// generate visualization
VisualizePanel visPanel = new VisualizePanel();
visPanel.addPlot(plotInstances.getPlotData("plot name"));
// clean up
plotInstances.cleanUp();
| Modifier and Type | Field and Description |
|---|---|
protected Clusterer |
m_Clusterer
the clusterer being used.
|
protected ClusterEvaluation |
m_Evaluation
the cluster evaluation to use.
|
protected int[] |
m_PlotShapes
for storing the plot shapes.
|
m_FinishUpCalled, m_Instances, m_PlotInstances| Constructor and Description |
|---|
ClustererAssignmentsPlotInstances() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
check()
Checks whether clusterer and evaluation are provided.
|
void |
cleanUp()
For freeing up memory.
|
protected PlotData2D |
createPlotData(java.lang.String name)
Assembles and returns the plot.
|
protected void |
determineFormat()
Sets up the structure for the plot instances.
|
protected void |
finishUp()
Performs optional post-processing.
|
Clusterer |
getClusterer()
Returns the currently set clusterer.
|
ClusterEvaluation |
getClusterEvaluation()
Returns the cluster evaluation object in use.
|
protected void |
initialize()
Initializes the members.
|
protected void |
process()
Generates the cluster assignments.
|
void |
setClusterer(Clusterer value)
Sets the classifier used for making the predictions.
|
void |
setClusterEvaluation(ClusterEvaluation value)
Sets the cluster evaluation object to use.
|
canPlot, getInstances, getOptions, getPlotData, getPlotInstances, listOptions, setInstances, setOptions, setUpprotected int[] m_PlotShapes
protected Clusterer m_Clusterer
protected ClusterEvaluation m_Evaluation
protected void initialize()
initialize in class AbstractPlotInstancespublic void setClusterer(Clusterer value)
value - the clusterer to usepublic Clusterer getClusterer()
public void setClusterEvaluation(ClusterEvaluation value)
value - the evaluation objectpublic ClusterEvaluation getClusterEvaluation()
protected void check()
check in class AbstractPlotInstancesprotected void determineFormat()
determineFormat in class AbstractPlotInstancesprotected void process()
m_PlotShapes,
#m_PlotSizes,
AbstractPlotInstances.m_PlotInstancesprotected void finishUp()
finishUp in class AbstractPlotInstancesprotected PlotData2D createPlotData(java.lang.String name) throws java.lang.Exception
createPlotData in class AbstractPlotInstancesname - the name of the plotjava.lang.Exception - if plot generation failspublic void cleanUp()
cleanUp in class AbstractPlotInstances