The InformationGainEstimator class#
Aliases#
halerium.InformationGainEstimator
halerium.core.InformationGainEstimator
halerium.core.objectives.InformationGainEstimator
- class InformationGainEstimator(graph, designs, observables, targets=None, compiler=None, solve=False, n_source_samples=1, max_n_target_samples=1000, name='InformationGainEstimator', description=None, copy_graph=True)#
The information gain estimator class.
This class calculates the expected information gain (EIG) for a given design for an experiment.
The expected information gain for a given design is computed as the expected change in the entropy (or a related quantity) between the prior and posterior probability density of the targets.
The employed algorithm assumes that the design variables (i.e. the variables whose values are to be controlled in the experiment) and the targets (i.e. the model parameters whose values are to be constrained by the experiment) are independent, and that the observables (i.e. the variables whose values are to be observed in the experiment) depend on both the design variables and the targets.
- Parameters:
graph (halerium.core.Graph) – The graph representing the system of design variables, observables and targets.
designs (list, tuple) – The list of experimental designs for which to estimate the information gain. Each design is given as a dictionary of variables and their suggested values for the experiment. The design variables must be dynamic. Static variables will raise an exception.
observables – The list of observables, i.e. the variables whose values will be The observables must be dynamic. Static variables will raise an exception.
targets – The list of target variables that are to be estimated from the experiment’s results. The targets must be static. Dynamic variables will raise an exception.
compiler (halerium.core.compiler.compiler_base.CompilerBase, optional) – The compiler compiling the model. The default is a TFCompiler.
solve (bool, optional) – Whether to solve the model for a given design to estimate the information gain. Solving makes the estimation slower, but potentially more accurate for models that are non-linear in the target variables. The default is False.
n_source_samples (int, optional) – The amount of source samples that are generated to the estimate information gain. The default is 1.
max_n_target_samples (int, optional) – The maximum amount of target samples that are generated to estimate the information gain. The number of target samples is the minimum of this and the target size. The default is 1000.
name (str, optional) – The name of the objective.
description (str, optional) – The description of the objective.
copy_graph (bool, optional) – Whether the objective should make a copy of the graph for its own use, or just keep the graph itself as attribute. Users should leave this set to the default True, unless they are certain that the graph won’t be altered by the user or other code.
- __call__(fetches=None)#
Compute expected information gain (EIG).
- Parameters:
fetches (optional) – Currently ignored.
- Returns:
The expected information gain for the element. Note that for elements that are not targets, None will be returned.
- Return type:
expected_information_gain
- dump_dict(value_postprocessor=None)#
Dump a dict with information on the objective.
The dict returned contains the name, description and the values resulting from a call of the objective. Additional keys included are used by the GUI for appropriately displaying the results of the objective.
- Parameters:
value_postprocessor (optional) – A function to apply to the values returned by the call of the objective. The default is None, in which case no post-processing is done.
- Returns:
result – A dictionary containing the name, description, etc. of the objective.
- Return type:
dict