Example usage for weka.gui.visualize PlotData2D setPlotName

List of usage examples for weka.gui.visualize PlotData2D setPlotName

Introduction

In this page you can find the example usage for weka.gui.visualize PlotData2D setPlotName.

Prototype

public void setPlotName(String name) 

Source Link

Document

Set the name of this plot

Usage

From source file:trainableSegmentation.Weka_Segmentation.java

License:GNU General Public License

/**
 * Display the threshold curve window (for precision/recall, ROC, etc.).
 *
 * @param data input instances/*from   w ww.j a v  a 2s  .  c om*/
 * @param classifier classifier to evaluate
 */
public static void displayGraphs(Instances data, AbstractClassifier classifier) {
    ThresholdCurve tc = new ThresholdCurve();

    FastVector predictions = null;
    try {
        final EvaluationUtils eu = new EvaluationUtils();
        predictions = eu.getTestPredictions(classifier, data);
    } catch (Exception e) {
        IJ.log("Error while evaluating data!");
        e.printStackTrace();
        return;
    }

    Instances result = tc.getCurve(predictions);
    ThresholdVisualizePanel vmc = new ThresholdVisualizePanel();
    vmc.setName(result.relationName() + " (display only)");
    PlotData2D tempd = new PlotData2D(result);
    tempd.setPlotName(result.relationName());
    tempd.addInstanceNumberAttribute();
    try {
        vmc.addPlot(tempd);
    } catch (Exception e) {
        IJ.log("Error while adding plot to visualization panel!");
        e.printStackTrace();
        return;
    }
    String plotName = vmc.getName();
    JFrame jf = new JFrame("Weka Classifier Visualize: " + plotName);
    jf.setSize(500, 400);
    jf.getContentPane().setLayout(new BorderLayout());
    jf.getContentPane().add(vmc, BorderLayout.CENTER);
    jf.setVisible(true);
}