📄 metacost.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:49 CDT 2002 --><TITLE>: Class MetaCost</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/LWR.html"><B>PREV CLASS</B></A> <A HREF="../../weka/classifiers/MultiClassClassifier.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="MetaCost.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 MetaCost</H2><PRE>java.lang.Object | +--<A HREF="../../weka/classifiers/Classifier.html">weka.classifiers.Classifier</A> | +--<B>weka.classifiers.MetaCost</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD>java.lang.Cloneable, <A HREF="../../weka/core/OptionHandler.html">OptionHandler</A>, java.io.Serializable</DD></DL><HR><DL><DT>public class <B>MetaCost</B><DT>extends <A HREF="../../weka/classifiers/Classifier.html">Classifier</A><DT>implements <A HREF="../../weka/core/OptionHandler.html">OptionHandler</A></DL><P>This metaclassifier makes its base classifier cost-sensitive using the method specified in <p> Pedro Domingos (1999). <i>MetaCost: A general method for making classifiers cost-sensitive</i>, Proceedings of the Fifth International Conference on Knowledge Discovery and Data Mining, pp. 155-164. Also available online at <a href="http://www.cs.washington.edu/homes/pedrod/kdd99.ps.gz"> http://www.cs.washington.edu/homes/pedrod/kdd99.ps.gz</a>. <p> This classifier should produce similar results to one created by passing the base learner to Bagging, which is in turn passed to a CostSensitiveClassifier operating on minimum expected cost. The difference is that MetaCost produces a single cost-sensitive classifier of the base learner, giving the benefits of fast classification and interpretable output (if the base learner itself is interpretable). This implementation uses all bagging iterations when reclassifying training data (the MetaCost paper reports a marginal improvement when only those iterations containing each training instance are used in reclassifying that instance). <p> Valid options are:<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> -I num <br> Set the number of bagging iterations (default 10). <p> -S seed <br> Random number seed used when reweighting by resampling (default 1).<p> -P num <br> Size of each bag, as a percentage of the training size (default 100). <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.MetaCost">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 int</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/MetaCost.html#m_BagSizePercent">m_BagSizePercent</A></B></CODE><BR> The size of each bag sample, as a percentage of the training size</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/MetaCost.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/MetaCost.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/MetaCost.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/MetaCost.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 int</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/MetaCost.html#m_NumIterations">m_NumIterations</A></B></CODE><BR> The number of iterations.</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/MetaCost.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/MetaCost.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/MetaCost.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/MetaCost.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/MetaCost.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/MetaCost.html#MetaCost()">MetaCost</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/MetaCost.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> double</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/MetaCost.html#classifyInstance(weka.core.Instance)">classifyInstance</A></B>(<A HREF="../../weka/core/Instance.html">Instance</A> instance)</CODE><BR> Classifies a given test instance.</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/MetaCost.html#getBagSizePercent()">getBagSizePercent</A></B>()</CODE><BR> Gets the size of each bag, as a percentage of the training set size.</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/MetaCost.html#getClassifier()">getClassifier</A></B>()</CODE><BR> Gets the distribution 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/MetaCost.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/MetaCost.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/MetaCost.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> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/classifiers/MetaCost.html#getNumIterations()">getNumIterations</A></B>()</CODE><BR> Gets the number of bagging iterations</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/MetaCost.html#getOnDemandDirectory()">getOnDemandDirectory</A></B>()</CODE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -