ladder.data.real_data.MetadataConverter#

class ladder.data.real_data.MetadataConverter(metadata_df)#

Class used to convert numerical torch tensors into categorical equivalents.

Allows mapping of numerical tensors with information that would usually be expected in obs into categorical equivalent with literals from the original metadata. This class allows for arbitrary subsets of data to be mapped back.

Parameters:

metadata (DataFrame) – The dataframe object that includes the metadata, which is obs for most cases.

df_view#

Dataframe object for reference.

Type:

DataFrame

num_cols#

Number of columns for df_view.

Type:

int

Methods table#

map_to_df(met_val_string)

The function that actually does the metadata mapping.

Methods#

MetadataConverter.map_to_df(met_val_string)#

The function that actually does the metadata mapping.

Parameters:

met_val_string (Tensor) – Tensor shaped like TensorDataset.

Return type:

ndarray

Returns:

metadata_mapping : ndarray Numerical tensor converted back to categorical equivalent.