openmmslicer.resampling_metrics module

This module contains different resampling metrics, which can be used to assess the quality of distribution overlap between different steps of the SMC procedure.

class openmmslicer.resampling_metrics.EffectiveSampleSize

Bases: object

Calculates the effective sample size of one divided by the second moment of the normalised weights. Goes from 1 to n_weights.

classmethod defaultTol(n_weights)

float: The default tolerance of the metric, dependent on the number of weights. Default is 0.1 / n_weights

classmethod defaultValue(n_weights)

float: The default value of the metric, dependent on the number of weights. Default is n_weights / 5

classmethod evaluate(weights)

Evaluates the metric.

Parameters

weights (list or numpy.ndarray) – The input weights.

Returns

metric – The weight-dependent metric.

Return type

float

class openmmslicer.resampling_metrics.ExpWeightEntropy

Bases: openmmslicer.resampling_metrics.EffectiveSampleSize

Calculates the exponential of the entropy of the normalised weights. Goes from 1 to n_weights.

classmethod evaluate(weights)

Evaluates the metric.

Parameters

weights (list or numpy.ndarray) – The input weights.

Returns

metric – The weight-dependent metric.

Return type

float

class openmmslicer.resampling_metrics.ExpectedSampleSize

Bases: openmmslicer.resampling_metrics.EffectiveSampleSize

Calculates the expected sample size based on weight probabilities. Goes from 1 to n_weights.

classmethod evaluate(weights)

Evaluates the metric.

Parameters

weights (list or numpy.ndarray) – The input weights.

Returns

metric – The weight-dependent metric.

Return type

float

class openmmslicer.resampling_metrics.WorstCaseSampleSize

Bases: openmmslicer.resampling_metrics.EffectiveSampleSize

This metric denotes the inverse of the maximum weight. Goes from 1 to n_weights.

classmethod evaluate(weights)

Evaluates the metric.

Parameters

weights (list or numpy.ndarray) – The input weights.

Returns

metric – The weight-dependent metric.

Return type

float

class openmmslicer.resampling_metrics.WorstCaseSystematicSampleSize

Bases: openmmslicer.resampling_metrics.EffectiveSampleSize

If systematic resampling is used, this metric calculates the samples which are certain to be resampled and returns the number of unique certainly resampled samples. Goes from 1 to n_weights.

classmethod evaluate(weights)

Evaluates the metric.

Parameters

weights (list or numpy.ndarray) – The input weights.

Returns

metric – The weight-dependent metric.

Return type

float