kmodes: Run Kmodes

Description Usage Arguments Details References Examples

Description

This function runs Kmodes. The user must choose the number of clusters and the initial modes.

Usage

1
kmodes(data, k, k2)

Arguments

data

data should be a matrix or data frame, columns include the variables.

k

number of clusters

k2

set of initial modes; indices of data points

Details

This function clusters the rows of the data.

References

Huang, Z. (1998). Extensions to the v-means Algorithm for Clustering Large Data Sets with Categorical Values, Data Mining and Knowledge Discovery, 2, 283-304.

Examples

1
2
3
4
5
data("zoo")
### Run Kmodes on zoo data with 7 clusters and the first seventh observations as initial modes
kmodes(zoo$obs,k=7,1:7)
### Run Kmodes with seven random initial modes selected from data points
kmodes(zoo$obs,k=7,sort(sample(dim(zoo$obs)[1],7)))

Example output

Loading required package: dendextend

---------------------
Welcome to dendextend version 1.5.2
Type citation('dendextend') for how to cite the package.

Type browseVignettes(package = 'dendextend') for the package vignette.
The github page is: https://github.com/talgalili/dendextend/

Suggestions and bug-reports can be submitted at: https://github.com/talgalili/dendextend/issues
Or contact: <tal.galili@gmail.com>

	To suppress this message use:  suppressPackageStartupMessages(library(dendextend))
---------------------


Attaching package: 'dendextend'

The following object is masked from 'package:stats':

    cutree

Loading required package: ggplot2
Loading required package: ggdendro

Attaching package: 'ggdendro'

The following object is masked from 'package:dendextend':

    theme_dendro

Loading required package: seqinr
  [1] 1 2 3 3 5 2 7 5 2 2 1 1 2 3 3 4 4 1 1 5 4 7 3 7 5 2 3 2 1 5 3 4 5 3 4 1 3
 [38] 1 2 5 4 4 2 2 1 2 4 1 5 4 4 3 5 1 1 2 3 3 4 1 3 4 4 1 3 2 4 3 1 3 5 1 5 2
 [75] 3 5 4 2 5 5 4 5 2 3 1 2 3 3 3 5 5 7 4 1 4 5 5 1 5 4 5
  [1] 5 2 3 3 1 2 2 1 2 4 5 5 2 3 3 6 6 5 5 1 6 2 3 2 1 2 3 2 5 1 3 6 4 3 6 5 3
 [38] 5 2 4 6 6 2 2 5 2 4 5 1 6 6 3 1 5 5 2 3 3 6 5 3 6 6 5 3 2 1 3 5 3 4 5 4 2
 [75] 3 1 6 2 1 1 4 1 2 3 5 2 3 4 3 1 1 2 6 5 6 4 1 5 1 6 1

EnsCat documentation built on May 1, 2019, 8:45 p.m.