mlKmeans: kmeans from MLPACK

Description Usage Arguments Details Value Author(s) References Examples

View source: R/fun.R

Description

kmeans example for using MLPACK with R.

Usage

1
mlKmeans(X, y)

Arguments

X

data matrix.

y

number of clusters.

Details

This is a kmeans example using RcppMLPACK. It uses the Kmeans method in MLPACK and integrates with R.

Value

mlKmeans returns a list with cluster assignment:

Author(s)

For RcppMLPACK: Qiang Kou

For MLPACK: Ryan Curtin

References

MLPACK project: http://www.mlpack.org/

Examples

1
2
  data(trees, package="datasets")
  mlKmeans(t(trees),3)

Example output

KMeans::Cluster(): converged after 6 iterations.
$clusters
[1] 3

$result
      [,1]
 [1,]    0
 [2,]    0
 [3,]    0
 [4,]    0
 [5,]    2
 [6,]    2
 [7,]    0
 [8,]    2
 [9,]    2
[10,]    2
[11,]    2
[12,]    2
[13,]    2
[14,]    0
[15,]    2
[16,]    2
[17,]    2
[18,]    2
[19,]    2
[20,]    0
[21,]    2
[22,]    2
[23,]    2
[24,]    2
[25,]    1
[26,]    1
[27,]    1
[28,]    1
[29,]    1
[30,]    1
[31,]    1

RcppMLPACK documentation built on April 21, 2020, 9:05 a.m.