📄 instance.html
字号:
<BR> Sets the class value of an instance to the given value.</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/core/Instance.html#setDataset(weka.core.Instances)">setDataset</A></B>(<A HREF="../../weka/core/Instances.html" title="class in weka.core">Instances</A> instances)</CODE><BR> Sets the reference to the dataset.</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/core/Instance.html#setMissing(weka.core.Attribute)">setMissing</A></B>(<A HREF="../../weka/core/Attribute.html" title="class in weka.core">Attribute</A> att)</CODE><BR> Sets a specific value to be "missing".</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/core/Instance.html#setMissing(int)">setMissing</A></B>(int attIndex)</CODE><BR> Sets a specific value to be "missing".</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/core/Instance.html#setValue(weka.core.Attribute, double)">setValue</A></B>(<A HREF="../../weka/core/Attribute.html" title="class in weka.core">Attribute</A> att, double value)</CODE><BR> Sets a specific value in the instance to the given value (internal floating-point format).</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/core/Instance.html#setValue(weka.core.Attribute, java.lang.String)">setValue</A></B>(<A HREF="../../weka/core/Attribute.html" title="class in weka.core">Attribute</A> att, java.lang.String value)</CODE><BR> Sets a value of an nominal or string attribute to the given value.</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/core/Instance.html#setValue(int, double)">setValue</A></B>(int attIndex, double value)</CODE><BR> Sets a specific value in the instance to the given value (internal floating-point format).</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/core/Instance.html#setValue(int, java.lang.String)">setValue</A></B>(int attIndex, java.lang.String value)</CODE><BR> Sets a value of a nominal or string attribute to the given value.</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/core/Instance.html#setValueSparse(int, double)">setValueSparse</A></B>(int indexOfIndex, double value)</CODE><BR> Sets a specific value in the instance to the given value (internal floating-point format).</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/core/Instance.html#setWeight(double)">setWeight</A></B>(double weight)</CODE><BR> Sets the weight of an instance.</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/Instance.html#stringValue(weka.core.Attribute)">stringValue</A></B>(<A HREF="../../weka/core/Attribute.html" title="class in weka.core">Attribute</A> att)</CODE><BR> Returns the string value of a nominal, string, or date attribute for the instance.</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/Instance.html#stringValue(int)">stringValue</A></B>(int attIndex)</CODE><BR> Returns the string value of a nominal, string, or date attribute for the instance.</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/Instance.html#toDoubleArray()">toDoubleArray</A></B>()</CODE><BR> Returns the values of each attribute as an array of doubles.</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/Instance.html#toString()">toString</A></B>()</CODE><BR> Returns the description of one instance.</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/Instance.html#toString(weka.core.Attribute)">toString</A></B>(<A HREF="../../weka/core/Attribute.html" title="class in weka.core">Attribute</A> att)</CODE><BR> Returns the description of one value of the instance as a string.</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/Instance.html#toString(int)">toString</A></B>(int attIndex)</CODE><BR> Returns the description of one value of the instance as a string.</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/Instance.html#value(weka.core.Attribute)">value</A></B>(<A HREF="../../weka/core/Attribute.html" title="class in weka.core">Attribute</A> att)</CODE><BR> Returns an instance's attribute value in internal format.</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/Instance.html#value(int)">value</A></B>(int attIndex)</CODE><BR> Returns an instance's attribute value in internal format.</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/Instance.html#valueSparse(int)">valueSparse</A></B>(int indexOfIndex)</CODE><BR> Returns an instance's attribute value in internal format.</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/Instance.html#weight()">weight</A></B>()</CODE><BR> Returns the instance's weight.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.Object</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>equals, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="Instance(double, double[])"><!-- --></A><H3>Instance</H3><PRE>public <B>Instance</B>(double weight, double[] attValues)</PRE><DL><DD>Constructor that inititalizes instance variable with given values. Reference to the dataset is set to null. (ie. the instance doesn't have access to information about the attribute types)<P><DT><B>Parameters:</B><DD><CODE>weight</CODE> - the instance's weight<DD><CODE>attValues</CODE> - a vector of attribute values</DL><HR><A NAME="Instance(int)"><!-- --></A><H3>Instance</H3><PRE>public <B>Instance</B>(int numAttributes)</PRE><DL><DD>Constructor of an instance that sets weight to one, all values to be missing, and the reference to the dataset to null. (ie. the instance doesn't have access to information about the attribute types)<P><DT><B>Parameters:</B><DD><CODE>numAttributes</CODE> - the size of the instance</DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="attribute(int)"><!-- --></A><H3>attribute</H3><PRE>public <A HREF="../../weka/core/Attribute.html" title="class in weka.core">Attribute</A> <B>attribute</B>(int index)</PRE><DL><DD>Returns the attribute with the given index.<P><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<DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedDatasetException.html" title="class in weka.core">UnassignedDatasetException</A></CODE> - if instance doesn't have access to a dataset</DL></DD></DL><HR><A NAME="attributeSparse(int)"><!-- --></A><H3>attributeSparse</H3><PRE>public <A HREF="../../weka/core/Attribute.html" title="class in weka.core">Attribute</A> <B>attributeSparse</B>(int indexOfIndex)</PRE><DL><DD>Returns the attribute with the given index. Does the same thing as attribute().<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>indexOfIndex</CODE> - the index of the attribute's index<DT><B>Returns:</B><DD>the attribute at the given position<DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedDatasetException.html" title="class in weka.core">UnassignedDatasetException</A></CODE> - if instance doesn't have access to a dataset</DL></DD></DL><HR><A NAME="classAttribute()"><!-- --></A><H3>classAttribute</H3><PRE>public <A HREF="../../weka/core/Attribute.html" title="class in weka.core">Attribute</A> <B>classAttribute</B>()</PRE><DL><DD>Returns class attribute.<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the class attribute<DT><B>Throws:</B><DD><CODE><A HREF="../../weka/core/UnassignedDatasetException.html" title="class in weka.core">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.<P><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" title="class in weka.core">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.<P><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" title="class in weka.core">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)<P><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" title="class in weka.core">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><P><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" title="interface in weka.core">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" title="class in weka.core">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.<P><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.<P><DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE>java.lang.RuntimeException</CODE> - if the instance has access to a dataset</DL></DD></DL><HR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -