mlampros / ClusterR

Gaussian mixture models, k-means, mini-batch-kmeans and k-medoids clustering

Home Page:https://mlampros.github.io/ClusterR/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What does the parameter “seed” do in function Cluster_Medoids?

A-Pai opened this issue · comments

commented

What does the parameter “seed” do in function Cluster_Medoids?It is a fixed algorithm.
image

@A-Pai,
the seed parameter allows reproducibility of the results. For instance,

require(ClusterR)
data(dietary_survey_IBS)
dat = dietary_survey_IBS[, -ncol(dietary_survey_IBS)]
dat = center_scale(dat)
cm = Cluster_Medoids(dat, clusters = 3, distance_metric = 'euclidean', swap_phase = TRUE, seed = 1)
# str(cm)
cm1 = Cluster_Medoids(dat, clusters = 3, distance_metric = 'euclidean', swap_phase = TRUE, seed = 1)
# str(cm1)
cm2 = Cluster_Medoids(dat, clusters = 3, distance_metric = 'euclidean', swap_phase = TRUE, seed = 2)
# str(cm2)

identical(cm, cm1)
# TRUE
identical(cm, cm2)
# FALSE

The documentation also mentions seed: integer value for random number generator (RNG)