sincei.TopicModels module#

class sincei.TopicModels.TOPICMODEL(adata, n_topics, binarize=False, smart_code='lfu', n_passes=1, n_workers=1)[source]#

Bases: object

Computes LSA or LDA for a given matrix and returns the cell-topic matrix.

Parameters#

adataAnnData

AnnData object containing the data matrix in adata.X, with cells in adata.obs_names and regions in adata.var_names.

n_topicsint

Number of Topics / Principal Components for modeling.

binarizebool, optional

If True, the input matrix will be binarized (default is False). Recommended for LDA.

smart_codestr

SMART (System for the Mechanical Analysis and Retrieval of Text) code for weighting of input matrix for TFIDF. Only valid for the LSA model. The default ("lfu") corresponds to "log"TF * IDF, and "pivoted unique" normalization of document length. For more information, see: https://en.wikipedia.org/wiki/SMART_Information_Retrieval_System

n_passesint, optional

Number of passes for the LDA model. Default is 1.

n_workersint, optional

Number of workers for the LDA model. Default is 1.

runLSA()[source]#

Computes LSA for a given matrix and updates the TOPICMODEL object.

runLDA()[source]#

Computes LDA model for a given matrix and updates the TOPICMODEL object.

get_cell_topic(pop_sparse_cells=False)[source]#

Get cell-topic matrix from the TOPICMODEL object.

Returns#

cell_topicpandas dataframe

Cell-topic matrix