Dataset#
- class PinaDataset(conditions_dict, max_conditions_lengths, automatic_batching)[source]#
-
Abstract class for the PINA dataset which extends the PyTorch
Datasetclass. It defines the common interface forPinaTensorDatasetandPinaGraphDatasetclasses.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:
objectFactory 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.TensorandLabelTensordata.PinaGraphDataset, for handlingGraphandDatadata.
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:
PinaDatasetDataset class for the PINA dataset with
DataandGraphdata.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:
PinaDatasetDataset class for the PINA dataset with
torch.TensorandLabelTensordata.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.
- property input#
Return the input data for the dataset.
- Returns:
Dictionary containing the input points.
- Return type:
- update_data(new_conditions_dict)[source]#
Update the dataset with new data. This method is used to update the dataset with new data. It replaces the current data with the new data provided in the new_conditions_dict parameter.
- Parameters:
new_conditions_dict (dict) – Dictionary containing the new data.
- Returns:
None