arch_dist: Compute distance to archetypes

Description Usage Arguments Value Author(s) See Also Examples

View source: R/arch_dist.R

Description

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

Usage

1
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)

Author(s)

Vitalii Kleshchevnikov

See Also

fit_pch, generate_arc, generate_data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Triangle with sides of 3,4,5 units length
arch_dist(matrix(c(0,0),1,2), matrix(c(3,4),1,2))
# 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)
data = generate_data(archetypes, N_examples = 1e4, jiiter = 0.04, size = 0.9)
# Find Euclidean distance between data points and archetypes
distance = arch_dist(data, archetypes)
# Find Euclidean distance between archetypes
arc_distance = arch_dist(archetypes, archetypes)

vitkl/ParetoTI documentation built on Feb. 11, 2020, 1:36 a.m.