powered by
Initialize cluster centers using the k-means++ algorithm, which selects centers with probability proportional to squared distance from existing centers.
cluster.init(fdataobj, ncl, metric = "L2", seed = NULL)
An fdata object containing the initial cluster centers.
An object of class 'fdata'.
Number of clusters.
Metric to use. One of "L2", "L1", or "Linf".
Optional random seed.
t <- seq(0, 1, length.out = 50) X <- matrix(rnorm(30 * 50), 30, 50) fd <- fdata(X, argvals = t) init_centers <- cluster.init(fd, ncl = 3)
Run the code above in your browser using DataLab