📄 costsensitiveclassifier.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 CostSensitiveClassifier</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/CostMatrix.html"><B>PREV CLASS</B></A> <A HREF="../../weka/classifiers/CVParameterSelection.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="CostSensitiveClassifier.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 CostSensitiveClassifier</H2><PRE>java.lang.Object | +--<A HREF="../../weka/classifiers/Classifier.html">weka.classifiers.Classifier</A> | +--<B>weka.classifiers.CostSensitiveClassifier</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD>java.lang.Cloneable, <A HREF="../../weka/core/Drawable.html">Drawable</A>, <A HREF="../../weka/core/OptionHandler.html">OptionHandler</A>, java.io.Serializable</DD></DL><HR><DL><DT>public class <B>CostSensitiveClassifier</B><DT>extends <A HREF="../../weka/classifiers/Classifier.html">Classifier</A><DT>implements <A HREF="../../weka/core/OptionHandler.html">OptionHandler</A>, <A HREF="../../weka/core/Drawable.html">Drawable</A></DL><P>This metaclassifier makes its base classifier cost-sensitive. Two methods can be used to introduce cost-sensitivity: reweighting training instances according to the total cost assigned to each class; or predicting the class with minimum expected misclassification cost (rather than the most likely class). The minimum expected cost approach requires that the base classifier be a DistributionClassifier. <p> Valid options are:<p> -M <br> Minimize expected misclassification cost. The base classifier must produce probability estimates i.e. a DistributionClassifier). (default is to reweight training instances according to costs per class)<p> -W classname <br> Specify the full class name of a classifier (required).<p> -C cost file <br> File name of a cost matrix to use. If this is not supplied, a cost matrix will be loaded on demand. The name of the on-demand file is the relation name of the training data plus ".cost", and the path to the on-demand file is specified with the -D option.<p> -D directory <br> Name of a directory to search for cost files when loading costs on demand (default current directory). <p> -S seed <br> Random number seed used when reweighting by resampling (default 1).<p> Options after -- are passed to the designated classifier.<p><P><DL><DT><B>See Also: </B><DD><A HREF="../../serialized-form.html#weka.classifiers.CostSensitiveClassifier">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>protected <A HREF="../../weka/classifiers/Classifier.html">Classifier</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#m_Classifier">m_Classifier</A></B></CODE><BR> The classifier</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#m_CostFile">m_CostFile</A></B></CODE><BR> The name of the cost file, for command line options</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="../../weka/classifiers/CostMatrix.html">CostMatrix</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#m_CostMatrix">m_CostMatrix</A></B></CODE><BR> The cost matrix</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#m_MatrixSource">m_MatrixSource</A></B></CODE><BR> Indicates the current cost matrix source</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#m_MinimizeExpectedCost">m_MinimizeExpectedCost</A></B></CODE><BR> True if the costs should be used by selecting the minimum expected cost (false means weight training data by the costs)</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected java.io.File</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#m_OnDemandDirectory">m_OnDemandDirectory</A></B></CODE><BR> The directory used when loading cost files on demand, null indicates current directory</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#m_Seed">m_Seed</A></B></CODE><BR> Seed for reweighting using resampling.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#MATRIX_ON_DEMAND">MATRIX_ON_DEMAND</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#MATRIX_SUPPLIED">MATRIX_SUPPLIED</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../weka/core/Tag.html">Tag</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#TAGS_MATRIX_SOURCE">TAGS_MATRIX_SOURCE</A></B></CODE><BR> </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/CostSensitiveClassifier.html#CostSensitiveClassifier()">CostSensitiveClassifier</A></B>()</CODE><BR> </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> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#buildClassifier(weka.core.Instances)">buildClassifier</A></B>(<A HREF="../../weka/core/Instances.html">Instances</A> data)</CODE><BR> Builds the model of the base learner.</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/CostSensitiveClassifier.html#classifierTipText()">classifierTipText</A></B>()</CODE><BR> </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/CostSensitiveClassifier.html#classifyInstance(weka.core.Instance)">classifyInstance</A></B>(<A HREF="../../weka/core/Instance.html">Instance</A> instance)</CODE><BR> Classifies a given instance by choosing the class with the minimum expected misclassification cost.</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/CostSensitiveClassifier.html#costMatrixSourceTipText()">costMatrixSourceTipText</A></B>()</CODE><BR> </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/CostSensitiveClassifier.html#costMatrixTipText()">costMatrixTipText</A></B>()</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../weka/classifiers/Classifier.html">Classifier</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#getClassifier()">getClassifier</A></B>()</CODE><BR> Gets the classifier used.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#getClassifierSpec()">getClassifierSpec</A></B>()</CODE><BR> Gets the classifier specification string, which contains the class name of the classifier and any options to the classifier</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../weka/classifiers/CostMatrix.html">CostMatrix</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#getCostMatrix()">getCostMatrix</A></B>()</CODE><BR> Gets the misclassification cost matrix.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../weka/core/SelectedTag.html">SelectedTag</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#getCostMatrixSource()">getCostMatrixSource</A></B>()</CODE><BR> Gets the source location method of the cost matrix.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#getMinimizeExpectedCost()">getMinimizeExpectedCost</A></B>()</CODE><BR> Gets the value of MinimizeExpectedCost.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.io.File</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#getOnDemandDirectory()">getOnDemandDirectory</A></B>()</CODE><BR> Returns the directory that will be searched for cost files when loading on demand.</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/CostSensitiveClassifier.html#getOptions()">getOptions</A></B>()</CODE><BR> Gets the current settings of the Classifier.</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/CostSensitiveClassifier.html#getSeed()">getSeed</A></B>()</CODE><BR> Get seed for resampling.</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/CostSensitiveClassifier.html#globalInfo()">globalInfo</A></B>()</CODE><BR> </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/CostSensitiveClassifier.html#graph()">graph</A></B>()</CODE><BR> Returns graph describing the classifier (if possible).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.util.Enumeration</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/CostSensitiveClassifier.html#listOptions()">listOptions</A></B>()</CODE><BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -