ExhaustiveSearcher
Create exhaustive nearest neighbor searcher
Description
ExhaustiveSearcher
model objects store the training data,
distance metric, and parameter values of the distance metric for an exhaustive nearest
neighbor search. The exhaustive search algorithm finds the distance from each query
observation to all n observations in the training data, which is an
n-by-K numeric matrix.
Once you create an ExhaustiveSearcher
model object, find
neighboring points in the training data to the query data by performing a nearest
neighbor search using knnsearch
or a radius search using
rangesearch
. The exhaustive search
algorithm is more efficient than the Kd-tree algorithm when
K is large (that is, K > 10), and it is more
flexible than the Kd-tree algorithm with respect to distance metric
choices. The ExhaustiveSearcher
model object also supports sparse
data.
Creation
Use either the createns
function or the
ExhaustiveSearcher
function (described here) to create an
ExhaustiveSearcher
object. Both functions use the same syntax
except that the createns
function has the 'NSMethod'
name-value pair
argument, which you use to choose the nearest neighbor search method. The
createns
function also creates a KDTreeSearcher
object. Specify 'NSMethod','exhaustive'
to create an ExhaustiveSearcher
object. The default is
'exhaustive'
if K > 10, the training data is
sparse, or the distance metric is not the Euclidean, city block, Chebychev, or
Minkowski.
Description
creates an exhaustive nearest neighbor searcher object (Mdl
= ExhaustiveSearcher(X
)Mdl
)
using the n-by-K numeric matrix of
training data (X
).
specifies additional options using one or more name-value pair arguments. You
can specify the distance metric and set the distance metric parameter (Mdl
= ExhaustiveSearcher(X
,Name,Value
)DistParameter
)
property. For example,
ExhaustiveSearcher(X,'Distance','chebychev')
creates an
exhaustive nearest neighbor searcher object that uses the Chebychev distance. To
specify DistParameter
, use the Cov
,
P
, or Scale
name-value pair
argument.
Input Arguments
Properties
Object Functions
knnsearch | Find k-nearest neighbors using searcher object |
rangesearch | Find all neighbors within specified distance using searcher object |