data generators
lan_mlp
This module defines a data generator class for use with LANs. The class defined below can be used to generate training data compatible with the expectations of LANs.
data_generator
The data_generator() class is used to generate training data for various likelihood approximators.
Attributes
!!! generator_config "dict"
Configuation dictionary for the data generator.
(For an example load ssms.config.data_generator_config['lan'])
!!! model_config "dict"
Configuration dictionary for the model to be simulated.
(For an example load ssms.config.model_config['ddm'])
Methods
generate_data_training_uniform(save=False, verbose=True, cpn_only=False)
Generates training data for LANs.
get_simulations(theta=None, random_seed=None)
Generates simulations for a given parameter set.
_filter_simulations(simulations=None)
Filters simulations according to the criteria
specified in the generator_config.
_make_kde_data(simulations=None, theta=None)
Generates KDE data from simulations.
_mlp_get_processed_data_for_theta(random_seed_tuple)
Helper function for generating training data for MLPs.
_cpn_get_processed_data_for_theta(random_seed_tuple)
Helper function for generating training data for CPNs.
_get_rejected_parameter_setups(random_seed_tuple)
Helper function that collectes parameters sets which were rejected
by the filter used in the _filter_simulations() method.
_make_save_file_name(unique_tag=None)
Helper function for generating save file names.
_build_simulator()
Builds simulator function for LANs.
_get_ncpus()
Helper function for determining the number of
cpus to use for parallelization.
Returns
data_generator object
__init__(self, generator_config=None, model_config=None)
special
Initialize data generator class.
Arguments
dict
Configuration dictionary for the data generator. (For an example load ssms.config.data_generator_config['lan'])
dict
Configuration dictionary for the model to be simulated. (For an example load ssms.config.model_config['ddm'])
Raises
ValueError If no generator_config or model_config is specified.
Returns
data_generator object
generate_data_training_uniform(self, save=False, verbose=True, cpn_only=False)
Generates training data for LANs.
Arguments
!!! save "bool"
If True, the generated data is saved to disk.
!!! verbose "bool"
If True, progress is printed to the console.
!!! cpn_only "bool"
If True, only choice probabilities are computed.
This is useful for training CPNs.
Returns
!!! data "dict"
Dictionary containing the generated data.
generate_rejected_parameterizations(self, save=False)
Generates parameterizations that are rejected by the filter.
Arguments
!!! save "bool"
If True, the generated data is saved to disk.
Returns
!!! rejected_parameterization_list "np.array"
Array containing the rejected parameterizations.
get_simulations(self, theta=None, random_seed=None)
Generates simulations for a given parameter set.
parameter_transform_for_data_gen(self, theta)
Function to impose constraints on the parameters for data generation.
Arguments
!!! theta "dict"
Dictionary containing the parameters.
Returns
!!! theta "dict"
Dictionary containing the transformed parameters.
snpe
data_generator_snpe (data_generator)
Class for generating data for SNPE.
Attributes
dict
Configuration for data generation
dict
Configuration for model
Methods
generate_data_training_uniform(save=False) Generates data for training SNPE. _snpe_get_processed_data_for_theta(random_seed) Helper function for generating data for SNPE. _build_simulator() Builds simulator function for SNPE.
generate_data_training_uniform(self, save=False)
Generates training data for LANs.
Arguments
!!! save "bool"
If True, the generated data is saved to disk.
!!! verbose "bool"
If True, progress is printed to the console.
!!! cpn_only "bool"
If True, only choice probabilities are computed.
This is useful for training CPNs.
Returns
!!! data "dict"
Dictionary containing the generated data.