leaspy.samplers.sampler_factory
- sampler_factory(sampler: str | AbstractSampler, variable_type: VariableType, **kwargs) AbstractSampler
Factory for Samplers.
- Parameters:
- sampler
AbstractSamplerorstr If an instance of a subclass of
AbstractSampler, returns the instance (no copy). If a string, returns a new instance of the appropriate class (with optional parameters kwargs).- variable_type
VariableType The type of random variable that the sampler is supposed to sample.
- **kwargs
Optional parameters for initializing the requested Sampler (not used if input is a subclass of
AbstractSampler).
- sampler
- Returns:
AbstractSamplerThe desired sampler.
- Raises:
LeaspyAlgoInputError:If the sampler provided is not supported.