costmatrix.html

来自「weka是机器学习和数据挖掘领域最有影响力的开源项目之一」· HTML 代码 · 共 898 行 · 第 1/3 页

HTML
898
字号
        java.lang.Object&nbsp;value)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the value of a particular cell in the matrix</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#setElement(int, int, double)">setElement</A></B>(int&nbsp;rowIndex,           int&nbsp;columnIndex,           double&nbsp;value)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the value of a cell as a double</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#size()">size</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The number of rows (and columns)</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#toMatlab()">toMatlab</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;converts the Matrix into a single line Matlab string: matrix is enclosed  by parentheses, rows are separated by semicolon and single cells by blanks, e.g., [1 2; 3 4].</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#toString()">toString</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts a matrix to a string.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#write(java.io.Writer)">write</A></B>(java.io.Writer&nbsp;w)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Writes out a matrix.</TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>equals, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD></TR></TABLE>&nbsp;<P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Field Detail</B></FONT></TH></TR></TABLE><A NAME="FILE_EXTENSION"><!-- --></A><H3>FILE_EXTENSION</H3><PRE>public static java.lang.String <B>FILE_EXTENSION</B></PRE><DL><DD>The deafult file extension for cost matrix files<P><DL></DL></DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TH></TR></TABLE><A NAME="CostMatrix(int)"><!-- --></A><H3>CostMatrix</H3><PRE>public <B>CostMatrix</B>(int&nbsp;numOfClasses)</PRE><DL><DD>Creates a default cost matrix of a particular size.  All diagonal values will be 0 and all non-diagonal values 1.<P><DL><DT><B>Parameters:</B><DD><CODE>numOfClasses</CODE> - the number of classes that the cost matrix holds.</DL></DL><HR><A NAME="CostMatrix(weka.classifiers.CostMatrix)"><!-- --></A><H3>CostMatrix</H3><PRE>public <B>CostMatrix</B>(<A HREF="../../weka/classifiers/CostMatrix.html" title="class in weka.classifiers">CostMatrix</A>&nbsp;toCopy)</PRE><DL><DD>Creates a cost matrix that is a copy of another.<P><DL><DT><B>Parameters:</B><DD><CODE>toCopy</CODE> - the matrix to copy.</DL></DL><HR><A NAME="CostMatrix(java.io.Reader)"><!-- --></A><H3>CostMatrix</H3><PRE>public <B>CostMatrix</B>(java.io.Reader&nbsp;reader)           throws java.lang.Exception</PRE><DL><DD>Reads a matrix from a reader. The first line in the file should contain the number of rows and columns. Subsequent lines contain elements of the matrix.  (FracPete: taken from old weka.core.Matrix class)<P><DL><DT><B>Parameters:</B><DD><CODE>reader</CODE> - the reader containing the matrix<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if an error occurs<DT><B>See Also:</B><DD><A HREF="../../weka/classifiers/CostMatrix.html#write(java.io.Writer)"><CODE>write(Writer)</CODE></A></DL></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="initialize()"><!-- --></A><H3>initialize</H3><PRE>public void <B>initialize</B>()</PRE><DL><DD>Initializes the matrix<P><DD><DL></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="size()"><!-- --></A><H3>size</H3><PRE>public int <B>size</B>()</PRE><DL><DD>The number of rows (and columns)<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the size of the matrix</DL></DD></DL><HR><A NAME="numColumns()"><!-- --></A><H3>numColumns</H3><PRE>public int <B>numColumns</B>()</PRE><DL><DD>Same as size<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of columns</DL></DD></DL><HR><A NAME="numRows()"><!-- --></A><H3>numRows</H3><PRE>public int <B>numRows</B>()</PRE><DL><DD>Same as size<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of rows</DL></DD></DL><HR><A NAME="applyCostMatrix(weka.core.Instances, java.util.Random)"><!-- --></A><H3>applyCostMatrix</H3><PRE>public <A HREF="../../weka/core/Instances.html" title="class in weka.core">Instances</A> <B>applyCostMatrix</B>(<A HREF="../../weka/core/Instances.html" title="class in weka.core">Instances</A>&nbsp;data,                                 java.util.Random&nbsp;random)                          throws java.lang.Exception</PRE><DL><DD>Applies the cost matrix to a set of instances. If a random number generator is  supplied the instances will be resampled, otherwise they will be rewighted.  Adapted from code once sitting in Instances.java<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>data</CODE> - the instances to reweight.<DD><CODE>random</CODE> - a random number generator for resampling, if null then instances are rewighted.<DT><B>Returns:</B><DD>a new dataset reflecting the cost of misclassification.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if the data has no class or the matrix in inappropriate.</DL></DD></DL><HR><A NAME="expectedCosts(double[])"><!-- --></A><H3>expectedCosts</H3><PRE>public double[] <B>expectedCosts</B>(double[]&nbsp;classProbs)                       throws java.lang.Exception</PRE><DL><DD>Calculates the expected misclassification cost for each possible class value, given class probability estimates.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>classProbs</CODE> - the class probability estimates.<DT><B>Returns:</B><DD>the expected costs.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if the wrong number of class probabilities is supplied.</DL></DD></DL><HR><A NAME="expectedCosts(double[], weka.core.Instance)"><!-- --></A><H3>expectedCosts</H3><PRE>public double[] <B>expectedCosts</B>(double[]&nbsp;classProbs,                              <A HREF="../../weka/core/Instance.html" title="class in weka.core">Instance</A>&nbsp;inst)                       throws java.lang.Exception</PRE><DL><DD>Calculates the expected misclassification cost for each possible class value, given class probability estimates.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>classProbs</CODE> - the class probability estimates.<DD><CODE>inst</CODE> - the current instance for which the class probabilites apply. Is used for computing any non-fixed cost values.<DT><B>Returns:</B><DD>the expected costs.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if something goes wrong</DL></DD></DL><HR><A NAME="getMaxCost(int)"><!-- --></A><H3>getMaxCost</H3><PRE>public double <B>getMaxCost</B>(int&nbsp;classVal)                  throws java.lang.Exception</PRE><DL><DD>Gets the maximum cost for a particular class value.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>classVal</CODE> - the class value.<DT><B>Returns:</B><DD>the maximum cost.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if cost matrix contains non-fixed costs</DL></DD></DL><HR>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?