arch_dist() calculates Euclidean distance from every point to every archetype give matrices that contain this data.

arch_dist(data, archetypes, dist_metric = "euclidean")

Arguments

data

matrix of dim(variables/dimentions, examples)

archetypes

matrix of dim(variables/dimentions, archetypes)

dist_metric

distance metric, currently only "euclidean" implemented

Value

matrix of distances to archetypes of dim(examples, archetypes)

See also

Examples

# Triangle with sides of 3,4,5 units length arch_dist(matrix(c(0,0),1,2), matrix(c(3,4),1,2))
#> archetype_1 archetype_2 #> [1,] 3 4 #> [2,] 3 4
# 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, N_dim = 2)
#> Error in generate_arc(arc_coord = list(c(5, 0), c(-10, 15), c(-30, -20)), mean = 0, sd = 1, N_dim = 2): unused argument (N_dim = 2)
data = generate_data(archetypes, N_examples = 1e4, jiiter = 0.04, size = 0.9)
#> Error in ncol(archetypes): object 'archetypes' not found
# Find Euclidean distance between data points and archetypes distance = arch_dist(data, archetypes)
#> Error in ncol(archetypes): object 'archetypes' not found
# Find Euclidean distance between archetypes arc_distance = arch_dist(archetypes, archetypes)
#> Error in ncol(archetypes): object 'archetypes' not found