GWProblem.compute_entropy(source, target, forward=True, key_added='conditional_entropy', batch_size=None, c=1e-10, **kwargs)

Compute the conditional entropy per cell.

The conditional entropy reflects the uncertainty of the mapping of a single cell.

  • source (TypeVar(K, bound= Hashable)) – Source key.

  • target (TypeVar(K, bound= Hashable)) – Target key.

  • forward (bool) – If True, computes the conditional entropy of a cell in the source distribution, else the conditional entropy of a cell in the target distribution.

  • key_added (Optional[str]) – Key in obs where the entropy is stored.

  • batch_size (Optional[int]) – Batch size for the computation of the entropy. If None, the entire dataset is used.

  • c (float) – Constant added to each row of the transport matrix to avoid numerical instability.

  • kwargs (Any) – Kwargs for entropy().

  • self (AnalysisMixinProtocol[K, B])

Return type:



: None if key_added is not None. Otherwise, returns a data frame of shape (n_cells, 1) containing the conditional entropy per cell.