source: orange/Orange/doc/widgets/Classify/kNearestNeighbours.htm @ 9671:a7b056375472

Revision 9671:a7b056375472, 3.8 KB checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

Line 
1<html>
2<head>
3<title>k-Nearest Neighbours</title>
4<link rel=stylesheet href="../../../style.css" type="text/css" media=screen>
5<link rel=stylesheet href="../../../style-print.css" type="text/css" media=print></link>
6</head>
7
8<body>
9
10<h1>k-Nearest Neighbours Learner</h1>
11
12<img class="screenshot" src="../icons/k-NearestNeighbours.png">
13<p>k-Nearest Neighbours (kNN) learner</p>
14
15<h2>Channels</h2>
16
17<h3>Inputs</h3>
18
19<DL class=attributes>
20<DT>Examples (ExampleTable)</DT>
21<DD>A table with training examples</DD>
22</dl>
23
24<h3>Outputs</h3>
25<DL class=attributes>
26<DT>Learner</DT>
27<DD>The kNN learning algorithm with settings as specified in the dialog.</DD>
28
29<DT>KNN Classifier</DT>
30<DD>Trained classifier (a subtype of Classifier)</DD>
31</dl>
32
33<P>Signal <code>KNN Classifier</code> sends data only if the learning data (signal <code>Examples</code> is present.</P>
34
35<h2>Description</h2>
36
37<p>This widget provides a graphical interface to the k-Nearest Neighbours classifier.</p>
38
39<p>As all widgets for classification, it provides a learner and classifier on the output. Learner is a learning algorithm with settings as specified by the user. It can be fed into widgets for testing learners, for instance <code>Test Learners</code>. Classifier is a kNN Classifier (a subtype of a general classifier), built from the training examples on the input. If examples are not given, there is no classifier on the output.</p>
40
41<img class="leftscreenshot" src="k-NearestNeighbours.png" alt="k-Nearest Neighbours Widget" border=0 />
42
43<P>Learner can be given a name under which it will appear in, say, <code>Test Learners</code>. The default name is "kNN".</P>
44
45<P>Then, you can set the <span class="option">Number of neighbours</span>. Neighbours are weighted by their proximity to the example being classified, so there's no harm in using ten or twenty examples as neighbours. Weights use a Gaussian kernel, so that the last neighbour has a weight of 0.001. If you check <span class="option">Weighting by ranks, not distances</span>, the weighting formula will use the rank of the neighbour instead of its distance to the reference example.</P>
46
47<P>The <span class="option">Metrics</span> you can use are Euclidean, Hamming (the number of attributes in which the two examples differ - not suitable for continuous attributes), Manhattan (the sum of absolute differences for all attributes) and Maximal (the maximal difference between attributes).</P>
48
49<P>If you check <span class="option">Normalize continuous attributes</span>, their values will be divided by their span (on the training data). This ensures that all continuous attributes have equal impact, independent of their original scale.</P>
50
51<P>If you use Euclidean distance leave <span class="option">Ignore unknown values</span> unchecked. The corresponding class for measuring distances will compute the distributions of attribute values and return statistically valid distance estimations.</P>
52
53<P>If you use other metrics and have missing values in the data, imputation may be the optimal way to go, since other measures don't have any such treatment of unknowns. If you don't impute, you can either <span class="option">Ignore unknown values</span>, which treats all missing values as wildcards (so they are equivalent to any other attribute value). If you leave it unchecked, "don't cares" are wildcards, and "don't knows" as different from all values.</P>
54
55<P>When you change one or more settings, you need to push <span class="option">Apply</span>, which will put the new learner on the output and, if the training examples are given, construct a new classifier and output it as well.</P>
56
57
58<h2>Examples</h2>
59
60<P>This schema compares the results of k-Nearest neighbours with the default classifier which always predicts the majority class</P>
61
62<img class="screenshot"
63src="Majority-Knn-SchemaLearner.png" alt="k-Nearest Neighbours Classifier" border=0>
64
65</body>
66</html>
Note: See TracBrowser for help on using the repository browser.