MadnisTraining

class madspace.MadnisTraining(self: madspace._madspace_py.MadnisTraining, generator_context: madspace._madspace_py.Context, optimizer_context: madspace._madspace_py.Context, config: madspace._madspace_py.MadnisConfig, integrands: collections.abc.Sequence[madspace._madspace_py.Integrand], cwnet: madspace._madspace_py.ChannelWeightNetwork | None, seed: SupportsInt | None = None)

Bases: pybind11_object

MadNIS training loop for one subprocess’s channels [1, 2, 3].

Alternates sampling batches from the channels’ Integrand / ChannelWeightNetwork (online) or a replay buffer of past samples (buffered) with AdamOptimizer steps on the stratified variance loss, periodically drops underperforming channels, and tracks progress in a status history for reporting. MultiMadnisTraining coordinates one MadnisTraining per subprocess.

References

Parameters:
  • generator_context – Context the sampling runtimes run on.

  • optimizer_context – Context the trained globals and optimizer live on.

  • config – Training configuration.

  • integrands – One integrand per channel to train.

  • cwnet – Optional shared channel-weight network.

  • seed – Top-level run seed.

  • channel_index_offset – Offset added to this subprocess’s local channel indices when deriving seeds, so MultiMadnisTraining’s subprocesses (which all share the same top-level seed) get non-overlapping DerivedSeed channel-index ranges.

active_channel_count(self: madspace._madspace_py.MadnisTraining) → int

Number of channels not yet dropped.

active_channels(self: madspace._madspace_py.MadnisTraining) → list[int]

Indices of the channels not yet dropped.

train_step(self: madspace._madspace_py.MadnisTraining, batch_index: SupportsInt) → None

Run training batch batch_index: sample, optimize, and update the status history.