📄 evaluation.html
字号:
</TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="Evaluation(weka.core.Instances)"><!-- --></A><H3>Evaluation</H3><PRE>public <B>Evaluation</B>(<A HREF="../../weka/core/Instances.html" title="class in weka.core">Instances</A> data) throws java.lang.Exception</PRE><DL><DD>Initializes all the counters for the evaluation.<P><DT><B>Parameters:</B><DD><CODE>data</CODE> - set of training instances, to get some header information and prior class distribution information<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if the class is not defined</DL><HR><A NAME="Evaluation(weka.core.Instances, weka.classifiers.CostMatrix)"><!-- --></A><H3>Evaluation</H3><PRE>public <B>Evaluation</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) throws java.lang.Exception</PRE><DL><DD>Initializes all the counters for the evaluation and also takes a cost matrix as parameter.<P><DT><B>Parameters:</B><DD><CODE>data</CODE> - set of instances, to get some header information<DD><CODE>costMatrix</CODE> - the cost matrix---if null, default costs will be used<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if cost matrix is not compatible with data, the class is not defined or the class is numeric</DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="confusionMatrix()"><!-- --></A><H3>confusionMatrix</H3><PRE>public double[][] <B>confusionMatrix</B>()</PRE><DL><DD>Returns a copy of the confusion matrix.<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>a copy of the confusion matrix as a two-dimensional array</DL></DD></DL><HR><A NAME="crossValidateModel(weka.classifiers.Classifier, weka.core.Instances, int, java.util.Random)"><!-- --></A><H3>crossValidateModel</H3><PRE>public void <B>crossValidateModel</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) throws java.lang.Exception</PRE><DL><DD>Performs a (stratified if class is nominal) cross-validation for a classifier on a set of instances.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>classifier</CODE> - the classifier with any options set.<DD><CODE>data</CODE> - the data on which the cross-validation is to be performed<DD><CODE>numFolds</CODE> - the number of folds for the cross-validation<DD><CODE>random</CODE> - random number generator for randomization<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if a classifier could not be generated successfully or the class is not defined</DL></DD></DL><HR><A NAME="crossValidateModel(java.lang.String, weka.core.Instances, int, java.lang.String[], java.util.Random)"><!-- --></A><H3>crossValidateModel</H3><PRE>public void <B>crossValidateModel</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) throws java.lang.Exception</PRE><DL><DD>Performs a (stratified if class is nominal) cross-validation for a classifier on a set of instances.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>data</CODE> - the data on which the cross-validation is to be performed<DD><CODE>numFolds</CODE> - the number of folds for the cross-validation<DD><CODE>options</CODE> - the options to the classifier. Any options<DD><CODE>random</CODE> - the random number generator for randomizing the data accepted by the classifier will be removed from this array.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if a classifier could not be generated successfully or the class is not defined</DL></DD></DL><HR><A NAME="evaluateModel(java.lang.String, java.lang.String[])"><!-- --></A><H3>evaluateModel</H3><PRE>public static java.lang.String <B>evaluateModel</B>(java.lang.String classifierString, java.lang.String[] options) throws java.lang.Exception</PRE><DL><DD>Evaluates a classifier with the options given in an array of strings. <p> Valid options are: <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 detailed 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><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>classifierString</CODE> - class of machine learning classifier as a string<DD><CODE>options</CODE> - the array of string containing the options<DT><B>Returns:</B><DD>a string describing the results<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if model could not be evaluated successfully</DL></DD></DL><HR><A NAME="main(java.lang.String[])"><!-- --></A><H3>main</H3><PRE>public static void <B>main</B>(java.lang.String[] args)</PRE><DL><DD>A test method for this class. Just extracts the first command line argument as a classifier class name and calls evaluateModel.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>args</CODE> - an array of command line arguments, the first of which must be the class name of a classifier.</DL></DD></DL><HR><A NAME="evaluateModel(weka.classifiers.Classifier, java.lang.String[])"><!-- --></A><H3>evaluateModel</H3><PRE>public static java.lang.String <B>evaluateModel</B>(<A HREF="../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</A> classifier, java.lang.String[] options) throws java.lang.Exception</PRE><DL><DD>Evaluates a classifier with the options given in an array of strings. <p> Valid options are: <p> -t name of training file <br> Name of the file with the training data. (required) <p> -T name of test file <br> Name of the file with the test data. If missing a cross-validation is performed. <p> -c class index <br> Index of the class attribute (1, 2, ...; default: last). <p> -x number of folds <br> The number of folds for the cross-validation (default: 10). <p> -s random number seed <br> Random number seed for the cross-validation (default: 1). <p> -m file with cost matrix <br> The name of a file containing a cost matrix. <p> -l name of model input file <br> Loads classifier from the given file. <p> -d name of model output file <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 detailed information-retrieval statistics per class. <p> -k <br> Outputs information-theoretic statistics. <p> -p <br> Outputs predictions for test instances (and nothing else). <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><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>classifier</CODE> - machine learning classifier<DD><CODE>options</CODE> - the array of string containing the options<DT><B>Returns:</B><DD>a string describing the results<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if model could not be evaluated successfully</DL></DD></DL><HR><A NAME="evaluateModel(weka.classifiers.Classifier, weka.core.Instances)"><!-- --></A><H3>evaluateModel</H3><PRE>public double[] <B>evaluateModel</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) throws java.lang.Exception</PRE><DL><DD>Evaluates the classifier on a given set of instances. Note that the data must have exactly the same format (e.g. order of attributes) as the data used to train the classifier! Otherwise the results will generally be meaningless.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>classifier</CODE> - machine learning classifier<DD><CODE>data</CODE> - set of test instances for evaluation<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if model could not be evaluated successfully</DL></DD></DL><HR><A NAME="evaluateModelOnce(weka.classifiers.Classifier, weka.core.Instance)"><!-- --></A><H3>evaluateModelOnce</H3><PRE>public double <B>evaluateModelOnce</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) throws java.lang.Exception</PRE><DL><DD>Evaluates the classifier on a single instance.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>classifier</CODE> - machine learning classifier<DD><CODE>instance</CODE> - the test instance to be classified<DT><B>Returns:</B><DD>the prediction made by the clasifier<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if model could not be evaluated successfully or the data contains string attributes</DL></DD></DL><HR><A NAME="evaluateModelOnce(double[], weka.core.Instance)"><!-- --></A><H3>evaluateModelOnce</H3><PRE>public double <B>evaluateModelOnce</B>(double[] dist, <A HREF="../../weka/core/Instance.html" title="class in weka.core">Instance</A> instance) throws java.lang.Exception</PRE><DL><DD>Evaluates the supplied distribution on a single instance.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>dist</CODE> - the supplied distribution<DD><CODE>instance</CODE> - the test instance to be classified<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if model could not be evaluated successfully</DL></DD></DL><HR><A NAME="evaluateModelOnce(double, weka.core.Instance)"><!-- --></A><H3>evaluateModelOnce</H3><PRE>public void <B>evaluateModelOnce</B>(double prediction, <A HREF="../../weka/core/Instance.html" title="class in weka.core">Instance</A> instance) throws java.lang.Exception</PRE><DL><DD>Evaluates the supplied prediction on a single instance.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>prediction</CODE> - the supplied prediction<DD><CODE>instance</CODE> - the test instance to be classified<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if model could not be evaluated successfully</DL></DD></DL><HR><A NAME="numInstances()"><!-- --></A><H3>numInstances</H3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -