📄 instances.html
字号:
</DL><HR><A NAME="checkInstance(weka.core.Instance)"><!-- --></A><H3>checkInstance</H3><PRE>public final boolean <B>checkInstance</B>(<A HREF="../../weka/core/Instance.html">Instance</A> instance)</PRE><DL><DD>Checks if the given instance is compatible with this dataset. Only looks at the size of the instance and the ranges of the values for nominal and string attributes.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>true if the instance is compatible with the dataset</DL></DD></DL><HR><A NAME="classAttribute()"><!-- --></A><H3>classAttribute</H3><PRE>public final <A HREF="../../weka/core/Attribute.html">Attribute</A> <B>classAttribute</B>()</PRE><DL><DD>Returns the class attribute.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the class attribute<DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedClassException.html">UnassignedClassException</A></CODE> - if the class is not set</DL></DD></DL><HR><A NAME="classIndex()"><!-- --></A><H3>classIndex</H3><PRE>public final int <B>classIndex</B>()</PRE><DL><DD>Returns the class attribute's index. Returns negative number if it's undefined.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the class index as an integer</DL></DD></DL><HR><A NAME="compactify()"><!-- --></A><H3>compactify</H3><PRE>public final void <B>compactify</B>()</PRE><DL><DD>Compactifies the set of instances. Decreases the capacity of the set so that it matches the number of instances in the set.<DD><DL></DL></DD></DL><HR><A NAME="delete()"><!-- --></A><H3>delete</H3><PRE>public final void <B>delete</B>()</PRE><DL><DD>Removes all instances from the set.<DD><DL></DL></DD></DL><HR><A NAME="delete(int)"><!-- --></A><H3>delete</H3><PRE>public final void <B>delete</B>(int index)</PRE><DL><DD>Removes an instance at the given position from the set.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - the instance's position</DL></DD></DL><HR><A NAME="deleteAttributeAt(int)"><!-- --></A><H3>deleteAttributeAt</H3><PRE>public void <B>deleteAttributeAt</B>(int position)</PRE><DL><DD>Deletes an attribute at the given position (0 to numAttributes() - 1). A deep copy of the attribute information is performed before the attribute is deleted.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>pos</CODE> - the attribute's position<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if the given index is out of range or the class attribute is being deleted</DL></DD></DL><HR><A NAME="deleteStringAttributes()"><!-- --></A><H3>deleteStringAttributes</H3><PRE>public void <B>deleteStringAttributes</B>()</PRE><DL><DD>Deletes all string attributes in the dataset. A deep copy of the attribute information is performed before an attribute is deleted.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if string attribute couldn't be successfully deleted (probably because it is the class attribute).</DL></DD></DL><HR><A NAME="deleteWithMissing(int)"><!-- --></A><H3>deleteWithMissing</H3><PRE>public final void <B>deleteWithMissing</B>(int attIndex)</PRE><DL><DD>Removes all instances with missing values for a particular attribute from the dataset.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>attIndex</CODE> - the attribute's index</DL></DD></DL><HR><A NAME="deleteWithMissing(weka.core.Attribute)"><!-- --></A><H3>deleteWithMissing</H3><PRE>public final void <B>deleteWithMissing</B>(<A HREF="../../weka/core/Attribute.html">Attribute</A> att)</PRE><DL><DD>Removes all instances with missing values for a particular attribute from the dataset.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>att</CODE> - the attribute</DL></DD></DL><HR><A NAME="deleteWithMissingClass()"><!-- --></A><H3>deleteWithMissingClass</H3><PRE>public final void <B>deleteWithMissingClass</B>()</PRE><DL><DD>Removes all instances with a missing class value from the dataset.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedClassException.html">UnassignedClassException</A></CODE> - if class is not set</DL></DD></DL><HR><A NAME="enumerateAttributes()"><!-- --></A><H3>enumerateAttributes</H3><PRE>public java.util.Enumeration <B>enumerateAttributes</B>()</PRE><DL><DD>Returns an enumeration of all the attributes.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>enumeration of all the attributes.</DL></DD></DL><HR><A NAME="enumerateInstances()"><!-- --></A><H3>enumerateInstances</H3><PRE>public final java.util.Enumeration <B>enumerateInstances</B>()</PRE><DL><DD>Returns an enumeration of all instances in the dataset.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>enumeration of all instances in the dataset</DL></DD></DL><HR><A NAME="equalHeaders(weka.core.Instances)"><!-- --></A><H3>equalHeaders</H3><PRE>public final boolean <B>equalHeaders</B>(<A HREF="../../weka/core/Instances.html">Instances</A> dataset)</PRE><DL><DD>Checks if two headers are equivalent.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>dataset</CODE> - another dataset<DT><B>Returns:</B><DD>true if the header of the given dataset is equivalent to this header</DL></DD></DL><HR><A NAME="firstInstance()"><!-- --></A><H3>firstInstance</H3><PRE>public final <A HREF="../../weka/core/Instance.html">Instance</A> <B>firstInstance</B>()</PRE><DL><DD>Returns the first instance in the set.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the first instance in the set</DL></DD></DL><HR><A NAME="insertAttributeAt(weka.core.Attribute, int)"><!-- --></A><H3>insertAttributeAt</H3><PRE>public void <B>insertAttributeAt</B>(<A HREF="../../weka/core/Attribute.html">Attribute</A> att, int position)</PRE><DL><DD>Inserts an attribute at the given position (0 to numAttributes()) and sets all values to be missing. Shallow copies the attribute before it is inserted, and performs a deep copy of the existing attribute information.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>att</CODE> - the attribute to be inserted<DD><CODE>pos</CODE> - the attribute's position<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if the given index is out of range</DL></DD></DL><HR><A NAME="instance(int)"><!-- --></A><H3>instance</H3><PRE>public final <A HREF="../../weka/core/Instance.html">Instance</A> <B>instance</B>(int index)</PRE><DL><DD>Returns the instance at the given position.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - the instance's index<DT><B>Returns:</B><DD>the instance at the given position</DL></DD></DL><HR><A NAME="lastInstance()"><!-- --></A><H3>lastInstance</H3><PRE>public final <A HREF="../../weka/core/Instance.html">Instance</A> <B>lastInstance</B>()</PRE><DL><DD>Returns the last instance in the set.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the last instance in the set</DL></DD></DL><HR><A NAME="meanOrMode(int)"><!-- --></A><H3>meanOrMode</H3><PRE>public final double <B>meanOrMode</B>(int attIndex)</PRE><DL><DD>Returns the mean (mode) for a numeric (nominal) attribute as a floating-point value. Returns 0 if the attribute is neither nominal nor numeric. If all values are missing it returns zero.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>attIndex</CODE> - the attribute's index<DT><B>Returns:</B><DD>the mean or the mode</DL></DD></DL><HR><A NAME="meanOrMode(weka.core.Attribute)"><!-- --></A><H3>meanOrMode</H3><PRE>public final double <B>meanOrMode</B>(<A HREF="../../weka/core/Attribute.html">Attribute</A> att)</PRE><DL><DD>Returns the mean (mode) for a numeric (nominal) attribute as a floating-point value. Returns 0 if the attribute is neither nominal nor numeric. If all values are missing it returns zero.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>att</CODE> - the attribute<DT><B>Returns:</B><DD>the mean or the mode</DL></DD></DL><HR><A NAME="numAttributes()"><!-- --></A><H3>numAttributes</H3><PRE>public final int <B>numAttributes</B>()</PRE><DL><DD>Returns the number of attributes.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of attributes as an integer</DL></DD></DL><HR><A NAME="numClasses()"><!-- --></A><H3>numClasses</H3><PRE>public final int <B>numClasses</B>()</PRE><DL><DD>Returns the number of class labels.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of class labels as an integer if the class attribute is nominal, 1 otherwise.<DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedClassException.html">UnassignedClassException</A></CODE> - if the class is not set</DL></DD></DL><HR><A NAME="numDistinctValues(int)"><!-- --></A><H3>numDistinctValues</H3><PRE>public final int <B>numDistinctValues</B>(int attIndex)</PRE><DL><DD>Returns the number of distinct values of a given attribute. Returns the number of instances if the attribute is a string attribute. The value 'missing' is not counted.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>attIndex</CODE> - the attribute<DT><B>Returns:</B><DD>the number of distinct values of a given attribute</DL></DD></DL><HR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -