📄 instances.html
字号:
<CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Instances.html#stratify(int)">stratify</A></B>(int numFolds)</CODE><BR> Stratifies a set of instances according to its class values if the class attribute is nominal (so that afterwards a stratified cross-validation can be performed).</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/core/Instances.html#stringFreeStructure()">stringFreeStructure</A></B>()</CODE><BR> Create a copy of the structure, but "cleanse" string types (i.e.</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/core/Instances.html#sumOfWeights()">sumOfWeights</A></B>()</CODE><BR> Computes the sum of all the instances' weights.</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/core/Instances.html#test(java.lang.String[])">test</A></B>(java.lang.String[] argv)</CODE><BR> Method for testing this class.</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/core/Instances.html#testCV(int, int)">testCV</A></B>(int numFolds, int numFold)</CODE><BR> Creates the test set for one fold of a cross-validation on the dataset.</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/core/Instances.html#toString()">toString</A></B>()</CODE><BR> Returns the dataset as a string in ARFF format.</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/core/Instances.html#toSummaryString()">toSummaryString</A></B>()</CODE><BR> Generates a string summarizing the set of instances.</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/core/Instances.html#trainCV(int, int)">trainCV</A></B>(int numFolds, int numFold)</CODE><BR> Creates the training set for one fold of a cross-validation on the dataset.</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/core/Instances.html#variance(weka.core.Attribute)">variance</A></B>(<A HREF="../../weka/core/Attribute.html">Attribute</A> att)</CODE><BR> Computes the variance for a numeric attribute.</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/core/Instances.html#variance(int)">variance</A></B>(int attIndex)</CODE><BR> Computes the variance for a numeric attribute.</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>clone, 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%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="FILE_EXTENSION"><!-- --></A><H3>FILE_EXTENSION</H3><PRE>public static java.lang.String <B>FILE_EXTENSION</B></PRE><DL><DD>The filename extension that should be used for arff files</DL><HR><A NAME="m_RelationName"><!-- --></A><H3>m_RelationName</H3><PRE>protected java.lang.String <B>m_RelationName</B></PRE><DL><DD>The dataset's name.</DL><HR><A NAME="m_Attributes"><!-- --></A><H3>m_Attributes</H3><PRE>protected <A HREF="../../weka/core/FastVector.html">FastVector</A> <B>m_Attributes</B></PRE><DL><DD>The attribute information.</DL><HR><A NAME="m_Instances"><!-- --></A><H3>m_Instances</H3><PRE>protected <A HREF="../../weka/core/FastVector.html">FastVector</A> <B>m_Instances</B></PRE><DL><DD>The instances.</DL><HR><A NAME="m_ClassIndex"><!-- --></A><H3>m_ClassIndex</H3><PRE>protected int <B>m_ClassIndex</B></PRE><DL><DD>The class attribute's index</DL><HR><A NAME="m_ValueBuffer"><!-- --></A><H3>m_ValueBuffer</H3><PRE>protected double[] <B>m_ValueBuffer</B></PRE><DL><DD>Buffer of values for sparse instance</DL><HR><A NAME="m_IndicesBuffer"><!-- --></A><H3>m_IndicesBuffer</H3><PRE>protected int[] <B>m_IndicesBuffer</B></PRE><DL><DD>Buffer of indices for sparse instance</DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="Instances(java.io.Reader)"><!-- --></A><H3>Instances</H3><PRE>public <B>Instances</B>(java.io.Reader reader) throws java.io.IOException</PRE><DL><DD>Reads an ARFF file from a reader, and assigns a weight of one to each instance. Lets the index of the class attribute be undefined (negative).<DD><DL><DT><B>Parameters:</B><DD><CODE>reader</CODE> - the reader<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if the ARFF file is not read successfully</DL></DD></DL><HR><A NAME="Instances(java.io.Reader, int)"><!-- --></A><H3>Instances</H3><PRE>public <B>Instances</B>(java.io.Reader reader, int capacity) throws java.io.IOException</PRE><DL><DD>Reads the header of an ARFF file from a reader and reserves space for the given number of instances. Lets the class index be undefined (negative).<DD><DL><DT><B>Parameters:</B><DD><CODE>reader</CODE> - the reader<DD><CODE>capacity</CODE> - the capacity<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if the header is not read successfully or the capacity is negative.<DD><CODE>java.io.IOException</CODE> - if there is a problem with the reader.</DL></DD></DL><HR><A NAME="Instances(weka.core.Instances)"><!-- --></A><H3>Instances</H3><PRE>public <B>Instances</B>(<A HREF="../../weka/core/Instances.html">Instances</A> dataset)</PRE><DL><DD>Constructor copying all instances and references to the header information from the given set of instances.<DD><DL><DT><B>Parameters:</B><DD><CODE>instances</CODE> - the set to be copied</DL></DD></DL><HR><A NAME="Instances(weka.core.Instances, int)"><!-- --></A><H3>Instances</H3><PRE>public <B>Instances</B>(<A HREF="../../weka/core/Instances.html">Instances</A> dataset, int capacity)</PRE><DL><DD>Constructor creating an empty set of instances. Copies references to the header information from the given set of instances. Sets the capacity of the set of instances to 0 if its negative.<DD><DL><DT><B>Parameters:</B><DD><CODE>instances</CODE> - the instances from which the header information is to be taken<DD><CODE>capacity</CODE> - the capacity of the new dataset</DL></DD></DL><HR><A NAME="Instances(weka.core.Instances, int, int)"><!-- --></A><H3>Instances</H3><PRE>public <B>Instances</B>(<A HREF="../../weka/core/Instances.html">Instances</A> source, int first, int toCopy)</PRE><DL><DD>Creates a new set of instances by copying a subset of another set.<DD><DL><DT><B>Parameters:</B><DD><CODE>source</CODE> - the set of instances from which a subset is to be created<DD><CODE>first</CODE> - the index of the first instance to be copied<DD><CODE>toCopy</CODE> - the number of instances to be copied<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if first and toCopy are out of range</DL></DD></DL><HR><A NAME="Instances(java.lang.String, weka.core.FastVector, int)"><!-- --></A><H3>Instances</H3><PRE>public <B>Instances</B>(java.lang.String name, <A HREF="../../weka/core/FastVector.html">FastVector</A> attInfo, int capacity)</PRE><DL><DD>Creates an empty set of instances. Uses the given attribute information. Sets the capacity of the set of instances to 0 if its negative. Given attribute information must not be changed after this constructor has been used.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the relation<DD><CODE>attInfo</CODE> - the attribute information<DD><CODE>capacity</CODE> - the capacity of the set</DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="stringFreeStructure()"><!-- --></A><H3>stringFreeStructure</H3><PRE>public <A HREF="../../weka/core/Instances.html">Instances</A> <B>stringFreeStructure</B>()</PRE><DL><DD>Create a copy of the structure, but "cleanse" string types (i.e. doesn't contain references to the strings seen in the past).<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>a copy of the instance structure.</DL></DD></DL><HR><A NAME="add(weka.core.Instance)"><!-- --></A><H3>add</H3><PRE>public final void <B>add</B>(<A HREF="../../weka/core/Instance.html">Instance</A> instance)</PRE><DL><DD>Adds one instance to the end of the set. Shallow copies instance before it is added. Increases the size of the dataset if it is not large enough. Does not check if the instance is compatible with the dataset.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>instance</CODE> - the instance to be added</DL></DD></DL><HR><A NAME="attribute(int)"><!-- --></A><H3>attribute</H3><PRE>public final <A HREF="../../weka/core/Attribute.html">Attribute</A> <B>attribute</B>(int index)</PRE><DL><DD>Returns an attribute.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - the attribute's index<DT><B>Returns:</B><DD>the attribute at the given position</DL></DD></DL><HR><A NAME="attribute(java.lang.String)"><!-- --></A><H3>attribute</H3><PRE>public final <A HREF="../../weka/core/Attribute.html">Attribute</A> <B>attribute</B>(java.lang.String name)</PRE><DL><DD>Returns an attribute given its name. If there is more than one attribute with the same name, it returns the first one. Returns null if the attribute can't be found.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the attribute's name<DT><B>Returns:</B><DD>the attribute with the given name, null if the attribute can't be found</DL></DD></DL><HR><A NAME="checkForStringAttributes()"><!-- --></A><H3>checkForStringAttributes</H3><PRE>public boolean <B>checkForStringAttributes</B>()</PRE><DL><DD>Checks for string attributes in the dataset<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>true if string attributes are present, false otherwise</DL></DD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -