pyjuice.queries.conditional
- pyjuice.queries.conditional(pc: TensorCircuit, data: Tensor, missing_mask: Tensor | None = None, target_vars: Sequence[int] | None = None, fw_input_fn: str | Callable | None = None, bk_input_fn: str | Callable | None = None, **kwargs)
Compute the conditional probability given hard or soft evidence, i.e., P(o|e).
- Parameters:
pc (TensorCircuit) – the input PC
data (torch.Tensor) – data of size [B, num_vars] (hard evidence) or a custom shape paired with fw_input_fn
missing_mask (torch.Tensor) – a boolean mask indicating marginalized variables; the size can be [num_vars] or [B, num_vars]
fw_input_fn (Optional[Union[str,Callable]]) – an optional custom function for the forward pass of input layers
bk_input_fn (Optional[Union[str,Callable]]) – an optional custom function for the backward pass of input layers