dist.apply.samples: Build Distance Matrix Data based on Per-Index Sampling

Description Usage Arguments Value See Also

Description

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.

Usage

1
2
dist.apply.samples(X, FUN = distance.euclidean, sampler = identity,
  aggregate = mean, FUN.VALUE = +Inf, cores = 1L, logging = FALSE)

Arguments

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 X

aggregate

the aggregation function which will join distances computed with FUN of all combinations of the samples from two elements of X into a single value

FUN.VALUE

the value to be used for situations where an element of X contains no samples

cores

the number of cores to be used for parallel computation

logging

the logging setup, see makeLogger

Value

a vector of values that can be used to produce a distance matrix

See Also

dist.apply

dist.create


thomasWeise/distanceR documentation built on May 14, 2019, 7:35 a.m.