diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e54044..e62a1d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning][]. - Fix neighbors connectivities in test to use new scanpy fn {pr}`170`. - Fix Kmeans test {pr}`172`. - Fix deprecation and future warnings {pr}`171`. +- Fix lisi return type and docstring {pr}`182`. ## 0.5.1 (2024-02-23) diff --git a/src/scib_metrics/metrics/_lisi.py b/src/scib_metrics/metrics/_lisi.py index 17c2168..9c088d4 100644 --- a/src/scib_metrics/metrics/_lisi.py +++ b/src/scib_metrics/metrics/_lisi.py @@ -39,7 +39,7 @@ def lisi_knn(X: NeighborsResults, labels: np.ndarray, perplexity: float = None) return 1 / simpson -def ilisi_knn(X: NeighborsResults, batches: np.ndarray, perplexity: float = None, scale: bool = True) -> np.ndarray: +def ilisi_knn(X: NeighborsResults, batches: np.ndarray, perplexity: float = None, scale: bool = True) -> float: """Compute the integration local inverse simpson index (iLISI) for each cell :cite:p:`korsunsky2019harmony`. Returns a scaled version of the iLISI score for each cell, by default :cite:p:`luecken2022benchmarking`. @@ -60,7 +60,7 @@ def ilisi_knn(X: NeighborsResults, batches: np.ndarray, perplexity: float = None Returns ------- ilisi - Array of shape (n_cells,) with the iLISI score for each cell. + iLISI score. """ batches = np.asarray(pd.Categorical(batches).codes) lisi = lisi_knn(X, batches, perplexity=perplexity) @@ -71,7 +71,7 @@ def ilisi_knn(X: NeighborsResults, batches: np.ndarray, perplexity: float = None return ilisi -def clisi_knn(X: NeighborsResults, labels: np.ndarray, perplexity: float = None, scale: bool = True) -> np.ndarray: +def clisi_knn(X: NeighborsResults, labels: np.ndarray, perplexity: float = None, scale: bool = True) -> float: """Compute the cell-type local inverse simpson index (cLISI) for each cell :cite:p:`korsunsky2019harmony`. Returns a scaled version of the cLISI score for each cell, by default :cite:p:`luecken2022benchmarking`. @@ -92,7 +92,7 @@ def clisi_knn(X: NeighborsResults, labels: np.ndarray, perplexity: float = None, Returns ------- clisi - Array of shape (n_cells,) with the cLISI score for each cell. + cLISI score. """ labels = np.asarray(pd.Categorical(labels).codes) lisi = lisi_knn(X, labels, perplexity=perplexity)