leaspy.algo.utils.algo_with_samplers module

class AlgoWithSamplersMixin(settings)

Bases: object

Mixin to use in algorithms needing samplers; inherit from this class first.

Note that this mixin is to be used with a class inheriting from AbstractAlgo (and in particular that have a 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 directly (deprecated but has priority over following setting, not defined by default) * 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.