scib_metrics.kbet#
- scib_metrics.kbet(X, batches, alpha=0.05)[source]#
Compute kbet [Büttner et al., 2018].
This implementation is inspired by the implementation in Pegasus: https://pegasus.readthedocs.io/en/stable/index.html
A higher acceptance rate means more mixing of batches. This implementation does not exactly mirror the default original implementation, as there is currently no
adapt
option.Note that this is also not equivalent to the kbet used in the original scib package, as that one computes kbet for each cell type label. To achieve this, use
scib_metrics.kbet_per_label()
.- Parameters:
X (
NeighborsResults
) – ANeighborsResults
object.batches (
ndarray
) – Array of shape (n_cells,) representing batch values for each cell.alpha (
float
(default:0.05
)) – Significance level for the statistical test.
- Return type:
- Returns:
- acceptance_rate
Kbet acceptance rate of the sample.
- stat_mean
Mean Kbet chi-square statistic over all cells.
- pvalue_mean
Mean Kbet p-value over all cells.