📄 evaluation.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.4.2_05) on Mon Mar 07 15:27:13 NZDT 2005 --><TITLE>Evaluation</TITLE><META NAME="keywords" CONTENT="weka.classifiers.Evaluation class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="Evaluation";}</SCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../Tutorial.pdf"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="http://www.cs.waikato.ac.nz/ml/weka/index.html"><FONT CLASS="NavBarFont1"><B>Weka's home</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../weka/classifiers/CostMatrix.html" title="class in weka.classifiers"><B>PREV CLASS</B></A> <A HREF="../../weka/classifiers/IteratedSingleClassifierEnhancer.html" title="class in weka.classifiers"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" target="_top"><B>FRAMES</B></A> <A HREF="Evaluation.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">weka.classifiers</FONT><BR>Class Evaluation</H2><PRE>java.lang.Object <IMG SRC="../../resources/inherit.gif" ALT="extended by"><B>weka.classifiers.Evaluation</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../weka/core/Summarizable.html" title="interface in weka.core">Summarizable</A></DD></DL><HR><DL><DT>public class <B>Evaluation</B><DT>extends java.lang.Object<DT>implements <A HREF="../../weka/core/Summarizable.html" title="interface in weka.core">Summarizable</A></DL><P>Class for evaluating machine learning models. <p> ------------------------------------------------------------------- <p> General options when evaluating a learning scheme from the command-line: <p> -t filename <br> Name of the file with the training data. (required) <p> -T filename <br> Name of the file with the test data. If missing a cross-validation is performed. <p> -c index <br> Index of the class attribute (1, 2, ...; default: last). <p> -x number <br> The number of folds for the cross-validation (default: 10). <p> -s seed <br> Random number seed for the cross-validation (default: 1). <p> -m filename <br> The name of a file containing a cost matrix. <p> -l filename <br> Loads classifier from the given file. <p> -d filename <br> Saves classifier built from the training data into the given file. <p> -v <br> Outputs no statistics for the training data. <p> -o <br> Outputs statistics only, not the classifier. <p> -i <br> Outputs information-retrieval statistics per class. <p> -k <br> Outputs information-theoretic statistics. <p> -p range <br> Outputs predictions for test instances, along with the attributes in the specified range (and nothing else). Use '-p 0' if no attributes are desired. <p> -r <br> Outputs cumulative margin distribution (and nothing else). <p> -g <br> Only for classifiers that implement "Graphable." Outputs the graph representation of the classifier (and nothing else). <p> ------------------------------------------------------------------- <p> Example usage as the main of a classifier (called FunkyClassifier): <code> <pre> public static void main(String [] args) { try { Classifier scheme = new FunkyClassifier(); System.out.println(Evaluation.evaluateModel(scheme, args)); } catch (Exception e) { System.err.println(e.getMessage()); } } </pre> </code> <p> ------------------------------------------------------------------ <p> Example usage from within an application: <code> <pre> Instances trainInstances = ... instances got from somewhere Instances testInstances = ... instances got from somewhere Classifier scheme = ... scheme got from somewhere Evaluation evaluation = new Evaluation(trainInstances); evaluation.evaluateModel(scheme, testInstances); System.out.println(evaluation.toSummaryString()); </pre> </code><P><P><DL><DT><B>Version:</B></DT> <DD>$Revision: 1.53.2.2 $</DD><DT><B>Author:</B></DT> <DD>Eibe Frank (eibe@cs.waikato.ac.nz), Len Trigg (trigg@cs.waikato.ac.nz)</DD></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#Evaluation(weka.core.Instances)">Evaluation</A></B>(<A HREF="../../weka/core/Instances.html" title="class in weka.core">Instances</A> data)</CODE><BR> Initializes all the counters for the evaluation.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#Evaluation(weka.core.Instances, weka.classifiers.CostMatrix)">Evaluation</A></B>(<A HREF="../../weka/core/Instances.html" title="class in weka.core">Instances</A> data, <A HREF="../../weka/classifiers/CostMatrix.html" title="class in weka.classifiers">CostMatrix</A> costMatrix)</CODE><BR> Initializes all the counters for the evaluation and also takes a cost matrix as parameter.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> double</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#avgCost()">avgCost</A></B>()</CODE><BR> Gets the average cost, that is, total cost of misclassifications (incorrect plus unclassified) over the total number of instances.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> double[][]</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#confusionMatrix()">confusionMatrix</A></B>()</CODE><BR> Returns a copy of the confusion matrix.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> double</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#correct()">correct</A></B>()</CODE><BR> Gets the number of instances correctly classified (that is, for which a correct prediction was made).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> double</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#correlationCoefficient()">correlationCoefficient</A></B>()</CODE><BR> Returns the correlation coefficient if the class is numeric.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#crossValidateModel(weka.classifiers.Classifier, weka.core.Instances, int, java.util.Random)">crossValidateModel</A></B>(<A HREF="../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</A> classifier, <A HREF="../../weka/core/Instances.html" title="class in weka.core">Instances</A> data, int numFolds, java.util.Random random)</CODE><BR> Performs a (stratified if class is nominal) cross-validation for a classifier on a set of instances.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#crossValidateModel(java.lang.String, weka.core.Instances, int, java.lang.String[], java.util.Random)">crossValidateModel</A></B>(java.lang.String classifierString, <A HREF="../../weka/core/Instances.html" title="class in weka.core">Instances</A> data, int numFolds, java.lang.String[] options, java.util.Random random)</CODE><BR> Performs a (stratified if class is nominal) cross-validation for a classifier on a set of instances.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#equals(java.lang.Object)">equals</A></B>(java.lang.Object obj)</CODE><BR> Tests whether the current evaluation object is equal to another evaluation object</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> double</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#errorRate()">errorRate</A></B>()</CODE><BR> Returns the estimated error rate or the root mean squared error (if the class is numeric).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> double[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#evaluateModel(weka.classifiers.Classifier, weka.core.Instances)">evaluateModel</A></B>(<A HREF="../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</A> classifier, <A HREF="../../weka/core/Instances.html" title="class in weka.core">Instances</A> data)</CODE><BR> Evaluates the classifier on a given set of instances.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#evaluateModel(weka.classifiers.Classifier, java.lang.String[])">evaluateModel</A></B>(<A HREF="../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</A> classifier, java.lang.String[] options)</CODE><BR> Evaluates a classifier with the options given in an array of strings.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#evaluateModel(java.lang.String, java.lang.String[])">evaluateModel</A></B>(java.lang.String classifierString, java.lang.String[] options)</CODE><BR> Evaluates a classifier with the options given in an array of strings.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> double</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#evaluateModelOnce(weka.classifiers.Classifier, weka.core.Instance)">evaluateModelOnce</A></B>(<A HREF="../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</A> classifier, <A HREF="../../weka/core/Instance.html" title="class in weka.core">Instance</A> instance)</CODE><BR> Evaluates the classifier on a single instance.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> double</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#evaluateModelOnce(double[], weka.core.Instance)">evaluateModelOnce</A></B>(double[] dist, <A HREF="../../weka/core/Instance.html" title="class in weka.core">Instance</A> instance)</CODE><BR> Evaluates the supplied distribution on a single instance.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#evaluateModelOnce(double, weka.core.Instance)">evaluateModelOnce</A></B>(double prediction, <A HREF="../../weka/core/Instance.html" title="class in weka.core">Instance</A> instance)</CODE><BR> Evaluates the supplied prediction on a single instance.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> double</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#falseNegativeRate(int)">falseNegativeRate</A></B>(int classIndex)</CODE><BR> Calculate the false negative rate with respect to a particular class.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> double</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/Evaluation.html#falsePositiveRate(int)">falsePositiveRate</A></B>(int classIndex)</CODE><BR> Calculate the false positive rate with respect to a particular class.</TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -