nemi.workflow module
- class nemi.workflow.NEMI(params=None)[source]
Bases:
SingleNemi
Main NEMI workflow
- Parameters:
params (dict, optional) – clustering and enbedding algorithm parameters.
- class nemi.workflow.SingleNemi(params=None)[source]
Bases:
object
A single instance of the NEMI pipeline
- Parameters:
params (dict, optional) – A dictionary of the embedding and clustering options. Defaults to
nemi.workflow.default_params
.
- run(X, save_steps=True)[source]
Run a single instance of the NEMI pipeline
The pipeline consists of steps:
fitting the embedding
predicting the clusters,
sorting the clusters by descending size
- Parameters:
X (
ndarray
) – The data contained in a sparse matrix of shape (n_samples
,n_features
)
- scale_data(X)[source]
Scale the data to have a mean and variance of 1.
- Parameters:
X (
ndarray
) – The data to pick seeds for. A sparse matrix of shape (n_samples
,n_features
)**kwargs – keyword arguments to embedding function
- predict_clusters()[source]
Run the clustering algorithm on the embedding
Clustering algorithm parameters is set by the
clustering_dict
attribute.- Returns:
Identified clusters
- sort_clusters(clusters)[source]
Updates cluster labels 0,1,…,k so that each cluster is of descending size.
- Parameters:
( (clusters) – py:class`~numpy.ndarray`, list)
- Returns:
An array with the new labels