Skip to content

replace optimisation function argument of find_MAP #396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 5, 2022

Conversation

keesterbrugge
Copy link
Contributor

res = pm.find_MAP(vars=[z], fmin=optimize.fmin_l_bfgs_b) gave me the error

/usr/local/lib/python3.7/dist-packages/fastprogress/fastprogress.py:74: UserWarning: Your generator is empty.
  warn("Your generator is empty.")

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-19-1697d3cf79ec> in <module>()
      1 smoothing = 0.5
----> 2 z_val = infer_z(smoothing)
      3 
      4 plot(x, y)
      5 plot(x, z_val)

1 frames
/usr/local/lib/python3.7/dist-packages/pymc3/tuning/starting.py in find_MAP(start, vars, method, return_raw, include_transformed, progressbar, maxeval, model, *args, **kwargs)
    133 
    134     try:
--> 135         opt_result = minimize(cost_func, x0, method=method, jac=compute_gradient, *args, **kwargs)
    136         mx0 = opt_result["x"]  # r -> opt_result
    137     except (KeyboardInterrupt, StopIteration) as e:

TypeError: minimize() got an unexpected keyword argument 'fmin'

whereas res = pm.find_MAP(vars=[z], method="L-BFGS-B") did work for me

{Insert Description}

Helpful links

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@cluhmann
Copy link
Member

The pre-commit is failing because the notebook (examples/case_studies/spline.ipynb) doesn't match the corresponding jupytext file (myst_nbs/case_studies/spline.myst.md). I think you should be able to install the jupytext extension (https://jupytext.readthedocs.io/en/latest/install.html), restart jupyter, open the notebook, save it, and then commit/push.

@OriolAbril
Copy link
Member

You should also be able to do pre-commit run --file notebook.ipynb (with the right path to your notebook) in order to fix the issue. Ref: https://docs.pymc.io/en/latest/contributing/jupyter_style.html#pre-commit-and-code-formatting

keesterbrugge and others added 2 commits November 5, 2022 21:35
`res = pm.find_MAP(vars=[z], fmin=optimize.fmin_l_bfgs_b)` gave me the error
```python
/usr/local/lib/python3.7/dist-packages/fastprogress/fastprogress.py:74: UserWarning: Your generator is empty.
  warn("Your generator is empty.")

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-19-1697d3cf79ec> in <module>()
      1 smoothing = 0.5
----> 2 z_val = infer_z(smoothing)
      3 
      4 plot(x, y)
      5 plot(x, z_val)

1 frames
/usr/local/lib/python3.7/dist-packages/pymc3/tuning/starting.py in find_MAP(start, vars, method, return_raw, include_transformed, progressbar, maxeval, model, *args, **kwargs)
    133 
    134     try:
--> 135         opt_result = minimize(cost_func, x0, method=method, jac=compute_gradient, *args, **kwargs)
    136         mx0 = opt_result["x"]  # r -> opt_result
    137     except (KeyboardInterrupt, StopIteration) as e:

TypeError: minimize() got an unexpected keyword argument 'fmin'

```
whereas  `res = pm.find_MAP(vars=[z], method="L-BFGS-B")` did work for me
@OriolAbril OriolAbril merged commit 6a5a980 into pymc-devs:main Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants