Description Usage Arguments Details Author(s) Examples
View source: R/landmarks-lastfirst.r
Compute landmark sets based on nearest neighborhoods.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | firstlast(x, y = NULL, dist_method = "euclidean", ties_method = "min")
lastfirst(x, y = NULL, dist_method = "euclidean", ties_method = "min")
landmarks_lastfirst(
x,
dist_method = "euclidean",
ties_method = "min",
pick_method = "first",
num = NULL,
cardinality = NULL,
frac = FALSE,
seed_index = 1L,
engine = NULL,
cover = FALSE,
extend_num = extension(mult = 0, add = 0),
extend_cardinality = extension(mult = 0, add = 0)
)
|
x |
a data matrix. |
y |
a data matrix of the same dimension as |
dist_method |
a character string specifying the distance metric to use;
passed to |
ties_method |
a character string specifying the method for handling
ties; passed to |
pick_method |
a character string specifying the method for selecting one
among indistinguishable points, either |
num |
a positive integer; the desired number of landmark points, or of sets in a neighborhood cover. |
cardinality |
a positive integer; the desired cardinality of each landmark neighborhood, or of each set in a landmark cover. |
frac |
logical; whether to treat |
seed_index |
an integer (the first landmark to seed the algorithm) or
one of the character strings |
engine |
character string specifying the implementation to use; one of
|
cover |
logical; whether to return a data frame of landmark indices and cover sets (by member index) rather than only a vector of landmark indices. |
extend_num, extend_cardinality |
length-two numeric vectors used to
extend landmark parameters for cover set construction. See |
These functions adapt the maxmin procedure to produce landmark points dispersed according to the orders in which they are reached from each other, rather than to their distances from each other. (Say more.)
One, both, or neither of num
and cardinality
may be passed values.
If neither is specified, then num
is defaulted to the minimum of
24L
and the number of distinct rows of x
. If the values yield
neighborhoods that do not cover x
, then, effectively, num
is
increased until the cardinality necessary to cover x
is at most
cardinality
. To generte a complete landmark set, use cardinality = 1L
.
Jason Cory Brunson
Yara Skaf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | set.seed(4)
# small circle sample
X <- tdaunif::sample_circle(n = 6L)
# random seed index
l <- landmarks_lastfirst(X, seed_index = "random")
# plot landmark order at point positions
plot(X, asp = 1, pch = NA)
text(X, labels = order(l))
# add duplicate points
X <- rbind(X, X[sample(nrow(X), 6, replace = TRUE), , drop = FALSE])
# firstlast seed index
l <- landmarks_lastfirst(X, seed_index = "firstlast")
# plot landmark order at point positions
plot(X, asp = 1, pch = NA)
text(X + .1 * cbind(floor((1:12 - 1) / 6) - .5, 0), labels = order(l))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.