stereo.core.StPipeline.leiden¶
- StPipeline.leiden(neighbors_res_key='neighbors', res_key='leiden', directed=True, resolution=1, use_weights=True, random_state=0, n_iterations=-1, method='normal')[source]¶
Cluster cells into subgroups by Leiden algorithm [Traag18].
- Parameters:
neighbors_res_key (
str) – the key of neighbors to get corresponding result fromself.result.res_key (
str) – the key for storing result of Leiden clustering.directed (
bool) – ifTrue, treat the graph as directed. IfFalse, undirected.resolution (
float) – a parameter value controlling the coarseness of the clustering. Higher values lead to more clusters. Set toNoneif overridingpartition_typeto one that doesn’t accept aresolution_parameter.use_weights (
bool) – ifTrue, edge weights from the graph are used in computation, more emphasis should be placed on stronger edges. # noqarandom_state (
int) – change the initialization of the optimization.n_iterations (
int) – how many iterations of the Leiden clustering algorithm to perform. Positive values above 2 define the total number of iterations to perform,-1has the algorithm run until it reaches its optimal clustering.method – Use the original ‘normal’ implementation, or ‘rapids’ (experimental, GPU only)
- Returns:
Clustering result of Leiden is stored in
self.resultwhere the key is'leiden'.