next up previous contents
Next: B.4.7 super Up: B.4 Learners Previous: B.4.5 newknn   Contents


B.4.6 oldknn

This is an implementation of the conventional Ball-tree based k nearest neighbor search.

A ball tree is a binary tree in which each node represents a set of points, called Points(Node). Given a dataset, the root node of a ball tree represents the full set of points in the dataset. A node can be either a leaf node or a non-leaf node. A leaf node explicitly contains a list of the points represented by the node. A non-leaf node does not explicitly contain a set of points. It has two children nodes: Node.child1 and Node.child2, where

$\displaystyle Points(child1) \cap Points(child2) = \phi$    and $\displaystyle Points(child1) \cup
Points(child2) = {\mbox{{\em Points(Node)}}}
$

Points are organized spatially so that balls lower down the tree cover smaller and smaller volumes. This is achieved by insisting, at tree construction time, that
$\displaystyle {\bf x}\in Points(Node.child1)$ $\displaystyle \Rightarrow$ $\displaystyle \mid {\bf x}-Node.child1.Pivot\mid  \leq  \mid
{\bf x}-Node.child2.Pivot\mid$  
$\displaystyle {\bf x}\in Points(Node.child2)$ $\displaystyle \Rightarrow$ $\displaystyle \mid {\bf x}-Node.child2.Pivot\mid  \leq  \mid
{\bf x}-Node.child1.Pivot\mid$  

This gives the ability to bound distance from a target point t to any point in any ball tree node. If x $ \in$ Points(Node) then we can be sure that:

$\displaystyle \vert {\bf x} - {\mbox{\bf t}} \vert$ $\displaystyle \geq$ $\displaystyle \vert {\mbox{\bf t}} - {\mbox{{\em Node.{\bf Pivot}}}} \vert
- {\mbox{{\em Node.Radius}}}$ (B.8)
$\displaystyle \vert {\bf x} - {\mbox{\bf t}} \vert$ $\displaystyle \leq$ $\displaystyle \vert {\mbox{\bf t}} - {\mbox{{\em Node.{\bf Pivot}}}} \vert
+ {\mbox{{\em Node.Radius}}}$ (B.9)

The process of oldknn is described as below:




Keyword Arg Type Arg Vals Default
Common
k int [0,$ \infty$) 9
rmin int [1,$ \infty$) 5
mbw float [1e-7,$ \infty$) 0.01
     



Common keywords and arguments:


next up previous contents
Next: B.4.7 super Up: B.4 Learners Previous: B.4.5 newknn   Contents
Copyright 2004 Paul Komarek, komarek@cmu.edu