weka.gui.explorer.ClassifierErrorsPlotInstances Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weka-dev Show documentation
Show all versions of weka-dev Show documentation
The Waikato Environment for Knowledge Analysis (WEKA), a machine
learning workbench. This version represents the developer version, the
"bleeding edge" of development, you could say. New functionality gets added
to this version.
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/*
* ClassifierErrorsPlotInstances.java
* Copyright (C) 2009-2012 University of Waikato, Hamilton, New Zealand
*/
package weka.gui.explorer;
import java.util.ArrayList;
import weka.classifiers.Classifier;
import weka.classifiers.Evaluation;
import weka.classifiers.IntervalEstimator;
import weka.classifiers.evaluation.NumericPrediction;
import weka.classifiers.evaluation.Prediction;
import weka.core.Attribute;
import weka.core.DenseInstance;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Utils;
import weka.gui.visualize.Plot2D;
import weka.gui.visualize.PlotData2D;
/**
* A class for generating plottable visualization errors.
*
* Example usage:
*
*
* Instances train = ... // from somewhere
* Instances test = ... // from somewhere
* Classifier cls = ... // from somewhere
* // build classifier
* cls.buildClassifier(train);
* // evaluate classifier and generate plot instances
* ClassifierPlotInstances plotInstances = new ClassifierPlotInstances();
* plotInstances.setClassifier(cls);
* plotInstances.setInstances(train);
* plotInstances.setClassIndex(train.classIndex());
* plotInstances.setUp();
* Evaluation eval = new Evaluation(train);
* for (int i = 0; i < test.numInstances(); i++)
* plotInstances.process(test.instance(i), cls, eval);
* // generate visualization
* VisualizePanel visPanel = new VisualizePanel();
* visPanel.addPlot(plotInstances.getPlotData("plot name"));
* visPanel.setColourIndex(plotInstances.getPlotInstances().classIndex()+1);
* // clean up
* plotInstances.cleanUp();
*
*
* @author fracpete (fracpete at waikato dot ac dot nz)
* @version $Revision: 10220 $
*/
public class ClassifierErrorsPlotInstances extends AbstractPlotInstances {
/** for serialization. */
private static final long serialVersionUID = -3941976365792013279L;
/** the minimum plot size for numeric errors. */
protected int m_MinimumPlotSizeNumeric;
/** the maximum plot size for numeric errors. */
protected int m_MaximumPlotSizeNumeric;
/**
* whether to save the instances for visualization or just evaluate the
* instance.
*/
protected boolean m_SaveForVisualization;
protected boolean m_pointSizeProportionalToMargin;
/** for storing the plot shapes. */
protected ArrayList m_PlotShapes;
/** for storing the plot sizes. */
protected ArrayList
© 2015 - 2024 Weber Informatics LLC | Privacy Policy