ladder.data.real_data.construct_labels

ladder.data.real_data.construct_labels#

ladder.data.real_data.construct_labels(counts, metadata, factors, style='concat', batch_key=None)#

Function to generate conditional labels for the various models included.

Parameters:
  • counts – The field corresponding to X.

  • metadata – The field corresponding to obs.

  • factors (array_like) – 1D Array-like of str. The list specifying factors, which are names of the columns from obs.

  • style (Literal["concat", "one-hot"]) – Specifies the label encoding.

  • batch_key (str, optional) – Specifies the batch key, must be included in obs.

Return type:

tuple

Returns:

datasetTensorDataset

The dataset object to be used downstream.

levelsdict

A mapping between the literal combinations of factors and their numerical equivalents.

converterAnndataConverter

The converter object with the associated dataset.

batch_mappingdict

Returned only if batch_key is given. Ordinal encoding for the batch dimension.