Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gjhuizing committed Aug 27, 2023
1 parent eded401 commit cfcb94c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/source/score.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mowgli.score
----------------

.. automodule:: mowgli.score
:members:
:undoc-members:
:show-inheritance:
18 changes: 18 additions & 0 deletions mowgli/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@ def embedding_leiden_across_resolutions(
n_neighbors: int,
resolutions: Iterable[float] = np.arange(0.1, 2.1, 0.1),
):
"""Compute the ARI and NMI for Leiden clustering on an embedding,
for various resolutions.
Args:
embedding (np.ndarray):
The embedding, shape (n_obs, n_latent)
labels (np.ndarray):
The labels, shape (n_obs,)
n_neighbors (int):
The number of neighbors to use for the kNN graph.
resolutions (Iterable[float], optional):
The resolutions to use for Leiden clustering. Defaults to
np.arange(0.1, 2.1, 0.1).
Returns:
Tuple[Iterable[float], Iterable[float], Iterable[float]]:
The resolutions, ARIs and NMIs.
"""
# Create an AnnData object with the joint embedding.
joint_embedding = ad.AnnData(embedding)

Expand Down

0 comments on commit cfcb94c

Please sign in to comment.