generate_arc() generates the matrix of archetypes using specified coordinates (some noise added).

generate_data() produces matrix of random data that fits a polytope defined by archetypes by multiplying position of archetypes by random weigths (that sum to 1)

generate_arc(arc_coord = list(c(5, 0), c(-10, 15), c(-30, -20)),
  mean = 0, sd = 1)

generate_data(archetypes, N_examples = 10000, jiiter = 0.1, size = 1)

Arguments

arc_coord

list of archetype coordinates, one numeric vector (length of N dimensions) per each archetype.

mean

mean of random distribution added to arc_coord

sd

standard deviationn of random distribution added to arc_coord

archetypes

matrix of archetypes of dim(dimensions, archetypes)

N_examples

number of examples to be generated

jiiter

add noise to weigth so that data is not a perfect polytope (e.g. triangle, see examples)

size

scale the data within a polytope

Value

generate_arc() object of class "random_arc" (similar to "pch_fit"), element XC is a matrix of archetypes of dim(dimensions, archetypes)

generate_data() matrix of archetypes of dim(dimensions, examples)

See also

Examples

# Random data that fits into the triangle set.seed(4355) archetypes = generate_arc(arc_coord = list(c(5, 0), c(-10, 15), c(-30, -20)), mean = 0, sd = 1) data = generate_data(archetypes$XC, N_examples = 1e4, jiiter = 0.04, size = 0.9) # Find Euclidian distance between data points and archetypes distance = arch_dist(data, archetypes)
#> Warning: first element used of 'length.out' argument
#> Error in seq_len(ncol(archetypes)): argument must be coercible to non-negative integer
# Find Euclidian distance between archetypes arc_distance = arch_dist(archetypes, archetypes)
#> Warning: first element used of 'length.out' argument
#> Error in seq_len(ncol(archetypes)): argument must be coercible to non-negative integer