pymc.find_MAP#

pymc.find_MAP(start=None, vars=None, method='L-BFGS-B', return_raw=False, include_transformed=True, progressbar=True, progressbar_theme=<rich.theme.Theme object>, maxeval=5000, model=None, *args, seed=None, **kwargs)[source]#

Finds the local maximum a posteriori point given a model.

find_MAP should not be used to initialize the NUTS sampler. Simply call pymc.sample() and it will automatically initialize NUTS in a better way.

Parameters:
start: `dict` of parameter values (Defaults to `model.initial_point`)

These values will be fixed and used for any free RandomVariables that are not being optimized.

vars: list of TensorVariable

List of free RandomVariables to optimize the posterior with respect to. Defaults to all continuous RVs in a model. The respective value variables may also be passed instead.

method: string or callable, optional

Optimization algorithm. Defaults to ‘L-BFGS-B’ unless discrete variables are specified in vars, then Powell which will perform better. For instructions on use of a callable, refer to SciPy’s documentation of optimize.minimize.

return_raw: bool, optional defaults to False

Whether to return the full output of scipy.optimize.minimize

include_transformed: bool, optional defaults to True

Flag for reporting automatically unconstrained transformed values in addition to the constrained values

progressbar: bool, optional defaults to True

Whether to display a progress bar in the command line.

progressbar_theme: Theme, optional

Custom theme for the progress bar.

maxeval: int, optional, defaults to 5000

The maximum number of times the posterior distribution is evaluated.

model: Model (optional if in `with` context)
*args, **kwargs

Extra args passed to scipy.optimize.minimize

Notes

Older code examples used find_MAP to initialize the NUTS sampler, but this is not an effective way of choosing starting values for sampling. As a result, we have greatly enhanced the initialization of NUTS and wrapped it inside pymc.sample() and you should thus avoid this method.