| ksegments | R Documentation |
Initializes the cluster prototypes matrix using the centers of k segments (subsets) of the data set.
ksegments(x, k, ctype)
x |
a numeric vector, data frame or matrix. |
k |
an integer specifying the number of clusters. |
ctype |
a string for the type of centroid. The options are ‘avg’ for average and ‘med’ for median of the objects in the segments. The default is ‘avg’. |
The first segment consists of the first n/k objects. The second segment consists of n/k objects starting from the n/k+1-th object. The process is repeated for k segments. The centers of k segments are assigned as the cluster prototypes.
an object of class ‘inaparc’, which is a list consists of the following items:
v |
a numeric matrix containing the initial cluster prototypes. |
ctype |
a string representing the type of centroid. Its value is ‘avg’ for average or ‘med’ for median of the objects in the segments. |
call |
a string containing the matched function call that generates this ‘inaparc’ object. |
Zeynel Cebeci, Cagatay Cebeci
crsamp,
firstk,
inofrep,
inscsf,
insdev,
kkz,
kmpp,
ksteps,
lastk,
lhsrandom,
lhsmaximin,
mscseek,
rsegment,
scseek,
scseek2,
spaeth,
ssamp,
topbottom,
uniquek,
ursamp
data(iris)
# Generate the prototypes matrix using the means of segments
res <- ksegments(x=iris[,1:4], k=5, ctype="avg")
v <- res$v
print(v)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.