gEconpy.model.parameters.compile_param_dict_func#

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

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.

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, return a symbolic graph representing the computation of parameter values rather than a compiled pytensor function.

modestr or None, optional

Pytensor compilation mode (e.g. 'JAX', 'FAST_COMPILE'). Forwarded to the underlying compiler. Default is None.

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.