vals <- factor(c("A","A","B","C"))
wts <- c(0.2, 0.5, 0.2, 0.1)
# Deterministic update (weighted mode)
gsom_updateCategorical(vals, wts, sampling = FALSE)
# Stochastic update (weighted sampling)
gsom_updateCategorical(vals, wts, sampling = TRUE)
Run the code above in your browser using DataLab