bartlett

Share:

Description

Adaptation of the Bartlett statistical test for equal variances, to a procedure of detection of the optimal number of clusters, in the context of spectral clustering.

Usage

1
bartlett(eigvals, thres=0.95, maxk=20)

Arguments

eigvals

A vector of eigenvalues, as returned by the eigendecomposition of the normalized Laplacian (see examples), i.e. in decreasing order.

thres

1 - alpha significance threshold, defaults to 95

maxk

upper bound to the returned value.

Value

The computed optimal number of clusters.

Author(s)

Pierrick Bruneau

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
	# normalized Laplacian computation
	kern <- local.rbfdot(synth1)
	nelts <- dim(kern)[1]
	diag(kern) <- 0
	deg <- sapply(1:nelts, function(i) {
		return(sum(kern[i,]))
	})
	deg <- diag(deg)
	L <- diag(nelts) - solve(deg) 
	eig <- eigen(L)

	optK <- bartlett(eig$values)$k