instantaneous_loss: Instantaneous Loss

Description Usage Arguments Details Value Examples

Description

This function computes the instantaneous loss (i.e., squared Euclidean distantce) of an observation to its nearest center within a set of centers.

Usage

1
instantaneous_loss(centers, instant_observation)

Arguments

centers

a matrix containing m centers of length d, where each row corresponds to d coordinates of a center.

instant_observation

a vector of length d.

Details

Given a set C of m centers of length d (i.e., C = {c_{1}, c_{2}, …, c_{m}}) and a vector observation x of length d, this function computes the squared euclidean distance of x to its nearest center within C, i.e.,

L(x,C) = min_{1<= i <= m}|x-c_{i}|_{2}^{2}.

Value

The squared Euclidean distance of instant_observation to its nearest center within centers.

Examples

1
2
3
4
## generating 4 centers of length 3.
centers <- matrix(1:12, nrow = 4, ncol = 3)
instant_observation <- c(2,6,10)
instantaneous_loss(centers, instant_observation)

PACBO documentation built on May 2, 2019, 2:05 a.m.