MadnisLoss

class MadnisLoss : public madspace::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

Public Functions

MadnisLoss(const std::vector<std::shared_ptr<FunctionGenerator>> &functions, const std::optional<ChannelWeightNetwork> &cwnet, double softclip_threshold = 0.0, std::size_t compressed_channel_weight_count = 50)
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.