Skip to content

Commit

Permalink
Alignment with scipy (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
janosg authored Jul 19, 2024
1 parent 9435363 commit 5422b09
Show file tree
Hide file tree
Showing 81 changed files with 2,690 additions and 2,033 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ jobs:
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: create build environment
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./.envs/testenv-linux.yml
environment-name: optimagic
Expand Down
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ repos:
- id: trailing-whitespace
exclude: docs/
- id: check-ast
- id: check-docstring-first
exclude: src/optimagic/optimization/algo_options.py
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
Expand Down
35 changes: 34 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,43 @@ the major changes are:
- Rename the package from `estimagic` to `optimagic` (while keeping the `estimagic`
namespace for the estimation capabilities).

### Breaking changes

- {gh}`500` removes the dashboard, the support for simopt optimizers and the
`derivative_plot` ({ghuser}`janosg`)
- {gh}`504` aligns `maximize` and `minimize` more closely with scipy. All related
deprecations and breaking changes are listed below. As a result, scipy code that uses
minimize with the arguments `x0`, `fun`, `jac` and `method` will run without changes
in optimagic. Similarly, to `OptimizeResult` gets some aliases so it behaves more
like SciPy's.

### Breaking changes


### Deprecations

- The `criterion` argument of `maximize` and `minimize` is renamed to `fun` (as in
SciPy).
- The `derivative` argument of `maximize` and `minimize` is renamed to `jac` (as
in SciPy)
- The `criterion_and_derivative` argument of `maximize` and `minimize` is renamed
to `fun_and_jac` to align it with the other names.
- The `criterion_kwargs` argument of `maximize` and `minimize` is renamed to
`fun_kwargs` to align it with the other names.
- The `derivative_kwargs` argument of `maximize` and `minimize` is renamed to
`jac_kwargs` to align it with the other names.
- The `criterion_and_derivative_kwargs` argument of `maximize` and `minimize` is
renamed to `fun_and_jac_kwargs` to align it with the other names.
- Algorithm specific convergence and stopping criteria are renamed to align them more
with NlOpt and SciPy names.
- `convergence_relative_criterion_tolerance` -> `convergence_ftol_rel`
- `convergence_absolute_criterion_tolerance` -> `convergence_ftol_abs`
- `convergence_relative_params_tolerance` -> `convergence_xtol_rel`
- `convergence_absolute_params_tolerance` -> `convergence_xtol_abs`
- `convergence_relative_gradient_tolerance` -> `convergence_gtol_rel`
- `convergence_absolute_gradient_tolerance` -> `convergence_gtol_abs`
- `convergence_scaled_gradient_tolerance` -> `convergence_gtol_scaled`
- `stopping_max_criterion_evaluations` -> `stopping_maxfun`
- `stopping_max_iterations` -> `stopping_maxiter`


## 0.4.7
Expand Down
49 changes: 21 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,21 @@
[![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![image](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)
[![image](https://pepy.tech/badge/estimagic/month)](https://pepy.tech/project/estimagic)
[![image](https://img.shields.io/badge/NumFOCUS-affiliated%20project-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org/sponsored-projects/affiliated-projects)
[![image](https://img.shields.io/twitter/follow/aiidateam.svg?style=social&label=Follow)](https://x.com/optimagic)

## Introduction

optimagic is a Python package for nonlinear optimization with or without constraints. It
is particularly suited to solve difficult nonlinear estimation problems. On top, it
provides functionality to perform statistical inference on estimated parameters.
*optimagic* is a Python package for numerical optimization. It is a unified interface to
optimizers from SciPy, NlOpt and many other Python packages.

### Optimization
*optimagic*'s `minimize` function works just like SciPy's, so you don't have to adjust
your code. You simply get more optimizers for free. On top you get powerful diagnostic
tools, parallel numerical derivatives and more.

- optimagic wraps algorithms from *scipy.optimize*, *nlopt*, *pygmo* and more.
- optimagic implements constraints efficiently via reparametrization, so you can solve
constrained problems with any optimizer that supports bounds.
- The parameters of an optimization problem can be arbitrary pytrees
- The complete history of parameters and function evaluations can be saved in a database
for maximum reproducibility.
- Painless and efficient multistart optimization.
- The progress of the optimization can be displayed in `criterion_plot` and
`params_plot` while the optimization is still running.

### Estimation and Inference

- You can estimate a model using method of simulated moments (MSM), calculate standard
errors and do sensitivity analysis with just one function call.
- Asymptotic standard errors for maximum likelihood estimation.
- estimagic also provides bootstrap confidence intervals and standard errors. Of course
the bootstrap procedures are parallelized.

### Numerical differentiation

- optimagic can calculate precise numerical derivatives using
[Richardson extrapolations](https://en.wikipedia.org/wiki/Richardson_extrapolation).
- Function evaluations needed for numerical derivatives can be done in parallel with
pre-implemented or user provided batch evaluators.
*optimagic* was formerly called *estimagic*, because it also provides functionality to
perform statistical inference on estimated parameters. *estimagic* is now a subpackage
of *optimagic*.

## Installation

Expand Down Expand Up @@ -101,3 +83,14 @@ If you use optimagic for your research, please do not forget to cite it.
Url = {https://github.com/OpenSourceEconomics/optimagic}
}
```

## Acknowledgements

We thank all institutions that have funded or supported optimagic (formerly estimagic)

<img src="docs/source/_static/images/aai-institute-logo.svg" width="185">
<img src="docs/source/_static/images/numfocus_logo.png" width="200">
<img src="docs/source/_static/images/tra_logo.png" width="240">

<img src="docs/source/_static/images/hoover_logo.png" width="192">
<img src="docs/source/_static/images/transferlab-logo.svg" width="400">
Loading

0 comments on commit 5422b09

Please sign in to comment.