Parameter randomization
Provides the optional randomization for the parameters of a
FuncBase. Each parameter of the function may be
randomized according to noisy_parameters, that
attaches a distribution to the parameter.
This module provides a ParameterNoiseFactory used to register
random distribution classes and it provides some built in distributions.
Distributions can also be extended using the plugin
interface.
- class ceed.function.param_noise.ParameterNoiseFactory(**kwargs)
 Bases:
kivy._event.EventDispatcherFactory where distributions are registered and accessed by name.
- noise_classes: Dict[str, Type[ceed.function.param_noise.NoiseType]] = {}
 Keeps all classes registered with
register_class().
- register_class(cls: Type[ceed.function.param_noise.NoiseType])
 Registers a
NoiseBasesubclass, with the name of the class innoise_classes.
- get_cls(name: str) Type[ceed.function.param_noise.NoiseType]
 Looks up a noise class by name and returns it.
- make_instance(config: dict) ceed.function.param_noise.NoiseBase
 Takes a noise distribution instance’s config, as returned by
NoiseBase.get_config(), and creates a noise distribution instance of that class and config, and returns it.
- class ceed.function.param_noise.NoiseBase(**kwargs)
 Bases:
kivy._event.EventDispatcherBase class that can be used to randomize a function parameter with
noisy_parameters.Instances have a
sample()method that returns a random value when called. This is used to sample a new value for function parameters.- lock_after_forked: bool
 Functions can reference other function. After the reference functions are expanded and copied before running the stage as an experiment, all randomized parameters whose
lock_after_forkedis False are resampled.This allows the parameters with
lock_after_forkedset to True to share the same random value as the original referenced function’s randomized value.See
ceed.stage.CeedStage.copy_and_resample()for details.
- sample_each_loop
 Whether the parameter should be resampled for each loop iteration (True) or whether we sample once and use that sample for all loop iterations.
The values are pre-sampled before the function is executed. If True, using
sample_seq(), otherwise, it’s sampled once withsample().For example, for the following function structure contained in a Stage:
CeedStage: name: 'stage' loop: 2 GroupFunc: name: 'root' loop: 5 GroupFunc: name: 'child_a' loop: 2 ConstFunc: name: 'child' loop: 3
where the
childfunction’saparameter is randomized and thechildfunction is looped2 * 5 * 2 * 3 = 60times total across the whole experiment.Then, if
sample_each_loopis False, wesample()the parameter once and the same value is used for all 60 loop iterations. Otherwise, we pre-compute 60 samples usingsample_seq()fromresample_parameters()and then update the parameter with each corresponding sample when the function or loop iteration is initialized (init_func()andinit_loop_iteration()).
- sample() float
 Samples the distribution and returns a new value.
- sample_seq(n) List[float]
 Samples the distribution
ntimes and returns a list of values.By default it just calls
sample()ntimes to get the samples.
- property name: str
 The name of the class.
This is the name used with
ParameterNoiseFactory.get_cls.
- get_config() dict
 Returns a dict representation of the instance that can be then be used to reconstruct it with
ParameterNoiseFactory.make_instance().This is also used to display the instance parameters to the user. We infer the type of each parameter from the property value.
- get_prop_pretty_name() Dict[str, str]
 Returns a dict mapping names of the parameters used by the class to a nicer representation shown to the user.