Data Conditions#
- class DataCondition(input, conditional_variables=None)[source]#
Bases:
ConditionInterfaceThe class
DataConditiondefines an unsupervised condition based oninputdata. This condition is typically used in data-driven problems, where the model is trained using a custom unsupervised loss determined by the chosenSolverInterface, while leveraging the provided data during training. Optionalconditional_variablescan be specified when the model depends on additional parameters.The class automatically selects the appropriate implementation based on the type of the
inputdata. Depending on whether theinputis a tensor or graph-based data, one of the following specialized subclasses is instantiated:TensorDataCondition: For cases where theinputis either atorch.Tensoror aLabelTensorobject.GraphDataCondition: For cases where theinputis either aGraphorDataobject.
- 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
DataConditionclass.- Parameters:
input (torch.Tensor | LabelTensor | Graph | Data | list[Graph] | list[Data] | tuple[Graph] | tuple[Data]) – The input data for the condition.
conditional_variables (torch.Tensor | LabelTensor) – The conditional variables for the condition. Default is
None.
- class GraphDataCondition(input, conditional_variables=None)[source]#
Bases:
DataConditionSpecialization of the
DataConditionclass for the case whereinputis either aGraphobject or aDataobject.Initialization of the
DataConditionclass.- Parameters:
input (torch.Tensor | LabelTensor | Graph | Data | list[Graph] | list[Data] | tuple[Graph] | tuple[Data]) – The input data for the condition.
conditional_variables (torch.Tensor | LabelTensor) – The conditional variables for the condition. Default is
None.
- class TensorDataCondition(input, conditional_variables=None)[source]#
Bases:
DataConditionSpecialization of the
DataConditionclass for the case whereinputis either aLabelTensorobject or atorch.Tensorobject.Initialization of the
DataConditionclass.- Parameters:
input (torch.Tensor | LabelTensor | Graph | Data | list[Graph] | list[Data] | tuple[Graph] | tuple[Data]) – The input data for the condition.
conditional_variables (torch.Tensor | LabelTensor) – The conditional variables for the condition. Default is
None.