Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

uniquek

Initialization of cluster prototypes over the unique values


Description

Initializes the cluster prototypes matrix using the randomly sampled data objects over the unique values of a selected feature.

Usage

uniquek(x, k, sfidx)

Arguments

x

a numeric vector, data frame or matrix.

k

an integer specifying the number of clusters.

sfidx

an integer specifying the column index of the selected feature for random sampling. If missing, it is internally determined by comparing the number of unique values for all the features in the data set. The feature having the maximum number of unique values is used as the selected feature.

Details

The set of unique values of the selected feature is determined, and then k objects were randomly sampled from this set.

Value

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, which used to build prototype matrix. Its value is ‘obj’ with this function because the cluster prototype matrix contains the sampled objects.

call

a string containing the matched function call that generates this ‘inaparc’ object.

Author(s)

Zeynel Cebeci, Cagatay Cebeci

See Also

Examples

data(iris)
# Run with the internally selected feature
res <- uniquek(x=iris[,1:4], k=5)
v <- res$v
print(v)

# Run with the 1st feature
res <- uniquek(x=iris[,1:4], k=5, sfidx=1)
v <- res$v
print(v)

inaparc

Initialization Algorithms for Partitioning Cluster Analysis

v1.1.0
GPL (>= 2)
Authors
Zeynel Cebeci [aut, cre], Cagatay Cebeci [aut]
Initial release
2020-02-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.