ComponentStepsizeAdaptation¶

- class gmmvi.optimization.gmmvi_modules.component_stepsize_adaptation.ComponentStepsizeAdaptation(gmm_wrapper: GmmWrapper, initial_stepsize: float)[source]¶
This class provides a common interface for adapting the individual stepsizes for the component updates.
There are currently three options for component stepsize adpatation:
The
FixedComponentStepsizeAdaptation
is a dummy-class, that does not do anything.The
DecayingComponentStepsizeAdaptation
uses exponential decay.The
ImprovementBasedComponentStepsizeAdaptation
uses the procedure of VIPS [AZN20] to increase the stepsize if a component improved during the last updates, and to decrease it otherwise.
- Parameters:
gmm_wrapper –
GmmWrapper
The wrapped model where we want to adapt the number of components.initial_stepsize – float The stepsize used when the component receives its first update
- static build_from_config(config, gmm_wrapper)[source]¶
This static method provides a convenient way to create a
FixedComponentStepsizeAdaptation
,DecayingComponentStepsizeAdaptation
orImprovementBasedComponentStepsizeAdaptation
depending on the provided config.- Parameters:
config – dict The dictionary is typically read from YAML a file, and holds all hyperparameters.
gmm_wrapper –
GmmWrapper
The wrapped model.
- update_stepsize(current_stepsizes: Tensor) Tensor [source]¶
Update the stepsizes, according to the chosen procedure.
- Parameters:
current_stepsizes – tf.Tensor A tensor that contains the stepsize of each component
- Returns:
a tensor of same size as current_stepsizes that contains the updates stepsizes.
- Return type:
tf.Tensor
DecayingComponentStepsizeAdaptation¶
- class gmmvi.optimization.gmmvi_modules.component_stepsize_adaptation.DecayingComponentStepsizeAdaptation(gmm_wrapper: GmmWrapper, annealing_exponent: float, initial_stepsize: float)[source]¶
This class implements an exponentially decaying stepsize schedule. See [KNT+18].
- Parameters:
gmm_wrapper –
GmmWrapper
The wrapped model.annealing_exponent – float controls how fast the stepsize decays
initial_stepsize – float The stepsize used for all component updates
- update_stepsize(current_stepsizes: Tensor) Tensor [source]¶
Updates the stepsize using exponential decay. More specifially, the new stepsize is given by
.
- Parameters:
current_stepsizes – tf.Tensor A tensor that contains the stepsize of each component
- Returns:
a tensor of same size as current_stepsizes that contains the updates stepsizes.
- Return type:
tf.Tensor
FixedComponentStepsizeAdaptation¶
- class gmmvi.optimization.gmmvi_modules.component_stepsize_adaptation.FixedComponentStepsizeAdaptation(gmm_wrapper: GmmWrapper, initial_stepsize: float)[source]¶
This class is a dummy class, that can be used when we want to keep the stepsizes constant.
- Parameters:
gmm_wrapper –
GmmWrapper
The wrapped model where we want to adapt the number of components.initial_stepsize – float The stepsize used for all component updates
ImprovementBasedComponentStepsizeAdaptation¶
- class gmmvi.optimization.gmmvi_modules.component_stepsize_adaptation.ImprovementBasedComponentStepsizeAdaptation(gmm_wrapper: GmmWrapper, initial_stepsize: float, min_stepsize: float, max_stepsize: float, stepsize_inc_factor: float, stepsize_dec_factor: float)[source]¶
Increases the stepsize if the last component update increased its reward, decreases it otherwise. See [AZN20].
- Parameters:
gmm_wrapper –
GmmWrapper
The wrapped model where we want to adapt the number of components.initial_stepsize – float The stepsize used for all component updates
min_stepsize – float Do not not decrease the stepsize below this point
max_stepsize – float Do not increase the stepsize above this point
stepsize_inc_factor – float Factor (>1) for increasing the stepsize
stepsize_dec_factor – float Factor in the range [0, 1] for decreasing the stepsize
- update_stepsize(current_stepsizes: Tensor) Tensor [source]¶
Updates the stepsize of each component based on previous reward improvements [AZN20].
- Parameters:
current_stepsizes – tf.Tensor A tensor that contains the stepsize of each component
- Returns:
a tensor of same size as current_stepsizes that contains the updates stepsizes.
- Return type:
tf.Tensor