kmeans: K-Means Clustering. 'kmeans' performs k-means clustering on...

Description Usage Arguments Value Constraints See Also Examples

Description

The DB Lytix function called is FLKMeans.K-Means clusters the training data. The relationship of observations to clusters has hard edges. In general, k-means has two steps: assigning data points to the nearest cluster and then moving each cluster’s centroid to the center of the members of the cluster.

Usage

1
kmeans(x, ...)

Arguments

x

an object of class FLTable, wide or deep

centers

the number of clusters

iter.max

the maximum number of iterations allowed

nstart

the initial number of random sets

excludeCols

the comma separated character string of columns to be excluded

classSpec

list describing the categorical dummy variables

whereconditions

takes the where_clause as a string

Value

kmeans returns a list which replicates equivalent R output from kmeans in stats package. The mapping table can be viewed using object$mapping if input is wide table.

Constraints

If classSpec is not specified, the categorical variables are excluded from analysis by default.

See Also

kmeans for R reference function implementation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
widetable  <- FLTable(getTestTableName("tblAbaloneWide"), "ObsID", whereconditions = "ObsID < 500")
kmeansobject <- kmeans(widetable,3,20,1,"Rings,SEX")
print(kmeansobject)
plot(kmeansobject)
One can specify ClassSpec and transform categorical variables 
before clustering. This increases the number of variables in the plot
because categorical variable is split into binary numerical variables.
The clusters may not be well-defined as is observed in the case below:-
kmeansobjectnew <- kmeans(widetable,3,20,1,"Rings,SEX",list("DummyCat(D)","SEX(M)"))
plot(kmeansobjectnew)

Fuzzy-Logix/AdapteR documentation built on May 6, 2019, 5:07 p.m.