bootstrap

openff.evaluator.utils.observables.bootstrap(bootstrap_function: Callable, iterations: int = 200, relative_sample_size: float = 1.0, sub_counts: Optional[Iterable[int]] = None, **observables: ObservableArray) Observable[source]

Bootstrapping a set of observables to compute the average value of the observables as well as the the standard error in the average.

Parameters
  • bootstrap_function – The function to evaluate at each bootstrap iteration.

  • iterations – The number of bootstrap iterations to perform.

  • relative_sample_size – The percentage sample size to bootstrap over, relative to the size of the full data set.

  • sub_counts

    If the data being bootstrapped contains arrays of concatenated sub data (such as when reweighting), this variable can be used to specify the number of items which belong to each subset. Data is then sampled with replacement so that the bootstrap sample contains the correct proportion of data from each subset.

    If the data to bootstrap is of the form [x0, x1, x2, y0, y1] for example, then data_sub_counts=[3, 2] and a possible sample may look like [x0, x0, x2, y0, y0], but never [x0, x1, y0, y1, y1].

    The sub-counts must sum up to the total length of the data provided to observables.

  • observables – The observables which will be passed to the bootstrap function. All observables must have the same length.

Return type

The average of the data and the uncertainty in the average.