📄 linearnn.html
字号:
<A NAME="globalInfo()"><!-- --></A><H3>globalInfo</H3><PRE>public java.lang.String <B>globalInfo</B>()</PRE><DL><DD>Returns a string describing this nearest neighbour search algorithm.<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>a description of the algorithm for displaying in the explorer/experimenter gui</DL></DD></DL><HR><A NAME="listOptions()"><!-- --></A><H3>listOptions</H3><PRE>public java.util.Enumeration <B>listOptions</B>()</PRE><DL><DD>Returns an enumeration describing the available options.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../weka/core/OptionHandler.html#listOptions()">listOptions</A></CODE> in interface <CODE><A HREF="../../weka/core/OptionHandler.html" title="interface in weka.core">OptionHandler</A></CODE><DT><B>Overrides:</B><DD><CODE><A HREF="../../weka/core/NearestNeighbourSearch.html#listOptions()">listOptions</A></CODE> in class <CODE><A HREF="../../weka/core/NearestNeighbourSearch.html" title="class in weka.core">NearestNeighbourSearch</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>an enumeration of all the available options.</DL></DD></DL><HR><A NAME="setOptions(java.lang.String[])"><!-- --></A><H3>setOptions</H3><PRE>public void <B>setOptions</B>(java.lang.String[] options) throws java.lang.Exception</PRE><DL><DD>Parses a given list of options. <p/> <!-- options-start --> Valid options are: <p/> <pre> -S Skip identical instances (distances equal to zero). </pre> <!-- options-end --><P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../weka/core/OptionHandler.html#setOptions(java.lang.String[])">setOptions</A></CODE> in interface <CODE><A HREF="../../weka/core/OptionHandler.html" title="interface in weka.core">OptionHandler</A></CODE><DT><B>Overrides:</B><DD><CODE><A HREF="../../weka/core/NearestNeighbourSearch.html#setOptions(java.lang.String[])">setOptions</A></CODE> in class <CODE><A HREF="../../weka/core/NearestNeighbourSearch.html" title="class in weka.core">NearestNeighbourSearch</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>options</CODE> - the list of options as an array of strings<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if an option is not supported</DL></DD></DL><HR><A NAME="getOptions()"><!-- --></A><H3>getOptions</H3><PRE>public java.lang.String[] <B>getOptions</B>()</PRE><DL><DD>Gets the current settings.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../weka/core/OptionHandler.html#getOptions()">getOptions</A></CODE> in interface <CODE><A HREF="../../weka/core/OptionHandler.html" title="interface in weka.core">OptionHandler</A></CODE><DT><B>Overrides:</B><DD><CODE><A HREF="../../weka/core/NearestNeighbourSearch.html#getOptions()">getOptions</A></CODE> in class <CODE><A HREF="../../weka/core/NearestNeighbourSearch.html" title="class in weka.core">NearestNeighbourSearch</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>an array of strings suitable for passing to setOptions()</DL></DD></DL><HR><A NAME="nearestNeighbour(weka.core.Instance)"><!-- --></A><H3>nearestNeighbour</H3><PRE>public <A HREF="../../weka/core/Instance.html" title="class in weka.core">Instance</A> <B>nearestNeighbour</B>(<A HREF="../../weka/core/Instance.html" title="class in weka.core">Instance</A> target) throws java.lang.Exception</PRE><DL><DD>Returns the nearest instance in the current neighbourhood to the supplied instance.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../weka/core/NearestNeighbourSearch.html#nearestNeighbour(weka.core.Instance)">nearestNeighbour</A></CODE> in class <CODE><A HREF="../../weka/core/NearestNeighbourSearch.html" title="class in weka.core">NearestNeighbourSearch</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>target</CODE> - The instance to find the nearest neighbour for.<DT><B>Returns:</B><DD>the nearest instance<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if the nearest neighbour could not be found.</DL></DD></DL><HR><A NAME="kNearestNeighbours(weka.core.Instance, int)"><!-- --></A><H3>kNearestNeighbours</H3><PRE>public <A HREF="../../weka/core/Instances.html" title="class in weka.core">Instances</A> <B>kNearestNeighbours</B>(<A HREF="../../weka/core/Instance.html" title="class in weka.core">Instance</A> target, int kNN) throws java.lang.Exception</PRE><DL><DD>Returns k nearest instances in the current neighbourhood to the supplied instance.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../weka/core/NearestNeighbourSearch.html#kNearestNeighbours(weka.core.Instance, int)">kNearestNeighbours</A></CODE> in class <CODE><A HREF="../../weka/core/NearestNeighbourSearch.html" title="class in weka.core">NearestNeighbourSearch</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>target</CODE> - The instance to find the k nearest neighbours for.<DD><CODE>kNN</CODE> - The number of nearest neighbours to find.<DT><B>Returns:</B><DD>the k nearest instances<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if the neighbours could not be found.</DL></DD></DL><HR><A NAME="getDistances()"><!-- --></A><H3>getDistances</H3><PRE>public double[] <B>getDistances</B>() throws java.lang.Exception</PRE><DL><DD>Returns the distances of the k nearest neighbours. The kNearestNeighbours or nearestNeighbour must always be called before calling this function. If this function is called before calling either the kNearestNeighbours or the nearestNeighbour, then it throws an exception. If, however, if either of the nearestNeighbour functions are called at any point in the past then no exception is thrown and the distances of the training set from the last supplied target instance (to either one of the nearestNeighbour functions) is/are returned.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../weka/core/NearestNeighbourSearch.html#getDistances()">getDistances</A></CODE> in class <CODE><A HREF="../../weka/core/NearestNeighbourSearch.html" title="class in weka.core">NearestNeighbourSearch</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>distances[] array containing the distances of the nearestNeighbours. The length and ordering of the array is the same as that of the instances returned by nearestNeighbour functions.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - an exception if called before calling kNearestNeighbours or nearestNeighbours.</DL></DD></DL><HR><A NAME="setInstances(weka.core.Instances)"><!-- --></A><H3>setInstances</H3><PRE>public void <B>setInstances</B>(<A HREF="../../weka/core/Instances.html" title="class in weka.core">Instances</A> insts)</PRE><DL><DD>Sets the instances comprising the current neighbourhood.<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../weka/core/NearestNeighbourSearch.html#setInstances(weka.core.Instances)">setInstances</A></CODE> in class <CODE><A HREF="../../weka/core/NearestNeighbourSearch.html" title="class in weka.core">NearestNeighbourSearch</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>insts</CODE> - The set of instances on which the nearest neighbour search is carried out. Usually this set is the training set.</DL></DD></DL><HR><A NAME="update(weka.core.Instance)"><!-- --></A><H3>update</H3><PRE>public void <B>update</B>(<A HREF="../../weka/core/Instance.html" title="class in weka.core">Instance</A> ins) throws java.lang.Exception</PRE><DL><DD>Updates the LinearNN to cater for the new added instance. This implementation only updates the ranges of the EuclideanDistance class, since our set of instances is passed by reference and should already have the newly added instance.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../weka/core/NearestNeighbourSearch.html#update(weka.core.Instance)">update</A></CODE> in class <CODE><A HREF="../../weka/core/NearestNeighbourSearch.html" title="class in weka.core">NearestNeighbourSearch</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>ins</CODE> - The instance to add. Usually this is the instance that is added to our neighbourhood i.e. the training instances.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if the provided instance is either null or the distance function cannot work with this instance.</DL></DD></DL><HR><A NAME="addInstanceInfo(weka.core.Instance)"><!-- --></A><H3>addInstanceInfo</H3><PRE>public void <B>addInstanceInfo</B>(<A HREF="../../weka/core/Instance.html" title="class in weka.core">Instance</A> ins)</PRE><DL><DD>Adds the given instance info. This implementation updates the range datastructures of the EuclideanDistance.<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../weka/core/NearestNeighbourSearch.html#addInstanceInfo(weka.core.Instance)">addInstanceInfo</A></CODE> in class <CODE><A HREF="../../weka/core/NearestNeighbourSearch.html" title="class in weka.core">NearestNeighbourSearch</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>ins</CODE> - The instance to add the information of. Usually this is the test instance supplied to update the range of attributes in the distance function.</DL></DD></DL><HR><A NAME="skipIdenticalTipText()"><!-- --></A><H3>skipIdenticalTipText</H3><PRE>public java.lang.String <B>skipIdenticalTipText</B>()</PRE><DL><DD>Returns the tip text for this property<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>tip text for this property suitable for displaying in the explorer/experimenter gui</DL></DD></DL><HR><A NAME="setSkipIdentical(boolean)"><!-- --></A><H3>setSkipIdentical</H3><PRE>public void <B>setSkipIdentical</B>(boolean skip)</PRE><DL><DD>Sets the property to skip identical instances (with distance zero from the target) from the set of neighbours returned.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>skip</CODE> - if true, identical intances are skipped</DL></DD></DL><HR><A NAME="getSkipIdentical()"><!-- --></A><H3>getSkipIdentical</H3><PRE>public boolean <B>getSkipIdentical</B>()</PRE><DL><DD>Gets whether if identical instances are skipped from the neighbourhood.<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>true if identical instances are skipped</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <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> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="http://www.cs.waikato.ac.nz/ml/weka/" target="_blank"><FONT CLASS="NavBarFont1"><B>Weka's home</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/core/KDTree.html" title="class in weka.core"><B>PREV CLASS</B></A> <A HREF="../../weka/core/ListOptions.html" title="class in weka.core"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?weka/core/LinearNN.html" target="_top"><B>FRAMES</B></A> <A HREF="LinearNN.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -