📄 costmatrix.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Wed Sep 04 10:31:48 CDT 2002 --><TITLE>: Class CostMatrix</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <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="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</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"><B>PREV CLASS</B></A> <A HREF="../../weka/classifiers/CostSensitiveClassifier.html"><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></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <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><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">weka.classifiers</FONT><BR>Class CostMatrix</H2><PRE>java.lang.Object | +--<A HREF="../../weka/core/Matrix.html">weka.core.Matrix</A> | +--<B>weka.classifiers.CostMatrix</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD>java.lang.Cloneable, java.io.Serializable</DD></DL><HR><DL><DT>public class <B>CostMatrix</B><DT>extends <A HREF="../../weka/core/Matrix.html">Matrix</A></DL><P>Class for a misclassification cost matrix. The element in the i'th column of the j'th row is the cost for (mis)classifying an instance of class j as having class i. It is valid to have non-zero values down the diagonal (these are typically negative to indicate some varying degree of "gain" from making a correct prediction).<P><DL><DT><B>See Also: </B><DD><A HREF="../../serialized-form.html#weka.classifiers.CostMatrix">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></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/CostMatrix.html#FILE_EXTENSION">FILE_EXTENSION</A></B></CODE><BR> The filename extension that should be used for cost files</TD></TR></TABLE> <A NAME="fields_inherited_from_class_weka.core.Matrix"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from class weka.core.<A HREF="../../weka/core/Matrix.html">Matrix</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../weka/core/Matrix.html#m_Elements">m_Elements</A></CODE></TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><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/CostMatrix.html#CostMatrix(weka.classifiers.CostMatrix)">CostMatrix</A></B>(<A HREF="../../weka/classifiers/CostMatrix.html">CostMatrix</A> toCopy)</CODE><BR> Creates a cost matrix identical to an existing matrix.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#CostMatrix(int)">CostMatrix</A></B>(int numClasses)</CODE><BR> Creates a default cost matrix for the given number of classes.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#CostMatrix(java.io.Reader)">CostMatrix</A></B>(java.io.Reader r)</CODE><BR> Creates a cost matrix from a cost file.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><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> <A HREF="../../weka/core/Instances.html">Instances</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#applyCostMatrix(weka.core.Instances, java.util.Random)">applyCostMatrix</A></B>(<A HREF="../../weka/core/Instances.html">Instances</A> instances, java.util.Random random)</CODE><BR> Changes the dataset to reflect a given set of costs.</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/CostMatrix.html#expectedCosts(double[])">expectedCosts</A></B>(double[] probabilities)</CODE><BR> Calculates the expected misclassification cost for each possible class value, given class probability estimates.</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/CostMatrix.html#getMaxCost(int)">getMaxCost</A></B>(int actualClass)</CODE><BR> Gets the maximum misclassification cost possible for a given actual class value</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#initialize()">initialize</A></B>()</CODE><BR> Sets the costs to default values (i.e.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#main(java.lang.String[])">main</A></B>(java.lang.String[] args)</CODE><BR> Tests out creation of a frequency dependent cost matrix from the command line.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../weka/classifiers/CostMatrix.html">CostMatrix</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostMatrix.html#makeFrequencyDependentMatrix(weka.core.Instances, double)">makeFrequencyDependentMatrix</A></B>(<A HREF="../../weka/core/Instances.html">Instances</A> instances, double weight)</CODE><BR> Creates a cost matrix for the class attribute of the supplied instances, where the misclassification costs are higher for misclassifying a rare class as a frequent one.</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#normalize()">normalize</A></B>()</CODE><BR> Normalizes the cost matrix so that diagonal elements are zero.</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#readOldFormat(java.io.Reader)">readOldFormat</A></B>(java.io.Reader reader)</CODE><BR> Reads misclassification cost matrix from given reader.</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> Gets the number of classes.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_weka.core.Matrix"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class weka.core.<A HREF="../../weka/core/Matrix.html">Matrix</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../weka/core/Matrix.html#add(weka.core.Matrix)">add</A>, <A HREF="../../weka/core/Matrix.html#addElement(int, int, double)">addElement</A>, <A HREF="../../weka/core/Matrix.html#clone()">clone</A>, <A HREF="../../weka/core/Matrix.html#getElement(int, int)">getElement</A>, <A HREF="../../weka/core/Matrix.html#lubksb(int[], double[])">lubksb</A>, <A HREF="../../weka/core/Matrix.html#ludcmp()">ludcmp</A>, <A HREF="../../weka/core/Matrix.html#multiply(weka.core.Matrix)">multiply</A>, <A HREF="../../weka/core/Matrix.html#numColumns()">numColumns</A>, <A HREF="../../weka/core/Matrix.html#numRows()">numRows</A>, <A HREF="../../weka/core/Matrix.html#regression(weka.core.Matrix)">regression</A>, <A HREF="../../weka/core/Matrix.html#regression(weka.core.Matrix, double[])">regression</A>, <A HREF="../../weka/core/Matrix.html#setColumn(int, double[])">setColumn</A>, <A HREF="../../weka/core/Matrix.html#setElement(int, int, double)">setElement</A>, <A HREF="../../weka/core/Matrix.html#setRow(int, double[])">setRow</A>, <A HREF="../../weka/core/Matrix.html#toString()">toString</A>, <A HREF="../../weka/core/Matrix.html#transpose()">transpose</A>, <A HREF="../../weka/core/Matrix.html#write(java.io.Writer)">write</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.Object</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -