hkmeans: Hierarchial K-Means Clustering.

Description Usage Arguments Details Value Constraints Examples

Description

hkmeans performs Hierarchial k-means clustering on FLTable objects.

Usage

1

Arguments

x

an object of class FLTable, wide or deep

centers

the number of clusters

levels

no.of.levels in the hierarchy

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

Details

The DB Lytix function called is FLHKMeans.Hierarchical K-Means clusters the training data. The relationship of observations to clusters has hard edges. It re-clusters the training data in each cluster until the desired hierarchical level is reached.

Value

hkmeans returns a list which replicates equivalent R output from hkmeans 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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
widetable  <- FLTable(getTestTableName("tblAbaloneWide"), "ObsID",
					 whereconditions = "ObsID< 101")
hkmeansobject <- hkmeans(widetable,3,2,20,1,"Rings,SEX")
hkmeansobject$cluster
hkmeansobject$size
hkmeansobject$withinss
hkmeansobject$totss
hkmeansobject$betweenss
print(hkmeansobject)
plot(hkmeansobject)
#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:-
hkmeansobjectnew <- hkmeans(widetable,3,2,20,1,"Rings,SEX",list("DummyCat(D)","SEX(M)"))
plot(hkmeansobjectnew)

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