Dataset#
- class PinaDataset(conditions_dict, max_conditions_lengths, automatic_batching)[source]#
-
Abstract class for the PINA dataset which extends the PyTorch
Dataset
class. It defines the common interface forPinaTensorDataset
andPinaGraphDataset
classes.Initialize the instance by storing the conditions dictionary, the maximum number of items per conditions to consider, and the automatic batching flag.
- Parameters:
conditions_dict (dict) – A dictionary mapping condition names to their respective data. Each key represents a condition name, and the corresponding value is a dictionary containing the associated data.
max_conditions_lengths (dict) – Maximum number of data points that can be included in a single batch per condition.
automatic_batching (bool) – Indicates whether PyTorch automatic batching is enabled in
PinaDataModule
.
- class PinaDatasetFactory(conditions_dict, **kwargs)[source]#
Bases:
object
Factory class for the PINA dataset.
Depending on the data type inside the conditions, it instanciate an object belonging to the appropriate subclass of
PinaDataset
. The possible subclasses are:PinaTensorDataset
, for handlingtorch.Tensor
andLabelTensor
data.PinaGraphDataset
, for handlingGraph
andData
data.
Instantiate the appropriate subclass of
PinaDataset
.If a graph is present in the conditions, returns a
PinaGraphDataset
, otherwise returns aPinaTensorDataset
.- Parameters:
conditions_dict (dict) – Dictionary containing all the conditions to be included in the dataset instance.
- Returns:
A subclass of
PinaDataset
.- Return type:
- Raises:
ValueError – If an empty dictionary is provided.
- class PinaGraphDataset(conditions_dict, max_conditions_lengths, automatic_batching)[source]#
Bases:
PinaDataset
Dataset class for the PINA dataset with
Data
andGraph
data.Initialize the instance by storing the conditions dictionary, the maximum number of items per conditions to consider, and the automatic batching flag.
- Parameters:
conditions_dict (dict) – A dictionary mapping condition names to their respective data. Each key represents a condition name, and the corresponding value is a dictionary containing the associated data.
max_conditions_lengths (dict) – Maximum number of data points that can be included in a single batch per condition.
automatic_batching (bool) – Indicates whether PyTorch automatic batching is enabled in
PinaDataModule
.
- class PinaTensorDataset(conditions_dict, max_conditions_lengths, automatic_batching)[source]#
Bases:
PinaDataset
Dataset class for the PINA dataset with
torch.Tensor
andLabelTensor
data.Initialize the instance by storing the conditions dictionary, the maximum number of items per conditions to consider, and the automatic batching flag.
- Parameters:
conditions_dict (dict) – A dictionary mapping condition names to their respective data. Each key represents a condition name, and the corresponding value is a dictionary containing the associated data.
max_conditions_lengths (dict) – Maximum number of data points that can be included in a single batch per condition.
automatic_batching (bool) – Indicates whether PyTorch automatic batching is enabled in
PinaDataModule
.