Correlated#

class sdm.prior.Correlated(hp: HP[T], *, key: Hashable | None = None)#

Bases: HP[T]

Sample numerical values from a shared, randomly sampled distribution.

A CorrelatedContext reuses Beta parameters for each key and supplies the generator for sampling. Without a context, each call samples new parameters. The Beta draws are mapped through hp.transform.

Parameters:
  • hp (HP[T]) – Numerical parameter sampler with a transform method mapping quantile levels to values.

  • key (Hashable | None) – Share Beta parameters with other samplers using this key. Defaults to this sampler’s identity.

sample_batch(size: int | Size | tuple[int, ...] = (), generator: Generator | None = None) → Tensor#

Sample a tensor, sharing parameters along its final dimension.

Parameters:
  • size (int | Size | tuple[int, ...]) – Output shape [..., N] or vector length. Leading dimensions identify independent parameter sets; N samples share each set. A scalar uses one parameter set. Shared keys must retain their leading shape in a scope.

  • generator (Generator | None) – Pseudorandom generator. In a context, omit it or pass the context’s generator.

Return type:

Tensor