scib_rapids.utils.one_hot

Contents

scib_rapids.utils.one_hot#

scib_rapids.utils.one_hot(y, n_classes=None)[source]#

One-hot encode an array.

Parameters:
  • y (ndarray | ndarray) – Array of shape (n_cells,) or (n_cells, 1).

  • n_classes (int | None (default: None)) – Number of classes. If None, inferred from the data.

Return type:

ndarray

Returns:

one_hot: cp.ndarray Array of shape (n_cells, n_classes).