qiskit_addon_sqd.subsampling.subsample¶
- subsample(bitstring_matrix, probabilities, samples_per_batch, num_batches, rand_seed=None)[source]¶
Subsample batches of bit arrays from an input
bitstring_matrix
.Each individual batch will be sampled without replacement from the input
bitstring_matrix
. Samples will be replaced after creation of each batch, so different batches may contain identical samples.- Parameters:
bitstring_matrix (ndarray) – A 2D array of
bool
representations of bit values such that each row represents a single bitstring.probabilities (ndarray) – A 1D array specifying a probability distribution over the bitstrings
samples_per_batch (int) – The number of samples to draw for each batch
num_batches (int) – The number of batches to generate
rand_seed (int | None) – A seed to control random behavior
- Returns:
A list of bitstring matrices subsampled from the input bitstring matrix.
- Raises:
ValueError – The number of elements in
probabilities
must equal the number of rows inbitstring_matrix
.ValueError – Samples per batch and number of batches must be positive integers.
- Return type: