gEconpy.model.parameters.compile_param_dict_func#

gEconpy.model.parameters.compile_param_dict_func(param_dict, deterministic_dict, backend='numpy', cache=None, return_symbolic=False)#

Compile a function to compute model parameters from given “free” parameters.

Most model parameters are provided by the user as fixed values. We denote these are “free” parameters. Others are functions of the free parameters, and need to be dynamically recomputed each time the free parameters change.

Parameters:
param_dict: SymbolDictionary

A dictionary of free parameters.

deterministic_dict: SymbolDictionary

A dictionary of deterministic parameters, with the keys being the parameters and the values being the expressions to compute them.

backend: str, one of “numpy”, “pytensor”

The backend to use for the compiled function.

cache: dict, optional

A dictionary mapping from pytensor symbols to sympy expressions. Used to prevent duplicate mappings from sympy symbol to pytensor symbol from being created. Default is a empty dictionary, implying no other functions have been compiled yet.

return_symbolic: bool, default False

When true, if backend is “pytensor”, return a symbolic graph representing the computation of parameter values rather than a compiled pytensor function. Ignored if backend is not “pytensor”

Returns:
f: Callable

A function that takes the free parameters as keyword arguments and returns a dictionary of the computed parameters.

cache: dict

A dictionary mapping from sympy symbols to pytensor symbols.