DataModule

class aixd.mlmodel.data.data_loader.DataModule(*args: Any, **kwargs: Any)[source]

Bases: LightningDataModule

Data module for the ML model. It takes care of splitting the data into train, val and test sets, normalizing the data.

Parameters:
  • input_ml_dblock (InputML) – Input data block, defining normalizations, the type of the input data, and the heads for the ML model.

  • output_ml_dblock (OutputML) – Output data block, defining normalizations, the type of the output data, and the heads for the ML model.

  • x (Union[np.ndarray, torch.Tensor]) – The input fata matrix.

  • y (Union[np.ndarray, torch.Tensor]) – The output data matrix.

  • batch_size (int, optional) – Batch size. The default is 512.

  • split_ratios (List[Union[int, float]], optional) – List of ratios for splitting the data into train, val and test sets. The default is [0.8, 0.1, 0.1].

  • random_seed (int, optional) – Random seed for splitting the data. The default is RANDOM_SEED_SPLIT.

  • predict (bool, optional) – Whether to create a predict set. The default is False.

Methods

convert_to_dataloader

Converts input and output data to a dataloader.

from_dataset

Creates a data module from a dataset.

from_parameters

Creates a data module from parameters returned by the get_parameters(...) method.

get_checksum

Computes a checksum for the training/validation/test data.

get_parameters

Get parameters defining the data module.

inverse_transform

Unnormalize the input and output data.

inverse_transform_x

Unnormalize only the input data.

inverse_transform_y

Un-transform only the output data.

predict_dataloader

summary_input_output_dimensions

Calculates the dimensions of the input and output of the ML model.

test_dataloader

train_dataloader

transform

Transform the input and output data.

transform_x

Transform only the input data.

transform_y

Transform only the output data.

val_dataloader