Data Conditions#

class DataCondition(input, conditional_variables=None)[source]#

Bases: ConditionInterface

The class DataCondition defines an unsupervised condition based on input data. This condition is typically used in data-driven problems, where the model is trained using a custom unsupervised loss determined by the chosen SolverInterface, while leveraging the provided data during training. Optional conditional_variables can be specified when the model depends on additional parameters.

The class automatically selects the appropriate implementation based on the type of the input data. Depending on whether the input is a tensor or graph-based data, one of the following specialized subclasses is instantiated:

Example:

>>> from pina import Condition, LabelTensor
>>> import torch
>>> pts = LabelTensor(torch.randn(100, 2), labels=["x", "y"])
>>> cond_vars = LabelTensor(torch.randn(100, 1), labels=["w"])
>>> condition = Condition(input=pts, conditional_variables=cond_vars)

Initialization of the DataCondition class.

Parameters:

Note

If input is a list of Graph or Data, all elements in the list must share the same structure, with matching keys and consistent data types.

class GraphDataCondition(input, conditional_variables=None)[source]#

Bases: DataCondition

Specialization of the DataCondition class for the case where input is either a Graph object or a Data object.

Initialization of the DataCondition class.

Parameters:

Note

If input is a list of Graph or Data, all elements in the list must share the same structure, with matching keys and consistent data types.

class TensorDataCondition(input, conditional_variables=None)[source]#

Bases: DataCondition

Specialization of the DataCondition class for the case where input is either a LabelTensor object or a torch.Tensor object.

Initialization of the DataCondition class.

Parameters:

Note

If input is a list of Graph or Data, all elements in the list must share the same structure, with matching keys and consistent data types.