rulestats.html
来自「weka是机器学习和数据挖掘领域最有影响力的开源项目之一」· HTML 代码 · 共 1,087 行 · 第 1/3 页
HTML
1,087 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_10) on Fri Jan 26 16:34:46 NZDT 2007 --><TITLE>RuleStats</TITLE><META NAME="keywords" CONTENT="weka.classifiers.rules.RuleStats class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="RuleStats";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_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="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="http://www.cs.waikato.ac.nz/ml/weka/" target="_blank"><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/rules/Rule.html" title="class in weka.classifiers.rules"><B>PREV CLASS</B></A> <A HREF="../../../weka/classifiers/rules/ZeroR.html" title="class in weka.classifiers.rules"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?weka/classifiers/rules/RuleStats.html" target="_top"><B>FRAMES</B></A> <A HREF="RuleStats.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 | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">weka.classifiers.rules</FONT><BR>Class RuleStats</H2><PRE>java.lang.Object <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>weka.classifiers.rules.RuleStats</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD>java.io.Serializable</DD></DL><HR><DL><DT><PRE>public class <B>RuleStats</B><DT>extends java.lang.Object<DT>implements java.io.Serializable</DL></PRE><P>This class implements the statistics functions used in the propositional rule learner, from the simpler ones like count of true/false positive/negatives, filter data based on the ruleset, etc. to the more sophisticated ones such as MDL calculation and rule variants generation for each rule in the ruleset. <p> Obviously the statistics functions listed above need the specific data and the specific ruleset, which are given in order to instantiate an object of this class. <p><P><P><DL><DT><B>Version:</B></DT> <DD>$Revision: 1.5 $</DD><DT><B>Author:</B></DT> <DD>Xin Xu (xx5@cs.waikato.ac.nz)</DD><DT><B>See Also:</B><DD><A HREF="../../../serialized-form.html#weka.classifiers.rules.RuleStats">Serialized Form</A></DL><HR><P><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../weka/classifiers/rules/RuleStats.html#RuleStats()">RuleStats</A></B>()</CODE><BR> Default constructor</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../weka/classifiers/rules/RuleStats.html#RuleStats(weka.core.Instances, weka.core.FastVector)">RuleStats</A></B>(<A HREF="../../../weka/core/Instances.html" title="class in weka.core">Instances</A> data, <A HREF="../../../weka/core/FastVector.html" title="class in weka.core">FastVector</A> rules)</CODE><BR> Constructor that provides ruleset and data</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Method Summary</B></FONT></TH></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/rules/RuleStats.html#addAndUpdate(weka.classifiers.rules.Rule)">addAndUpdate</A></B>(<A HREF="../../../weka/classifiers/rules/Rule.html" title="class in weka.classifiers.rules">Rule</A> lastRule)</CODE><BR> Add a rule to the ruleset and update the stats</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/rules/RuleStats.html#combinedDL(double, double)">combinedDL</A></B>(double expFPRate, double predicted)</CODE><BR> Compute the combined DL of the ruleset in this class, i.e.</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/rules/RuleStats.html#countData()">countData</A></B>()</CODE><BR> Filter the data according to the ruleset and compute the basic stats: coverage/uncoverage, true/false positive/negatives of each rule</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/rules/RuleStats.html#countData(int, weka.core.Instances, double[][])">countData</A></B>(int index, <A HREF="../../../weka/core/Instances.html" title="class in weka.core">Instances</A> uncovered, double[][] prevRuleStats)</CODE><BR> Count data from the position index in the ruleset assuming that given data are not covered by the rules in position 0...(index-1), and the statistics of these rules are provided.<br> This procedure is typically useful when a temporary object of RuleStats is constructed in order to efficiently calculate the relative DL of rule in position index, thus all other stuff is not needed.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../../weka/classifiers/rules/RuleStats.html#dataDL(double, double, double, double, double)">dataDL</A></B>(double expFPOverErr, double cover, double uncover, double fp, double fn)</CODE><BR> The description length of data given the parameters of the data based on the ruleset.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../weka/core/Instances.html" title="class in weka.core">Instances</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../weka/classifiers/rules/RuleStats.html#getData()">getData</A></B>()</CODE><BR> Get the data of the stats</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/rules/RuleStats.html#getDistributions(int)">getDistributions</A></B>(int index)</CODE><BR> Get the class distribution predicted by the rule in given position</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../weka/core/Instances.html" title="class in weka.core">Instances</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../../weka/classifiers/rules/RuleStats.html#getFiltered(int)">getFiltered</A></B>(int index)</CODE><BR> Get the data after filtering the given rule</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../weka/core/FastVector.html" title="class in weka.core">FastVector</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../weka/classifiers/rules/RuleStats.html#getRuleset()">getRuleset</A></B>()</CODE><BR> Get the ruleset of the stats</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/rules/RuleStats.html#getRulesetSize()">getRulesetSize</A></B>()</CODE><BR> Get the size of the ruleset in the stats</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/rules/RuleStats.html#getSimpleStats(int)">getSimpleStats</A></B>(int index)</CODE><BR> Get the simple stats of one rule, including 6 parameters: 0: coverage; 1:uncoverage; 2: true positive; 3: true negatives; 4: false positives; 5: false negatives</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/rules/RuleStats.html#minDataDLIfDeleted(int, double, boolean)">minDataDLIfDeleted</A></B>(int index, double expFPRate, boolean checkErr)</CODE><BR> Compute the minimal data description length of the ruleset if the rule in the given position is deleted.<br> The min_data_DL_if_deleted = data_DL_if_deleted - potential</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/rules/RuleStats.html#minDataDLIfExists(int, double, boolean)">minDataDLIfExists</A></B>(int index, double expFPRate, boolean checkErr)</CODE><BR> Compute the minimal data description length of the ruleset if the rule in the given position is NOT deleted.<br> The min_data_DL_if_n_deleted = data_DL_if_n_deleted - potential</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../../weka/classifiers/rules/RuleStats.html#numAllConditions(weka.core.Instances)">numAllConditions</A></B>(<A HREF="../../../weka/core/Instances.html" title="class in weka.core">Instances</A> data)</CODE><BR> Compute the number of all possible conditions that could appear in a rule of a given data.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../../weka/core/Instances.html" title="class in weka.core">Instances</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../../weka/classifiers/rules/RuleStats.html#partition(weka.core.Instances, int)">partition</A></B>(<A HREF="../../../weka/core/Instances.html" title="class in weka.core">Instances</A> data, int numFolds)</CODE><BR> Patition the data into 2, first of which has (numFolds-1)/numFolds of the data and the second has 1/numFolds of the data</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/rules/RuleStats.html#potential(int, double, double[], double[], boolean)">potential</A></B>(int index, double expFPOverErr, double[] rulesetStat, double[] ruleStat, boolean checkErr)</CODE><BR> Calculate the potential to decrease DL of the ruleset, i.e.</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/rules/RuleStats.html#reduceDL(double, boolean)">reduceDL</A></B>(double expFPRate, boolean checkErr)</CODE><BR> Try to reduce the DL of the ruleset by testing removing the rules one by one in reverse order and update all the stats</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/rules/RuleStats.html#relativeDL(int, double, boolean)">relativeDL</A></B>(int index, double expFPRate, boolean checkErr)</CODE><BR> The description length (DL) of the ruleset relative to if the rule in the given position is deleted, which is obtained by: <br> MDL if the rule exists - MDL if the rule does not exist <br> Note the minimal possible DL of the ruleset is calculated(i.e.</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/rules/RuleStats.html#removeLast()">removeLast</A></B>()</CODE><BR> Remove the last rule in the ruleset as well as it's stats.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../../weka/core/Instances.html" title="class in weka.core">Instances</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../weka/classifiers/rules/RuleStats.html#rmCoveredBySuccessives(weka.core.Instances, weka.core.FastVector, int)">rmCoveredBySuccessives</A></B>(<A HREF="../../../weka/core/Instances.html" title="class in weka.core">Instances</A> data, <A HREF="../../../weka/core/FastVector.html" title="class in weka.core">FastVector</A> rules, int index)</CODE><BR> Static utility function to count the data covered by the rules after the given index in the given rules, and then remove them.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor">
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?