MadnisLoss

class madspace.MadnisLoss(self: madspace._madspace_py.MadnisLoss, functions: collections.abc.Sequence[madspace._madspace_py.FunctionGenerator], cwnet: madspace._madspace_py.ChannelWeightNetwork | None, softclip_threshold: SupportsFloat = 0.0, compressed_channel_weight_count: SupportsInt = 50)

Bases: FunctionGenerator

MadNIS training objective for the adaptive samplers.

Combines the per-channel integrand and sampling-probability values into the variance-based loss used to train the Flow and ChannelWeightNetwork [1]. A dedicated study of madspace with MadNIS is left to a future publication, so this class is described from the code only.

batch is the leading batch dimension. c indexes the channels.

Arguments

  • chan<c>_integrand – float, shape (batch,) – integrand values.

  • chan<c>_sample_prob – float, shape (batch,) – sampling probabilities.

  • chan<c>_cwnet_inputs, chan<c>_channel_weight_values / chan<c>_channel_weight_indices – present only with a ChannelWeightNetwork.

Returns

  • loss – float, scalar – the training loss.

  • abs_means – float, shape (c,) – per-channel mean of |integrand|.

  • variances – float, shape (c,) – per-channel integrand variance.

References

Parameters:
  • functions – The per-channel integrands.

  • cwnet – Optional channel-weight network to train jointly.

  • softclip_threshold – Soft-clipping threshold on the loss contribution; 0 disables it.

  • compressed_channel_weight_count – Number of channel-weight entries kept per event.