costmatrix.html
来自「数据挖掘的最常用工具。由于开源」· HTML 代码 · 共 923 行 · 第 1/3 页
HTML
923 行
java.lang.Object value)</CODE><BR> 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> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#setElement(int, int, double)">setElement</A></B>(int rowIndex, int columnIndex, double value)</CODE><BR> 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> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#size()">size</A></B>()</CODE><BR> The number of rows (and columns)</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#toMatlab()">toMatlab</A></B>()</CODE><BR> 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> java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#toString()">toString</A></B>()</CODE><BR> Converts a matrix to a string.</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/CostMatrix.html#write(java.io.Writer)">write</A></B>(java.io.Writer w)</CODE><BR> Writes out a matrix.</TD></TR></TABLE> <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> <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 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> 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 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> data, java.util.Random 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[] 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[] classProbs, <A HREF="../../weka/core/Instance.html" title="class in weka.core">Instance</A> 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 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><A NAME="getMaxCost(int, weka.core.Instance)"><!-- --></A><H3>getMaxCost</H3><PRE>public double <B>getMaxCost</B>(int classVal, <A HREF="../../weka/core/Instance.html" title="class in weka.core">Instance</A> inst) throws java.lang.Exception</PRE><DL>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?