leaspy.algo.algo_with_samplers

Classes

AlgorithmWithSamplersMixin

Mixin class to use in algorithms that require samplers.

Module Contents

class AlgorithmWithSamplersMixin(settings)

Mixin class to use in algorithms that require samplers.

Note that this mixin should be used with a class inheriting from AbstractAlgo, which must have algo_parameters attribute.

Parameters:
settingsAlgorithmSettings

The specifications of the algorithm as a AlgorithmSettings instance.

Please note that you can customize the number of memory-less (burn-in) iterations by setting either:
  • n_burn_in_iter_frac, such that duration of burn-in phase is a ratio of algorithm n_iter (default of 90%)

Attributes:
samplersdict [str, AbstractSampler ]

Dictionary of samplers per each variable

current_iterationint, default 0

Current iteration of the algorithm. The first iteration will be 1 and the last one n_iter.

random_order_variablesbool (default True)

This attribute controls whether we randomize the order of variables at each iteration. Article https://proceedings.neurips.cc/paper/2016/hash/e4da3b7fbbce2345d7772b0674a318d5-Abstract.html gives a rationale on why we should activate this flag.

Parameters:

settings (AlgorithmSettings)

samplers: dict[str, AbstractSampler] = None
random_order_variables: bool
current_iteration: int = 0