Data Structures

Additional data structures used in SPFlow.

IntervalEvidence

Container for interval-based evidence (censored data) for range queries.

class spflow.meta.data.interval_evidence.IntervalEvidence(low, high)[source]

Bases: object

Represents interval bounds for range inference queries.

Use this instead of a point evidence tensor when computing P(low <= X <= high).

low

Lower bounds tensor of shape (batch, features). Use NaN for no lower bound.

high

Upper bounds tensor of shape (batch, features). Use NaN for no upper bound.

Example

>>> import torch
>>> evidence = IntervalEvidence(
...     low=torch.tensor([[0.2, 0.3]]),
...     high=torch.tensor([[0.8, 0.7]])
... )
>>> evidence.shape
torch.Size([1, 2])
to(device)[source]

Move evidence to specified device.

Return type:

IntervalEvidence

property device: device

Return device of the evidence tensors.

high: Tensor
low: Tensor
property shape: Size

Return shape of the evidence tensors.