dcegm.pre_processing.setup_model

Functions

create_model_dict(model_config, model_specs, ...[, ...])

Set up the model for dcegm.

create_model_dict_and_save(model_config, model_specs, ...)

Set up the model and save.

load_model_dict(model_config, model_specs, ...[, ...])

Load the model from file.

process_debug_string(debug_output, ...)

Module Contents

dcegm.pre_processing.setup_model.create_model_dict(model_config: Dict, model_specs: Dict, utility_functions: Dict[str, Callable], utility_functions_final_period: Dict[str, Callable], budget_constraint: Callable, state_space_functions: Dict[str, Callable] = None, stochastic_states_transitions: Dict[str, Callable] = None, shock_functions: Dict[str, Callable] = None, debug_info: str = None, use_stochastic_sparsity=False)

Set up the model for dcegm.

It consists of two steps. First it processes the user supplied functions to make them compatible with the interface the dcegm software expects. Second it creates the states and choice objects used by the dcegm software.

Parameters:
  • options (Dict[str, int]) – Options dictionary.

  • state_space_functions (Dict[str, Callable]) – Dictionary of user supplied

  • of (functions for computation) –

    1. next period endogenous states

    2. next period exogenous states

    3. next period discrete choices

  • utility_functions (Dict[str, Callable]) – Dictionary of three user-supplied functions for computation of: (i) utility (ii) inverse marginal utility (iii) next period marginal utility

  • utility_functions_final_period (Dict[str, Callable]) – Dictionary of two user-supplied functions for computation of: (i) utility (ii) next period marginal utility

  • budget_constraint (Callable) – User supplied budget constraint.

dcegm.pre_processing.setup_model.create_model_dict_and_save(model_config: Dict, model_specs: Dict, utility_functions: Dict[str, Callable], utility_functions_final_period: Dict[str, Callable], budget_constraint: Callable, state_space_functions: Dict[str, Callable] = None, stochastic_states_transitions: Dict[str, Callable] = None, shock_functions: Dict[str, Callable] = None, path: str = 'model.pkl', debug_info=None, use_stochastic_sparsity=False)

Set up the model and save.

Model creation is time-consuming. This function creates the model and saves it to file. This way the model can be loaded from file in the future, which is much faster than recreating the model from scratch.

dcegm.pre_processing.setup_model.load_model_dict(model_config: Dict, model_specs: Dict, utility_functions: Dict[str, Callable], utility_functions_final_period: Dict[str, Callable], budget_constraint: Callable, state_space_functions: Dict[str, Callable] = None, stochastic_states_transitions: Dict[str, Callable] = None, shock_functions: Dict[str, Callable] = None, path: str = 'model.pkl', use_stochastic_sparsity=False)

Load the model from file.

dcegm.pre_processing.setup_model.process_debug_string(debug_output, state_space_functions, model_specs, model_config)