kernelLaplacian {MMOC}R Documentation

Calculate the graph Laplacian of a given data set

Description

Calculate the graph laplacian from a given data set with subjects as rows and features as columns.

Usage

kernelLaplacian(
  dat,
  kernel = c("Gaussian", "ZM", "Spectrum", "Linear"),
  laplacian = c("shift", "Ng", "sym", "rw"),
  grf.type = c("full", "knn", "e-graph"),
  k = 5,
  p = 5,
  rho = NULL,
  epsilon = 0,
  mutual = FALSE,
  binary.grf = FALSE,
  plots = TRUE,
  verbose = TRUE
)

Arguments

dat

A matrix like object with subjects as rows and features as columns.

kernel

The type of kernel used to calculate the graph's adjacency matrix: "Gaussian" for the standard Gaussian kernel, "ZM" for the Zelnik-Manor kernel, "Spectrum" for the spectrum kernel, "Linear" for the linear kernel (dot product), and "Cor" for a kernel of pairwise correlations. See references for more details.

laplacian

One of "shift", "Ng", "rw" or "sym". See details for description

grf.type

Type of graph to calculate: "full" for adjacency matrix equal to the kernel, "knn" for a k-nearest neighbors graph, "e-graph" for an "epsilon graph"

k

An integer value for k in the k-nearest neighbors graph. Only the k largest edges (most similar neighbors) will be kept

p

An integer value for the p-nearest neighbor in the ZM kernel

rho

A value for the dispersion parameter in the Gaussian kernel. It is in the denominator of the exponent, so higher values correspond to lower similarity. By default it is the median pairwise Gaussian distance

epsilon

The cutoff value for the e-graph. Edges lower than this value will be removed

mutual

Make a "mutual" knn graph. Only keeps edges when two nodes are both in each others k-nearest set

binary.grf

Set all edges >0 to 1

plots

Whether or not to plot the final graph, a heatmap of calculated kernel, and the eigen values of the Laplacian

verbose

Whether or not to give some summary statistics of the pairwise distances

Details

The four Lapalacians are defined as L_{shift}=I+D^{-1/2}AD^{-1/2}, L_{Ng}=D^{-1/2}AD^{-1/2}, L_{sym}=I-D^{-1/2}AD^{-1/2}, and L_{rw}=I-D^{-1}A. The shifted Laplacian, L_{shift}=I+D^{-1/2}AD^{-1/2}, is recommended for multi-view spectral clustering.

Value

An n\timesn matrix where n is the number of rows in dat.

References

https://academic.oup.com/bioinformatics/article/36/4/1159/5566508#199177546

Examples


## Generating data with 3 distinct clusters
## Note that 'clustStruct' returns a list
dd <- clustStruct(n=120, p=30, k=3, noiseDat='random')[[1]]

kernelLaplacian(dd, kernel="Spectrum")

[Package MMOC version 0.1.1.0 Index]