kmeans.center.ini

K-Means Clustering for functional data

Perform k-means clustering on functional data.

Keywords
cluster
Usage
kmeans.center.ini(
  fdataobj,
  ncl = 2,
  metric = metric.lp,
  draw = TRUE,
  method = "sample",
  max.iter = 100,
  max.comb = 1e+06,
  par.metric = NULL,
  ...
)

kmeans.fd( fdataobj, ncl = 2, metric = metric.lp, dfunc = func.trim.FM, max.iter = 100, par.metric = NULL, par.dfunc = list(trim = 0.05), method = "sample", cluster.size = 5, draw = TRUE, ... )

Arguments
fdataobj

fdata class object.

ncl

See details section.

metric

Metric function, by default metric.lp.

draw

=TRUE, draw the curves in the color of the centers.

method

Method for selecting initial centers. If method="Sample" (by default) takes n times a random selection by the ncl centers. The ncl curves with greater distance are the initial centers. If method="Exact" calculated all combinations (if < 1e+6) of ncl centers. The ncl curves with greater distance are the initial centers (this method may be too slow).

max.iter

Maximum number of iterations for the detection of centers.

max.comb

Maximum number of initial selection of centers (only used when method="exact").

par.metric

List of arguments to pass to the metric function.

Further arguments passed to or from other methods.

dfunc

Type of depth measure, by default FM depth.

par.dfunc

List of arguments to pass to the dfunc function .

cluster.size

Minimum cluster size (by default is 5). If a cluster has fewer curves, it is eliminated and the process is continued with a less cluster.

Details

The method searches the locations around which are grouped data (for a predetermined number of groups).

If ncl=NULL, randomizes the initial centers, ncl=2 using kmeans.center.ini function. If ncl is an integer, indicating the number of groups to classify, are selected ncl initial centers using kmeans.center.ini function. If ncl is a vector of integers, indicating the position of the initial centers with length(ncl) equal to number of groups. If ncl is a fdata class objecct, ncl are the initial centers curves with nrow(ncl) number of groups.

Value

Return:

  • cluster Indexes of groups assigned.

  • centers Curves centers.

References

Hartigan, J. A. and Wong, M. A. (1979). A K-means clustering algorithm. Applied Statistics 28, 100 \-108.

See Also

See Also generic kmeans function.

Aliases
  • kmeans.center.ini
  • kmeans.fd
  • kmeans.centers.update
Examples
# NOT RUN {
data(phoneme)
mlearn<-phoneme$learn[c(1:50,101:150,201:250),]

# Unsupervised classification
out.fd1=kmeans.fd(mlearn,ncl=3,draw=TRUE)
out.fd2=kmeans.fd(mlearn,ncl=3,draw=TRUE,method="exact")
# Different Depth function
ind=c(17,77,126)
out.fd3=kmeans.fd(mlearn,ncl=mlearn[ind,],draw=FALSE,
dfunc=func.trim.FM,par.dfunc=list(trim=0.1))
out.fd4=kmeans.fd(mlearn,ncl=mlearn[ind,],draw=FALSE,
dfunc=func.med.FM)
group=c(rep(1,50),rep(2,50),rep(3,50))
table(out.fd4$cluster,group)
# }
# NOT RUN {
# }
Documentation reproduced from package fda.usc, version 2.0.1, License: GPL-2

Community examples

Looks like there are no examples yet.