spectrumShift: Spectrum shift

Description Usage Arguments Value Author(s) Examples

View source: R/spectrum-shift.R

Description

Make a symmetric matrix positive semi-definite.

Usage

1
spectrumShift(kernelMatrix, coeff = 1.2, shift = NULL, verbose = FALSE)

Arguments

kernelMatrix

symmetric matrix

coeff

Coefficient by which the minimum eigenvalue is multiplied when shifting the eigenvalues, in order to avoid numeric problems. Default is 1.2.

shift

Value of the constant added to the diagonal, if known a priori. Default is NULL.

verbose

Boolean flag: if TRUE, information about the shift is printed to screen. Default is FALSE.

Value

This function returns the matrix kernelMatrix after applying the required spectrum shift.

Author(s)

Alessandra Cabassi alessandra.cabassi@mrc-bsu.cam.ac.uk

Examples

1
2
3
4
5
6
7
8
9
# Load one dataset with 300 observations, 2 variables, 6 clusters
data <- as.matrix(read.csv(system.file("extdata", "dataset1.csv",
package = "klic"), row.names = 1))

# Compute consensus clustering with K=4 clusters
cm <- coca::consensusCluster(data, 4)

# Shift eigenvalues of the matrix by a constant: (min eigenvalue) * (coeff)
km <- spectrumShift(cm, coeff = 1.05)

klic documentation built on July 8, 2020, 6:23 p.m.