Description Usage Arguments Value See Also
Build the data for a distance matrix by comparing the elements
from a vector or list X
. Here, X
can be a list of lists or a
list of objects. Each element of X
is passed to a sampler function
sampler
which will return the "samples" for that element. These
samples are the actual values passed to the distance function FUN
:
If we want to compute the distance between two elements a
and
b
from X
, then what we do is first computing
sa=sampler(a)
and sb=sampler(b)
. sa
and sb
should be lists or vectors. We then go through all combinations of the
elements in sa
and sb
and pass them to FUN
, one after
the other. The results of these length(sa) * length(sb)
computations
are finally passed to aggregate
as vector. The result of
aggregate
is then the distance between a
and b
.
1 2 | dist.apply.samples(X, FUN = distance.euclidean, sampler = identity,
aggregate = mean, FUN.VALUE = +Inf, cores = 1L, logging = FALSE)
|
X |
the list or vector of elements to be compared |
FUN |
the distance function, a function accepting two samples and returning one distance value |
sampler |
the sampling function, returning a vector or list of samples
for an element of |
aggregate |
the aggregation function which will join distances computed
with |
FUN.VALUE |
the value to be used for situations where an element of
|
cores |
the number of cores to be used for parallel computation |
logging |
the logging setup, see |
a vector of values that can be used to produce a distance matrix
dist.apply
dist.create
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.