Infrared
Loading...
Searching...
No Matches
infrared.infrared.MultiDimensionalBoltzmannSampler Class Reference

Multi-dimensional Boltzmann sampler. More...

Inheritance diagram for infrared.infrared.MultiDimensionalBoltzmannSampler:
Collaboration diagram for infrared.infrared.MultiDimensionalBoltzmannSampler:

Public Member Functions

 __init__ (self, model, td_factory=TreeDecompositionFactory(), lazy=True)
 Construct with model and optional td_factory.
 
 is_good_sample (self, features, values)
 whether the sample is of good quality
 
 set_target (self, target, tolerance, featureid)
 Set target of a feature.
 
 targeted_samples (self)
 Generator of targeted samples.
 
 targeted_sample (self)
 
- Public Member Functions inherited from infrared.infrared.BoltzmannSampler
 __init__ (self, model, td_factory=TreeDecompositionFactory(), lazy=True)
 Construct.
 
 sample (self)
 Generate sample.
 
 resample (self, variables, assignment)
 Generate sample.
 
 samples (self)
 Sample generator.
 
 gen_cluster_tree (self)
 Suitable cluster tree.
 
- Public Member Functions inherited from infrared.infrared.EngineBase
 __init__ (self, model, td_factory=TreeDecompositionFactory(), lazy=True)
 Construct with model and optional td_factory.
 
 requires_reinitialization (self)
 
 setup_engine (self, *skip_ct=False)
 Sets up the constraint model / cluster tree sampling engine.
 
 evaluate (self)
 Evaluates the cluster tree.
 
 is_consistent (self)
 
 plot_td (self, filename, to="pdf")
 Plot the tree decomposition to pdf file filename write to filename to target format, support conversion to "pdf" or "png".
 
 treewidth (self)
 Get tree width.
 
 gen_cluster_tree (self)
 Generate the populated cluster tree td tree decomposition Returns cluster tree.
 

Static Public Member Functions

 rmsd (means, features)
 

Public Attributes

 samples_per_round
 
 tweak_factor
 
 cooling
 
 verbose
 
 callback
 

Protected Attributes

 _targeted_samples
 
- Protected Attributes inherited from infrared.infrared.BoltzmannSampler
 _model
 
- Protected Attributes inherited from infrared.infrared.EngineBase
 _model
 
 _td_factory
 
 _td
 
 _ct
 

Additional Inherited Members

- Properties inherited from infrared.infrared.EngineBase
 model = property
 
 td = property
 
 ct = property
 

Detailed Description

Multi-dimensional Boltzmann sampler.

Constructor & Destructor Documentation

◆ __init__()

infrared.infrared.MultiDimensionalBoltzmannSampler.__init__ (   self,
  model,
  td_factory = TreeDecompositionFactory(),
  lazy = True 
)

Construct with model and optional td_factory.

Parameters
model[const] Constraint network Model
td_factoryFactory for tree decomposition
lazydelay construction of the data structures until required. Defaults to True
       BoltzmannSampler.__init__()

Reimplemented from infrared.infrared.BoltzmannSampler.

Member Function Documentation

◆ is_good_sample()

infrared.infrared.MultiDimensionalBoltzmannSampler.is_good_sample (   self,
  features,
  values 
)

whether the sample is of good quality

   checks whether the sample approximately meets the targets;
   check only the targeted features (which have value, target and tolerance)
Parameters
featuresdictionary of features

◆ rmsd()

infrared.infrared.MultiDimensionalBoltzmannSampler.rmsd (   means,
  features 
)
static

◆ set_target()

infrared.infrared.MultiDimensionalBoltzmannSampler.set_target (   self,
  target,
  tolerance,
  featureid 
)

Set target of a feature.

Parameters
targetthe target value
tolerancethe tolerance (as absolute difference) to the target
fetureidid of the feature

◆ targeted_sample()

infrared.infrared.MultiDimensionalBoltzmannSampler.targeted_sample (   self)

◆ targeted_samples()

infrared.infrared.MultiDimensionalBoltzmannSampler.targeted_samples (   self)

Generator of targeted samples.

   Performs multi-dimensional Boltzmann sampling: every
   self.samples_per_round many samples, the feature means are
   estimated and the weights are recalibrated. Each generated
   sample is tested for falling into target +/- tolerance for all
   features, in which case it is yielded.

   self.tweak_factor controls the scale of weight recalibration in each round.

   self.cooling is a multiplier for the tweak factor to reduce it when
   the rmsd of means to target increases (with the purpose to stabilize
   the optimization)

   self.callback callback function, called after each round with
   round statistics (FeatureStatistics)

Member Data Documentation

◆ _targeted_samples

infrared.infrared.MultiDimensionalBoltzmannSampler._targeted_samples
protected

◆ callback

infrared.infrared.MultiDimensionalBoltzmannSampler.callback

◆ cooling

infrared.infrared.MultiDimensionalBoltzmannSampler.cooling

◆ samples_per_round

infrared.infrared.MultiDimensionalBoltzmannSampler.samples_per_round

◆ tweak_factor

infrared.infrared.MultiDimensionalBoltzmannSampler.tweak_factor

◆ verbose

infrared.infrared.MultiDimensionalBoltzmannSampler.verbose

The documentation for this class was generated from the following file: