rllm.transforms.table_transforms.TableTransform

class rllm.transforms.table_transforms.TableTransform(out_dim: int | None = None, col_type: ColType | None = None, post_module: Module | None = None, na_mode: Dict[StatType, NAMode] | None = None, transforms: List[Callable] | None = None)[source]

Bases: Module, ABC

Base class for table Transform. This module transforms tensor of some specific columns type into 3-dimensional column-wise tensor that is input into tabular deep learning models. Columns with same ColType will be transformed into tensors. By default, it handles missing values (NaNs) according to the specified na_mode.

Parameters:
  • out_dim (int) – The output dim dimensionality

  • col_type (ColType) – Column type used for NA-mode validation.

  • post_module (Module, optional) – The post-hoc module applied to the output, such as activation function and normalization. Must preserve the shape of the output. If None, no module will be applied to the output. (default: None)

  • na_mode (NAMode, optional) – The instruction that indicates how to impute NaN values. (default: None)

  • transforms (List[Callable], optional) – A list of transformation functions to be applied to the input data. Each function in the list should take the input data as an argument and return the transformed data. (default: :obj=`None`)

forward(data: TableData) Tensor[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

nan_forward(data: TableData) Tensor[source]

Replace NaN values in input Tensor given na_mode.

Parameters:

feat – Input Tensor.

abstract reset_parameters()[source]

Initialize the parameters of post_module.