Description Usage Arguments Details Value Examples

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

1 | ```
instantaneous_loss(centers, instant_observation)
``` |

`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. |

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}.*

The squared Euclidean distance of `instant_observation`

to its nearest center within `centers`

.

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.