BufferUnweighter¶
- class madspace.BufferUnweighter(self: madspace._madspace_py.BufferUnweighter, types: madspace._madspace_py.NamedTypes, quantile: SupportsFloat = 0.0)¶
Bases:
FunctionGeneratorPartial unweighting of one batch, for the MadNIS replay buffer.
The maximum weight is the
quantilequantile of |w| over the batch (so a fraction 1 -quantileof the events is over-weight). An event is kept with probability min(1, |w| / w_max) and gets the weight sign(w) * max(|w|, w_max): the sign of a negative weight (an interference) is kept, and the quantile is over |w| like the acceptance, so that a mostly negative batch is still unweighted. Theadaptive_probof a kept event, the density it was sampled with, is multiplied by its acceptance probability and by N / N_kept, so that training on the buffered events stays unbiased (Sec. 3.4.1 of [1]).batchis the leading batch dimension.Arguments
the tensors named in
types(the first is the event weight, and one must be namedadaptive_prob).
Returns
the tensors named in
types, partially unweighted, withadaptive_probrescaled.
References
[1] T. Heimel, O. Mattelaer, R. Winterhalder, “MadSpace”, https://arxiv.org/abs/2602.06895 (Sec. 3.4.1)
- Parameters:
types – The per-event tensors, the first being the weight.
quantile – Quantile of |w| taken as the maximum weight.