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:
FunctionGeneratorMadNIS 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
madspacewith MadNIS is left to a future publication, so this class is described from the code only.batchis the leading batch dimension.cindexes 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
[1] T. Heimel et al., “MadNIS - Neural multi-channel importance sampling”, https://arxiv.org/abs/2212.06172
- Parameters:
functions – The per-channel integrands.
cwnet – Optional channel-weight network to train jointly.
softclip_threshold – Soft-clipping threshold on the loss contribution;
0disables it.compressed_channel_weight_count – Number of channel-weight entries kept per event.