commute_cluster: Commute Time Clustering

View source: R/commute_cluster.R

commute_clusterR Documentation

Commute Time Clustering

Description

The commute_cluster function performs spatially constrained clustering on a NeuroVec instance using the commute time distance and K-means clustering.

Usage

commute_cluster(
  bvec,
  mask,
  K = 100,
  ncomp = ceiling(sqrt(K * 2)),
  alpha = 0.5,
  sigma1 = 0.73,
  sigma2 = 5,
  connectivity = 27,
  weight_mode = c("binary", "heat")
)

Arguments

bvec

A NeuroVec instance supplying the data to cluster.

mask

A NeuroVol mask defining the voxels to include in the clustering result. If the mask contains numeric data, nonzero values will define the included voxels. If the mask is a LogicalNeuroVol, then TRUE will define the set of included voxels.

K

The number of clusters to find. Default is 100.

ncomp

The number of components to use for the commute time embedding. Default is the ceiling of sqrt(K2).

alpha

A numeric value controlling the balance between spatial and feature similarity. Default is 0.5.

sigma1

A numeric value controlling the spatial weighting function. Default is 0.73.

sigma2

A numeric value controlling the feature weighting function. Default is 5.

connectivity

An integer representing the number of nearest neighbors to consider when constructing the similarity graph. Default is 27.

weight_mode

A character string indicating the type of weight function for the similarity graph. Options are "binary" and "heat". Default is "heat".

Value

A list of class commute_time_cluster_result with the following elements:

clusvol

An instance of type ClusteredNeuroVol.

cluster

A vector of cluster indices equal to the number of voxels in the mask.

centers

A matrix of cluster centers with each column representing the feature vector for a cluster.

coord_centers

A matrix of spatial coordinates with each row corresponding to a cluster.

See Also

snic, turbo_cluster

Examples

mask <- NeuroVol(array(1, c(20,20,20)), NeuroSpace(c(20,20,20)))
vec <- replicate(10, NeuroVol(array(runif(202020), c(20,20,20)),
NeuroSpace(c(20,20,20))), simplify=FALSE)
vec <- do.call(concat, vec)

commute_res <- commute_cluster(vec, mask, K=100)


bbuchsbaum/neurocluster documentation built on April 1, 2024, 8:43 p.m.