Description Usage Arguments Value Constraints See Also Examples
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.
1 |
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 |
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.
If classSpec is not specified, the categorical variables are excluded from analysis by default.
kmeans
for R reference function implementation.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.