From 54b92163829db8123b4d7dcbeed2c7fbc6d3988f Mon Sep 17 00:00:00 2001 From: Yiyang Wu Date: Sun, 8 Feb 2026 15:10:20 +0800 Subject: [PATCH 1/2] Allow parsing jacobian=False to find_MAP jacobian=False is the behavior of pymc.find_MAP --- pymc_extras/inference/laplace_approx/find_map.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pymc_extras/inference/laplace_approx/find_map.py b/pymc_extras/inference/laplace_approx/find_map.py index 94e58ccaf..36531067e 100644 --- a/pymc_extras/inference/laplace_approx/find_map.py +++ b/pymc_extras/inference/laplace_approx/find_map.py @@ -165,6 +165,7 @@ def find_MAP( use_hess: bool | None = None, initvals: dict | None = None, random_seed: int | np.random.Generator | None = None, + jacobian: bool = True, jitter_rvs: list[TensorVariable] | None = None, progressbar: bool = True, include_transformed: bool = True, @@ -205,6 +206,8 @@ def find_MAP( If None, the model's default initial values are used. random_seed : None | int | np.random.Generator, optional Seed for the random number generator or a numpy Generator for reproducibility + jacobian : bool, optional + Whether to include jacobian terms in logprob graph. Defaults to True. jitter_rvs : list of TensorVariables, optional Variables whose initial values should be jittered. If None, all variables are jittered. progressbar : bool, optional @@ -258,7 +261,7 @@ def find_MAP( ) f_fused, f_hessp = scipy_optimize_funcs_from_loss( - loss=-model.logp(), + loss=-model.logp(jacobian=jacobian), inputs=model.continuous_value_vars + model.discrete_value_vars, initial_point_dict=DictToArrayBijection.rmap(initial_params), use_grad=use_grad, From 5b4574d7a6890d18d0ca27bce83691a68cb44c6b Mon Sep 17 00:00:00 2001 From: littlewu2508 <42602151+littlewu2508@users.noreply.github.com> Date: Tue, 10 Feb 2026 09:12:30 +0800 Subject: [PATCH 2/2] jacobian should not be included when performing MAP Co-authored-by: Jesse Grabowski <48652735+jessegrabowski@users.noreply.github.com> --- pymc_extras/inference/laplace_approx/find_map.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pymc_extras/inference/laplace_approx/find_map.py b/pymc_extras/inference/laplace_approx/find_map.py index 36531067e..5f322bddb 100644 --- a/pymc_extras/inference/laplace_approx/find_map.py +++ b/pymc_extras/inference/laplace_approx/find_map.py @@ -165,7 +165,6 @@ def find_MAP( use_hess: bool | None = None, initvals: dict | None = None, random_seed: int | np.random.Generator | None = None, - jacobian: bool = True, jitter_rvs: list[TensorVariable] | None = None, progressbar: bool = True, include_transformed: bool = True, @@ -206,8 +205,6 @@ def find_MAP( If None, the model's default initial values are used. random_seed : None | int | np.random.Generator, optional Seed for the random number generator or a numpy Generator for reproducibility - jacobian : bool, optional - Whether to include jacobian terms in logprob graph. Defaults to True. jitter_rvs : list of TensorVariables, optional Variables whose initial values should be jittered. If None, all variables are jittered. progressbar : bool, optional @@ -261,7 +258,7 @@ def find_MAP( ) f_fused, f_hessp = scipy_optimize_funcs_from_loss( - loss=-model.logp(jacobian=jacobian), + loss=-model.logp(jacobian=False), inputs=model.continuous_value_vars + model.discrete_value_vars, initial_point_dict=DictToArrayBijection.rmap(initial_params), use_grad=use_grad,