R/01-predictNearestCluster.R

Defines functions predictNearestCluster

predictNearestCluster <- function(object, newdata){
  centers <- object$centers
  n_centers <- nrow(centers)
  dist_mat <- as.matrix(dist(rbind(centers, newdata)))
  dist_mat <- dist_mat[-seq(n_centers), seq(n_centers)]
  max.col(-dist_mat)
}
Pandora-IsoMemo/iso-app documentation built on July 4, 2024, 7:07 p.m.