📄 instance.html
字号:
<DT><B>Returns:</B><DD>the class attribute<DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedDatasetException.html">UnassignedDatasetException</A></CODE> - if the class is not set or the instance doesn't have access to a dataset</DL></DD></DL><HR><A NAME="classIndex()"><!-- --></A><H3>classIndex</H3><PRE>public int <B>classIndex</B>()</PRE><DL><DD>Returns the class attribute's index.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the class index as an integer<DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedDatasetException.html">UnassignedDatasetException</A></CODE> - if instance doesn't have access to a dataset</DL></DD></DL><HR><A NAME="classIsMissing()"><!-- --></A><H3>classIsMissing</H3><PRE>public boolean <B>classIsMissing</B>()</PRE><DL><DD>Tests if an instance's class is missing.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>true if the instance's class is missing<DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedClassException.html">UnassignedClassException</A></CODE> - if the class is not set or the instance doesn't have access to a dataset</DL></DD></DL><HR><A NAME="classValue()"><!-- --></A><H3>classValue</H3><PRE>public double <B>classValue</B>()</PRE><DL><DD>Returns an instance's class value in internal format. (ie. as a floating-point number)<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the corresponding value as a double (If the corresponding attribute is nominal (or a string) then it returns the value's index as a double).<DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedClassException.html">UnassignedClassException</A></CODE> - if the class is not set or the instance doesn't have access to a dataset</DL></DD></DL><HR><A NAME="copy()"><!-- --></A><H3>copy</H3><PRE>public java.lang.Object <B>copy</B>()</PRE><DL><DD>Produces a shallow copy of this instance. The copy has access to the same dataset. (if you want to make a copy that doesn't have access to the dataset, use <code>new Instance(instance)</code><DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../weka/core/Copyable.html#copy()">copy</A></CODE> in interface <CODE><A HREF="../../weka/core/Copyable.html">Copyable</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the shallow copy</DL></DD></DL><HR><A NAME="dataset()"><!-- --></A><H3>dataset</H3><PRE>public <A HREF="../../weka/core/Instances.html">Instances</A> <B>dataset</B>()</PRE><DL><DD>Returns the dataset this instance has access to. (ie. obtains information about attribute types from) Null if the instance doesn't have access to a dataset.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the dataset the instance has accesss to</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). Only succeeds if the instance does not have access to any dataset because otherwise inconsistencies could be introduced.<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.RuntimeException</CODE> - if the instance has access to a dataset</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<DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedDatasetException.html">UnassignedDatasetException</A></CODE> - if the instance doesn't have access to a dataset</DL></DD></DL><HR><A NAME="equalHeaders(weka.core.Instance)"><!-- --></A><H3>equalHeaders</H3><PRE>public boolean <B>equalHeaders</B>(<A HREF="../../weka/core/Instance.html">Instance</A> inst)</PRE><DL><DD>Tests if the headers of two instances are equivalent.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>instance</CODE> - another instance<DT><B>Returns:</B><DD>true if the header of the given instance is equivalent to this instance's header<DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedDatasetException.html">UnassignedDatasetException</A></CODE> - if instance doesn't have access to any dataset</DL></DD></DL><HR><A NAME="index(int)"><!-- --></A><H3>index</H3><PRE>public int <B>index</B>(int position)</PRE><DL><DD>Returns the index of the attribute stored at the given position. Just returns the given value.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>position</CODE> - the position<DT><B>Returns:</B><DD>the index of the attribute stored at the given position</DL></DD></DL><HR><A NAME="insertAttributeAt(int)"><!-- --></A><H3>insertAttributeAt</H3><PRE>public void <B>insertAttributeAt</B>(int position)</PRE><DL><DD>Inserts an attribute at the given position (0 to numAttributes()). Only succeeds if the instance does not have access to any dataset because otherwise inconsistencies could be introduced.<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.RuntimeException</CODE> - if the instance has accesss to a dataset<DD><CODE>java.lang.IllegalArgumentException</CODE> - if the position is out of range</DL></DD></DL><HR><A NAME="isMissing(int)"><!-- --></A><H3>isMissing</H3><PRE>public boolean <B>isMissing</B>(int attIndex)</PRE><DL><DD>Tests if a specific value is "missing".<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>attIndex</CODE> - the attribute's index</DL></DD></DL><HR><A NAME="isMissingSparse(int)"><!-- --></A><H3>isMissingSparse</H3><PRE>public boolean <B>isMissingSparse</B>(int indexOfIndex)</PRE><DL><DD>Tests if a specific value is "missing". Does the same thing as isMissing() if applied to an Instance.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>indexOfIndex</CODE> - the index of the attribute's index</DL></DD></DL><HR><A NAME="isMissing(weka.core.Attribute)"><!-- --></A><H3>isMissing</H3><PRE>public boolean <B>isMissing</B>(<A HREF="../../weka/core/Attribute.html">Attribute</A> att)</PRE><DL><DD>Tests if a specific value is "missing". The given attribute has to belong to a dataset.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>att</CODE> - the attribute</DL></DD></DL><HR><A NAME="isMissingValue(double)"><!-- --></A><H3>isMissingValue</H3><PRE>public static boolean <B>isMissingValue</B>(double val)</PRE><DL><DD>Tests if the given value codes "missing".<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>val</CODE> - the value to be tested<DT><B>Returns:</B><DD>true if val codes "missing"</DL></DD></DL><HR><A NAME="mergeInstance(weka.core.Instance)"><!-- --></A><H3>mergeInstance</H3><PRE>public <A HREF="../../weka/core/Instance.html">Instance</A> <B>mergeInstance</B>(<A HREF="../../weka/core/Instance.html">Instance</A> inst)</PRE><DL><DD>Merges this instance with the given instance and returns the result. Dataset is set to null.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>inst</CODE> - the instance to be merged with this one<DT><B>Returns:</B><DD>the merged instances</DL></DD></DL><HR><A NAME="missingValue()"><!-- --></A><H3>missingValue</H3><PRE>public static double <B>missingValue</B>()</PRE><DL><DD>Returns the double that codes "missing".<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the double that codes "missing"</DL></DD></DL><HR><A NAME="numAttributes()"><!-- --></A><H3>numAttributes</H3><PRE>public 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 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/UnassignedDatasetException.html">UnassignedDatasetException</A></CODE> - if instance doesn't have access to any dataset</DL></DD></DL><HR><A NAME="numValues()"><!-- --></A><H3>numValues</H3><PRE>public int <B>numValues</B>()</PRE><DL><DD>Returns the number of values present. Always the same as numAttributes().<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of values</DL></DD></DL><HR><A NAME="replaceMissingValues(double[])"><!-- --></A><H3>replaceMissingValues</H3><PRE>public void <B>replaceMissingValues</B>(double[] array)</PRE><DL><DD>Replaces all missing values in the instance with the values contained in the given array. A deep copy of the vector of attribute values is performed before the values are replaced.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>array</CODE> - containing the means and modes<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if numbers of attributes are unequal</DL></DD></DL><HR><A NAME="setClassMissing()"><!-- --></A><H3>setClassMissing</H3><PRE>public void <B>setClassMissing</B>()</PRE><DL><DD>Sets the class value of an instance to be "missing". A deep copy of the vector of attribute values is performed before the value is set to be missing.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedClassException.html">UnassignedClassException</A></CODE> - if the class is not set<DD><CODE><A HREF="../../weka/core/UnassignedDatasetException.html">UnassignedDatasetException</A></CODE> - if the instance doesn't have access to a dataset</DL></DD></DL><HR><A NAME="setClassValue(double)"><!-- --></A><H3>setClassValue</H3><PRE>public void <B>setClassValue</B>(double value)</PRE><DL><DD>Sets the class value of an instance to the given value (internal floating-point format). A deep copy of the vector of attribute values is performed before the value is set.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>value</CODE> - the new attribute value (If the corresponding attribute is nominal (or a string) then this is the new value's index as a double).<DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedClassException.html">UnassignedClassException</A></CODE> - if the class is not set<DD><CODE>UnaddignedDatasetException</CODE> - if the instance doesn't have access to a dataset</DL></DD></DL><HR><A NAME="setClassValue(java.lang.String)"><!-- --></A><H3>setClassValue</H3><PRE>public final void <B>setClassValue</B>(java.lang.String value)</PRE><DL><DD>Sets the class value of an instance to the given value. A deep copy of the vector of attribute values is performed before the value is set.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>value</CODE> - the new class value (If the class is a string attribute and the value can't be found, the value is added to the attribute).<DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedClassException.html">UnassignedClassException</A></CODE> - if the class is not set<DD><CODE><A HREF="../../weka/core/UnassignedDatasetException.html">UnassignedDatasetException</A></CODE> - if the dataset is not set<DD><CODE>java.lang.IllegalArgumentException</CODE> - if the attribute is not nominal or a string, or the value couldn't be found for a nominal attribute</DL></DD></DL><HR><A NAME="setDataset(weka.core.Instances)"><!-- --></A><H3>setDataset</H3><PRE>public final void <B>setDataset</B>(<A HREF="../../weka/core/Instances.html">Instances</A> instances)</PRE><DL><DD>Sets the reference to the dataset. Does not check if the instance is compatible with the dataset. Note: the dataset does not know about this instance. If the structure of the dataset's header gets changed, this instance will not be adjusted automatically.<DD><DL></DL></DD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -