Example usage for weka.classifiers.evaluation ThresholdCurve PRECISION_NAME

List of usage examples for weka.classifiers.evaluation ThresholdCurve PRECISION_NAME

Introduction

In this page you can find the example usage for weka.classifiers.evaluation ThresholdCurve PRECISION_NAME.

Prototype

String PRECISION_NAME

To view the source code for weka.classifiers.evaluation ThresholdCurve PRECISION_NAME.

Click Source Link

Document

attribute name: Precision

Usage

From source file:meka.gui.explorer.classify.ShowMacroCurve.java

License:Open Source License

/**
 * Returns the name of the default Y column to display.
 *
 * @return              the name of the column
 *//*from   w w  w .j  a v  a2 s  .  co m*/
protected String getDefaultYColumn() {
    return ThresholdCurve.PRECISION_NAME;
}

From source file:meka.gui.guichooser.PrecisionRecallCurve.java

License:Open Source License

/**
 * Called by the menu items action listener.
 *//*www.  j a  va  2s  .c om*/
@Override
protected void launch() {
    m_FileChooser = GUIHelper.newConverterFileChooser();
    // choose file
    int retVal = m_FileChooser.showOpenDialog(null);
    if (retVal != JFileChooser.APPROVE_OPTION)
        return;
    File file = m_FileChooser.getSelectedFile();

    // create plot
    Instances data;
    try {
        data = m_FileChooser.getLoader().getDataSet();
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, "Error loading file '" + file + "':\n" + e, "Error",
                JOptionPane.ERROR_MESSAGE);
        e.printStackTrace();
        return;
    }
    data.setClassIndex(data.numAttributes() - 1);
    ThresholdVisualizePanel vmc = new ThresholdVisualizePanel();
    vmc.setROCString("(Area under PRC = " + Utils.doubleToString(ThresholdCurve.getPRCArea(data), 4) + ")");
    vmc.setName(data.relationName());
    PlotData2D tempd = new PlotData2D(data);
    tempd.setPlotName(data.relationName());
    tempd.m_displayAllPoints = true;
    // specify which points are connected
    boolean[] cp = new boolean[data.numInstances()];
    for (int n = 1; n < cp.length; n++)
        cp[n] = true;
    try {
        tempd.setConnectPoints(cp);
        vmc.addPlot(tempd);
        if (data.attribute(ThresholdCurve.RECALL_NAME) != null)
            vmc.setXIndex(data.attribute(ThresholdCurve.RECALL_NAME).index());
        if (data.attribute(ThresholdCurve.PRECISION_NAME) != null)
            vmc.setYIndex(data.attribute(ThresholdCurve.PRECISION_NAME).index());
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, "Error adding plot:\n" + e, "Error", JOptionPane.ERROR_MESSAGE);
        e.printStackTrace();
        return;
    }

    MekaFrame frame = new MekaFrame();
    frame.setTitle(getName());
    frame.setDefaultCloseOperation(MekaFrame.DISPOSE_ON_CLOSE);
    frame.getContentPane().setLayout(new BorderLayout());
    frame.getContentPane().add(vmc);
    frame.setSize(800, 600);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}