📄 filter.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:51 CDT 2002 --><TITLE>: Class Filter</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/filters/EmptyAttributeFilter.html"><B>PREV CLASS</B></A> <A HREF="../../weka/filters/FirstOrderFilter.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="Filter.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.filters</FONT><BR>Class Filter</H2><PRE>java.lang.Object | +--<B>weka.filters.Filter</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD>java.io.Serializable</DD></DL><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../weka/filters/AbstractTimeSeriesFilter.html">AbstractTimeSeriesFilter</A>, <A HREF="../../weka/filters/AddFilter.html">AddFilter</A>, <A HREF="../../weka/filters/AllFilter.html">AllFilter</A>, <A HREF="../../weka/filters/AttributeExpressionFilter.html">AttributeExpressionFilter</A>, <A HREF="../../weka/filters/AttributeFilter.html">AttributeFilter</A>, <A HREF="../../weka/filters/AttributeSelectionFilter.html">AttributeSelectionFilter</A>, <A HREF="../../weka/filters/AttributeTypeFilter.html">AttributeTypeFilter</A>, <A HREF="../../weka/filters/CopyAttributesFilter.html">CopyAttributesFilter</A>, <A HREF="../../weka/filters/DiscretizeFilter.html">DiscretizeFilter</A>, <A HREF="../../weka/filters/EmptyAttributeFilter.html">EmptyAttributeFilter</A>, <A HREF="../../weka/filters/FirstOrderFilter.html">FirstOrderFilter</A>, <A HREF="../../weka/filters/InstanceFilter.html">InstanceFilter</A>, <A HREF="../../weka/filters/MakeIndicatorFilter.html">MakeIndicatorFilter</A>, <A HREF="../../weka/filters/MergeTwoValuesFilter.html">MergeTwoValuesFilter</A>, <A HREF="../../weka/filters/NominalToBinaryFilter.html">NominalToBinaryFilter</A>, <A HREF="../../weka/filters/NonSparseToSparseFilter.html">NonSparseToSparseFilter</A>, <A HREF="../../weka/filters/NormalizationFilter.html">NormalizationFilter</A>, <A HREF="../../weka/filters/NullFilter.html">NullFilter</A>, <A HREF="../../weka/filters/NumericToBinaryFilter.html">NumericToBinaryFilter</A>, <A HREF="../../weka/filters/NumericTransformFilter.html">NumericTransformFilter</A>, <A HREF="../../weka/filters/ObfuscateFilter.html">ObfuscateFilter</A>, <A HREF="../../weka/filters/RandomizeFilter.html">RandomizeFilter</A>, <A HREF="../../weka/filters/ReplaceMissingValuesFilter.html">ReplaceMissingValuesFilter</A>, <A HREF="../../weka/filters/ResampleFilter.html">ResampleFilter</A>, <A HREF="../../weka/filters/SparseToNonSparseFilter.html">SparseToNonSparseFilter</A>, <A HREF="../../weka/filters/SplitDatasetFilter.html">SplitDatasetFilter</A>, <A HREF="../../weka/filters/SpreadSubsampleFilter.html">SpreadSubsampleFilter</A>, <A HREF="../../weka/filters/StringToNominalFilter.html">StringToNominalFilter</A>, <A HREF="../../weka/filters/SwapAttributeValuesFilter.html">SwapAttributeValuesFilter</A></DD></DL><HR><DL><DT>public abstract class <B>Filter</B><DT>extends java.lang.Object<DT>implements java.io.Serializable</DL><P>An abstract class for instance filters: objects that take instances as input, carry out some transformation on the instance and then output the instance. The method implementations in this class assume that most of the work will be done in the methods overridden by subclasses.<p> A simple example of filter use. This example doesn't remove instances from the output queue until all instances have been input, so has higher memory consumption than an approach that uses output instances as they are made available:<p> <code> <pre> Filter filter = ..some type of filter.. Instances instances = ..some instances.. for (int i = 0; i < data.numInstances(); i++) { filter.input(data.instance(i)); } filter.batchFinished(); Instances newData = filter.outputFormat(); Instance processed; while ((processed = filter.output()) != null) { newData.add(processed); } ..do something with newData.. </pre> </code><P><DL><DT><B>See Also: </B><DD><A HREF="../../serialized-form.html#weka.filters.Filter">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 boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/filters/Filter.html#m_NewBatch">m_NewBatch</A></B></CODE><BR> Record whether the filter is at the start of a batch</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/filters/Filter.html#Filter()">Filter</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>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/filters/Filter.html#batchFilterFile(weka.filters.Filter, java.lang.String[])">batchFilterFile</A></B>(<A HREF="../../weka/filters/Filter.html">Filter</A> filter, java.lang.String[] options)</CODE><BR> Method for testing filters ability to process multiple batches.</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/filters/Filter.html#batchFinished()">batchFinished</A></B>()</CODE><BR> Signify that this batch of input to the filter is finished.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/filters/Filter.html#bufferInput(weka.core.Instance)">bufferInput</A></B>(<A HREF="../../weka/core/Instance.html">Instance</A> instance)</CODE><BR> Adds the supplied input instance to the inputformat dataset for later processing.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/filters/Filter.html#copyStringValues(weka.core.Instance, boolean, weka.core.Instances, weka.core.Instances)">copyStringValues</A></B>(<A HREF="../../weka/core/Instance.html">Instance</A> instance, boolean instSrcCompat, <A HREF="../../weka/core/Instances.html">Instances</A> srcDataset, <A HREF="../../weka/core/Instances.html">Instances</A> destDataset)</CODE><BR> Takes string values referenced by an Instance and copies them from a source dataset to a destination dataset.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/filters/Filter.html#copyStringValues(weka.core.Instance, boolean, weka.core.Instances, int[], weka.core.Instances, int[])">copyStringValues</A></B>(<A HREF="../../weka/core/Instance.html">Instance</A> instance, boolean instSrcCompat, <A HREF="../../weka/core/Instances.html">Instances</A> srcDataset, int[] srcStrAtts, <A HREF="../../weka/core/Instances.html">Instances</A> destDataset, int[] destStrAtts)</CODE><BR> Takes string values referenced by an Instance and copies them from a source dataset to a destination dataset.</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/filters/Filter.html#filterFile(weka.filters.Filter, java.lang.String[])">filterFile</A></B>(<A HREF="../../weka/filters/Filter.html">Filter</A> filter, java.lang.String[] options)</CODE><BR> Method for testing filters.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/filters/Filter.html#flushInput()">flushInput</A></B>()</CODE><BR> This will remove all buffered instances from the inputformat dataset.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="../../weka/core/Instances.html">Instances</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/filters/Filter.html#getInputFormat()">getInputFormat</A></B>()</CODE><BR> Gets the currently set inputformat instances.</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/filters/Filter.html#getInputStringIndex()">getInputStringIndex</A></B>()</CODE><BR> Returns an array containing the indices of all string attributes in the input format.</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/filters/Filter.html#getOutputFormat()">getOutputFormat</A></B>()</CODE><BR> Gets the format of the output instances.</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/filters/Filter.html#getOutputStringIndex()">getOutputStringIndex</A></B>()</CODE><BR> Returns an array containing the indices of all string attributes in the output format.</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/filters/Filter.html#getStringIndices(weka.core.Instances)">getStringIndices</A></B>(<A HREF="../../weka/core/Instances.html">Instances</A> insts)</CODE><BR> Gets an array containing the indices of all string attributes.</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/filters/Filter.html#input(weka.core.Instance)">input</A></B>(<A HREF="../../weka/core/Instance.html">Instance</A> instance)</CODE><BR> Input an instance for filtering.</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/filters/Filter.html#inputFormat(weka.core.Instances)">inputFormat</A></B>(<A HREF="../../weka/core/Instances.html">Instances</A> instanceInfo)</CODE><BR> <B>Deprecated.</B> <I>use <code>setInputFormat(Instances)</code> instead.</I></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/filters/Filter.html#isOutputFormatDefined()">isOutputFormatDefined</A></B>()</CODE><BR> Returns whether the output format is ready to be collected</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/filters/Filter.html#main(java.lang.String[])">main</A></B>(java.lang.String[] args)</CODE><BR> Main method for testing this class.</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/filters/Filter.html#numPendingOutput()">numPendingOutput</A></B>()</CODE><BR> Returns the number of instances pending output</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../weka/core/Instance.html">Instance</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/filters/Filter.html#output()">output</A></B>()</CODE><BR> Output an instance after filtering and remove from the output queue.</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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -