DistributionalMixtureConverter#

class sdm.prior.DistributionalMixtureConverter(dist_num_conv_prob: float = 0.1, dist_count_prob: float = 0.3, dist_warp_prob: float = 1.0, dist_feedback_gain: float = 10.0, allow_kumaraswamy_warping: bool = True)#

Bases: NumericalConverter

Convert latent channels to numerical column values.

Sample values using a signal, noise scale, and subgroup probability. Values may be rounded or warped; sampled values may also replace the first channel passed to child nodes.

Parameters:
  • dist_num_conv_prob (float) – Threshold for selecting three channels rather than one. Equality selects one channel.

  • dist_count_prob (float) – Probability of rounding three-channel values.

  • dist_warp_prob (float) – Probability of selecting from the column-warping pool, which includes the identity transform.

  • dist_feedback_gain (float) – Upper bound on the log-uniform scale for values passed to child nodes; the lower bound is its reciprocal.

  • allow_kumaraswamy_warping (bool) – Include Kumaraswamy warping in the pool.

sample_num_channels(num_columns: int, generator: Generator | None = None) → Tensor#

Sample how many latent channels each numerical column reads.

Parameters:
  • num_columns (int) – Number of columns.

  • generator (Generator | None) – Pseudorandom generator.

Returns:

Integer channel counts with shape [C] for C columns. The default is one channel per column.

Return type:

Tensor

forward(slices: Tensor, generator: Generator | None = None) → tuple[Tensor, Tensor]#

Return numerical column values and slices passed to child nodes.

Parameters:
  • slices (Tensor) – Node-channel slices per column with shape [C, H, R] for columns, channels, and rows. The channel count H may be ragged across columns.

  • generator (Generator | None) – Pseudorandom generator.

Returns:

Column values with shape [C, R] and updated node-channel slices with the input shape for use by child nodes.

Return type:

tuple[Tensor, Tensor]