pod: Finding optimal discrete solutions for spectral clustering

View source: R/SpectralClustering.R

podR Documentation

Finding optimal discrete solutions for spectral clustering

Description

Finding optimal discrete solutions for spectral clustering

Usage

pod(Y, verbose = FALSE)

Arguments

Y

a matrix with N rows and K columns, with N being the number of objects (e.g., patients), K being the number of clusters. The K columns of 'Y' should correspond to the first k eigenvectors of graph Laplacian matrix (of affinity matrix) corresponding to the k smallest eigenvalues

verbose

logical(1); if true, print some information

Value

class assignment matrix with the same shape as Y (i.e., N x K). Each row contains all zeros except one 1. For instance, if X_ij = 1, then object (eg, patient) i belongs to cluster j.

References

Stella, X. Yu, and Jianbo Shi. "Multiclass spectral clustering." ICCV. IEEE, 2003.

Examples

D = matrix(runif(400),20)
A = affinity_matrix(D, 5)
d = rowSums(A)
L = diag(d) - A
# `NL` is graph Laplacian of affinity matrix `A`
NL = diag(1/d) %*% L
e = eigen(NL)
# Here we select eigenvectors corresponding to three smallest eigenvalues 
Y = Re(e$vectors[,-1:-17])
X = pod(Y)

BeautyOfWeb/ANF documentation built on Feb. 18, 2024, 5:03 p.m.