selectModel | R Documentation |
Select the number of clusters by specified criteria.
selectModel(obj, criteria = 'MBIC', pen.const=1)
## S3 method for class 'drscObject'
selectModel(obj, criteria = 'MBIC', pen.const=1)
## S3 method for class 'Seurat'
selectModel(obj, criteria = 'MBIC', pen.const=1)
S
obj |
an object with class |
criteria |
a string, specify the criteria used for selecting the number of clusters, supporting "MBIC", "BIC" and "AIC". |
pen.const |
an optional positive value, the adjusted constant used in the MBIC criteria. It usually takes value between 0.1 to 1. |
For S3 method of Seurat
, it return a revised "Seurat" object with updated Idents(seu)
, spatial.drsc.cluster
in the metadata and DimReduc object named dr-sc
in the slot reductions
. For S3 method of drscObject
, it returns a list with the following components:
bestK |
the selected number of clusters. |
cluster |
inferred class labels |
hZ |
extracted latent features. |
icMat |
a numeric matrix including the criteria value for each number of clusters K. |
nothing
Wei Liu
DR.SC, DR.SC_fit.
seu <- gendata_RNAExp(height=10, width=10,p=50, K=4)
library(Seurat)
seu <- NormalizeData(seu, verbose=FALSE)
# or choose 40 spatailly variable features using FindSVGs in DR.SC
seu <- FindSVGs(seu, nfeatures = 40, verbose=FALSE)
# users define the adjacency matrix
Adj_sp <- getAdj(seu, platform = 'ST')
dat <- GetAssayData(seu, assay = "RNA", slot='data')
X <- Matrix::t(dat)
# maxIter = 2 is only used for illustration, and user can use default.
drscList <- DR.SC_fit(X,Adj_sp=Adj_sp ,K=4, maxIter=2, verbose=TRUE)
drsc1 <- selectModel(drscList)
str(drsc1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.