medeq.sampler#
- medeq.sampler(f)[source]#
Decorator making a user-defined function a MED sampler.
A MED sampler is simply an object defining the method
.sample(n, med), wheremedis a complete MED instance (for e.g. using historical sampling information) andnis the number of samples between [0, 1) to return.This decorator simply attaches a method
.sampleto the given function that forwards the function call to the function itself.Examples
import medeq import numpy as np @medeq.sampler def user_sampler(n, med = None): num_parameters = len(med.parameters) return np.random.random((n, num_parameters))