📄 costmatrix.html
字号:
<P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></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"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><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><DT><B>Parameters:</B><DD><CODE>toCopy</CODE> - the matrix to copy.</DL><HR><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 values will be 0.<P><DT><B>Parameters:</B><DD><CODE>numOfClasses</CODE> - the number of classes that the cost matrix holds.</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>Creates a cost matrix from a reader.<P><DT><B>Parameters:</B><DD><CODE>reader</CODE> - the reader to get the values from.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if the matrix is invalid.</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="initialize()"><!-- --></A><H3>initialize</H3><PRE>public void <B>initialize</B>()</PRE><DL><DD>Sets the cost of all correct classifications to 0, and all misclassifications to 1.<P><DD><DL></DL></DD></DL><HR><A NAME="size()"><!-- --></A><H3>size</H3><PRE>public int <B>size</B>()</PRE><DL><DD>Gets the size of the matrix.<P><DD><DL><DT><B>Returns:</B><DD>the size.</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><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><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="getMaxCost(int)"><!-- --></A><H3>getMaxCost</H3><PRE>public double <B>getMaxCost</B>(int classVal)</PRE><DL><DD>Gets the maximum cost for a particular class value.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>classVal</CODE> - the class value.<DT><B>Returns:</B><DD>the maximum cost.</DL></DD></DL><HR><A NAME="normalize()"><!-- --></A><H3>normalize</H3><PRE>public void <B>normalize</B>()</PRE><DL><DD>Normalizes the matrix so that the diagonal contains zeros.<P><DD><DL></DL></DD></DL><HR><A NAME="readOldFormat(java.io.Reader)"><!-- --></A><H3>readOldFormat</H3><PRE>public void <B>readOldFormat</B>(java.io.Reader reader) throws java.lang.Exception</PRE><DL><DD>Loads a cost matrix in the old format from a reader. Adapted from code once sitting in Instances.java<P><DD><DL><DT><B>Parameters:</B><DD><CODE>reader</CODE> - the reader to get the values from.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if the matrix cannot be read correctly.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" 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_bottom_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/Classifier.html" title="class in weka.classifiers"><B>PREV CLASS</B></A> <A HREF="../../weka/classifiers/Evaluation.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="CostMatrix.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 | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -