scib.metrics.nmi

scib.metrics.nmi(adata, group1, group2, method='arithmetic', nmi_dir=None)

Normalized mutual information

Wrapper for normalized mutual information NMI between two different cluster assignments

Parameters
  • adata – Anndata object

  • group1 – column name of adata.obs

  • group2 – column name of adata.obs

  • method – NMI implementation. ‘max’: scikit method with average_method='max'; ‘min’: scikit method with average_method='min'; ‘geometric’: scikit method with average_method='geometric'; ‘arithmetic’: scikit method with average_method='arithmetic'; ‘Lancichinetti’: implementation by A. Lancichinetti 2009 et al. https://sites.google.com/site/andrealancichinetti/mutual; ‘ONMI’: implementation by Aaron F. McDaid et al. https://github.com/aaronmcdaid/Overlapping-NMI

  • nmi_dir – directory of compiled C code if ‘Lancichinetti’ or ‘ONMI’ are specified as method. These packages need to be compiled as specified in the corresponding READMEs.

Returns

Normalized mutual information NMI value