leaspy.samplers.factory

Attributes

Functions

sampler_factory(sampler, variable_type, **kwargs)

Factory for Samplers.

Module Contents

SamplerFactoryInput
INDIVIDUAL_SAMPLERS
POPULATION_SAMPLERS
sampler_factory(sampler, variable_type, **kwargs)[source]

Factory for Samplers.

Parameters:
samplerAbstractSampler or str

If an instance of a subclass of AbstractSampler, returns the instance. If a string, returns a new instance of the appropriate class (with optional parameters kwargs).

variable_typeVariableType

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).

Returns:
AbstractSampler

The desired sampler.

Raises:
LeaspyAlgoInputError:

If the sampler provided is not supported.

Parameters:

sampler (SamplerFactoryInput)

Return type:

AbstractSampler