Ignore:
Timestamp:
02/27/13 15:02:50 (14 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Cleanup of 'Widget catalog' documentation.

Fixed rst text formating, replaced dead hardcoded reference links (now using
:ref:), etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/widgets/rst/classify/knearestneighbours.rst

    r11050 r11359  
    2727 
    2828 
    29 Signal :code:`KNN Classifier` sends data only if the learning data (signal :code:`Examples` is present. 
     29Signal :code:`KNN Classifier` sends data only if the learning data (signal 
     30:code:`Examples` is present. 
    3031 
    3132Description 
    3233----------- 
    3334 
    34 This widget provides a graphical interface to the k-Nearest Neighbours classifier. 
     35This widget provides a graphical interface to the k-Nearest Neighbours 
     36classifier. 
    3537 
    36 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`. 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. 
     38As all widgets for classification, it provides a learner and classifier 
     39on the output. Learner is a learning algorithm with settings as specified 
     40by the user. It can be fed into widgets for testing learners, for instance 
     41:ref:`Test Learners`. Classifier is a kNN Classifier (a subtype of a general 
     42classifier), built from the training examples on the input. If examples are 
     43not given, there is no classifier on the output. 
    3744 
    3845.. image:: images/k-NearestNeighbours.png 
    3946   :alt: k-Nearest Neighbours Widget 
    4047 
    41 Learner can be given a name under which it will appear in, say, :code:`Test Learners`. The default name is "kNN". 
     48Learner can be given a name under which it will appear in, say, 
     49:ref:`Test Learners`. The default name is "kNN". 
    4250 
    43 Then, you can set the :obj:`Number of neighbours`. 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 :obj:`Weighting by ranks, not distances`, the weighting formula will use the rank of the neighbour instead of its distance to the reference example. 
     51Then, you can set the :obj:`Number of neighbours`. Neighbours are weighted 
     52by their proximity to the example being classified, so there's no harm in 
     53using ten or twenty examples as neighbours. Weights use a Gaussian kernel, 
     54so that the last neighbour has a weight of 0.001. If you check 
     55:obj:`Weighting by ranks, not distances`, the weighting formula will 
     56use the rank of the neighbour instead of its distance to the reference 
     57example. 
    4458 
    45 The :obj:`Metrics` 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). 
     59The :obj:`Metrics` you can use are Euclidean, Hamming (the number of 
     60attributes in which the two examples differ - not suitable for continuous 
     61attributes), Manhattan (the sum of absolute differences for all attributes) 
     62and Maximal (the maximal difference between attributes). 
    4663 
    47 If you check :obj:`Normalize continuous attributes`, 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. 
     64If you check :obj:`Normalize continuous attributes`, their values will be 
     65divided by their span (on the training data). This ensures that all 
     66continuous attributes have equal impact, independent of their original scale. 
    4867 
    49 If you use Euclidean distance leave :obj:`Ignore unknown values` unchecked. The corresponding class for measuring distances will compute the distributions of attribute values and return statistically valid distance estimations. 
     68If you use Euclidean distance leave :obj:`Ignore unknown values` 
     69unchecked. The corresponding class for measuring distances will compute 
     70the distributions of attribute values and return statistically valid distance 
     71estimations. 
    5072 
    51 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 :obj:`Ignore unknown values`, 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. 
     73If you use other metrics and have missing values in the data, imputation 
     74may be the optimal way to go, since other measures don't have any such 
     75treatment of unknowns. If you don't impute, you can either 
     76:obj:`Ignore unknown values`, which treats all missing values as wildcards 
     77(so they are equivalent to any other attribute value). If you leave it 
     78unchecked, "don't cares" are wildcards, and "don't knows" as different 
     79from all values. 
    5280 
    53 When you change one or more settings, you need to push :obj:`Apply`, 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. 
     81When you change one or more settings, you need to push :obj:`Apply`, which 
     82will put the new learner on the output and, if the training examples are 
     83given, construct a new classifier and output it as well. 
    5484 
    5585 
     
    5787-------- 
    5888 
    59 This schema compares the results of k-Nearest neighbours with the default classifier which always predicts the majority class 
     89This schema compares the results of k-Nearest neighbours with the default 
     90classifier which always predicts the majority class 
    6091 
    6192.. image:: images/Majority-Knn-SchemaLearner.png 
Note: See TracChangeset for help on using the changeset viewer.