List of usage examples for weka.gui.visualize PlotData2D setPlotName
public void setPlotName(String name)
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); }