cluster_BIC: Calculates BIC for a given clustering.

Description Usage Arguments Details Value Examples

View source: R/RcppExports.R

Description

Computes Bayesian information criterion for a given clustering of a data set.

Usage

1
cluster_BIC(data, centres)

Arguments

data

a matrix (n x m). Rows are observations, columns are predictors.

centres

matrix of cluster means (k x m), where k is the number of clusters.

Details

Bayesian information criterion (BIC) is calculated using the formula, BIC = -2 * log(L) + k*log(n). k is the number of free parameters, in this case is m*k + k - 1. n is the number of observations (rows of data). L is the liklihood for the given set of cluster centres.

Value

BIC value

Examples

1
2
3
4
5
iris_mat <- as.matrix(iris[,1:4])
iris_centres2 <- tkmeans(iris_mat, 2 , 0.1, c(1,1,1,1), 1, 10, 0.001) # 2 clusters
iris_centres3 <- tkmeans(iris_mat, 3 , 0.1, c(1,1,1,1), 1, 10, 0.001) # 3 clusters
cluster_BIC(iris_mat, iris_centres2)
cluster_BIC(iris_mat, iris_centres3)

andrewthomasjones/lowmemtkmeans documentation built on Nov. 8, 2017, 3:11 a.m.