openmmslicer.resampling_methods module¶
This module contains different resampling algorithms, such as the basic
MultinomialResampler
and the more sophisticated
SystematicResampler
.
- class openmmslicer.resampling_methods.MultinomialResampler¶
Bases:
object
A basic multinomial resampler which resamples each sample independently of the others with replacement.
- static resample(samples, weights=None, n_walkers=None, n_samples=1)¶
Resamples samples multinomially based on given weights.
- Parameters
samples (list) – The input samples.
weights (list) – The weights associated with the samples. Default is equal weights.
n_walkers (int) – The number of resampled samples per batch. Default is the length of the samples.
n_samples (int) – The number of resample batches. Default is one.
- Returns
resamples – A list of lists, containing the resampled samples.
- Return type
[list]
- class openmmslicer.resampling_methods.SystematicResampler¶
Bases:
object
The most conservative resampler, which preserves as many samples as possible. Based on the method in: http://dx.doi.org/10.3150/12-BEJSP07. An additional review can be found in: http://people.isy.liu.se/rt/schon/Publications/HolSG2006.pdf.
- static resample(samples, weights=None, n_walkers=None, n_samples=1)¶
Resamples samples systematically based on given weights.
- Parameters
samples (list) – The input samples.
weights (list) – The weights associated with the samples. Default is equal weights.
n_walkers (int) – The number of resampled samples per batch. Default is the length of the samples.
n_samples (int) – The number of resample batches. Default is one.
- Returns
resamples – A list of lists, containing the resampled samples.
- Return type
[list]