jax_privacy.experimental.monte_carlo.sample_generation.generate_sample#
- jax_privacy.experimental.monte_carlo.sample_generation.generate_sample(strategy, noise_multiplier, c_col, seed=None, positive_sample=True, num_samples=1, dataset_size=None, mode_scale=None)[source]#
Generates a sample from the dominating pair for amplified DP-BandMF.
TODO: Explore benefits of Jax implementation.
- Parameters:
strategy (
BallsInBinsSampling|BMinSepSampling|CyclicPoissonSampling) – The batch selection strategy to use. Currently,BallsInBinsSampling,CyclicPoissonSampling(usingINDEPENDENTpartition type), andBMinSepSamplingare supported. See Choquette-Choo et al. (2024) and Dong and Ganesh (2026) for technical details.noise_multiplier (
float) – The noise multiplier of DP-MF. This is multiplied by the clip norm, not accounting for the norm ofc_col.c_col (
ndarray) – The non-zero entries in the first column of C. Should be non-negative and 1D.seed (
int|Generator|None) – The rng or seed to use for sampling.positive_sample (
bool) – IfTrue, we sample from the distribution in the dominating pair corresponding to the case where the sensitive example is included. Otherwise, we sample from the other case in the dominating pair, where the sensitive example is not included. Ignored ifmode_scaleis notNone.num_samples (
int) – The number of samples to generate. The default is 1, but it is typically much more efficient to generate multiple samples in a single call to benefit from vectorization.dataset_size (
int|None) – The size of the dataset. Should only be set if accounting for the strategy supports truncation, andstrategy.truncated_batch_sizeis notNone.mode_scale (
float|None) – IfNone, we sample from the dominating pair according topositive_sample. Otherwise, the modes of the positive mixture are multiplied bymode_scalebefore noise is added, which samples from a stretched mixture that is useful as a proposal distribution for importance sampling (0and1recover the dominating pair). Only supported for balls-in-bins sampling.
- Return type:
ndarray|tuple[ndarray,ndarray]- Returns:
Sample(s) from the dominating PLD for DP-BandMF using balls-in-bins sampling. The output is 2D with dimension
(strategy.iterations, num_samples). Potentially also returns a second array containing auxiliary information needed to evaluate the privacy loss.