Description Usage Arguments Value Author(s) Examples
View source: R/spectrum-shift.R
Make a symmetric matrix positive semi-definite.
1 | spectrumShift(kernelMatrix, coeff = 1.2, shift = NULL, verbose = FALSE)
|
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. |
This function returns the matrix kernelMatrix
after applying
the required spectrum shift.
Alessandra Cabassi alessandra.cabassi@mrc-bsu.cam.ac.uk
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.