Skip to main content

Nonlinear optimisation in JAX and Equinox.

Project description

Optimistix

Optimistix is a JAX library for nonlinear solvers: root finding, minimisation, fixed points, and least squares.

Features include:

  • interoperable solvers: e.g. autoconvert root find problems to least squares problems, then solve using a minimisation algorithm.
  • modular optimisers: e.g. use a BFGS quadratic bowl with a dogleg descent path with a trust region update.
  • using a PyTree as the state.
  • fast compilation and runtimes.
  • interoperability with Optax.
  • all the benefits of working with JAX: autodiff, autoparallelism, GPU/TPU support etc.

Installation

pip install optimistix

Requires Python 3.9+ and JAX 0.4.14+ and Equinox 0.11.0+.

Documentation

Available at https://docs.kidger.site/optimistix.

Quick example

import jax.numpy as jnp
import optimistix as optx

# Let's solve the ODE dy/dt=tanh(y(t)) with the implicit Euler method.
# We need to find y1 s.t. y1 = y0 + tanh(y1)dt.

y0 = jnp.array(1.)
dt = jnp.array(0.1)

def fn(y, args):
    return y0 + jnp.tanh(y) * dt

solver = optx.Newton(rtol=1e-5, atol=1e-5)
sol = optx.fixed_point(fn, solver, y0)
y1 = sol.value  # satisfies y1 == fn(y1)

Citation

If you found this library to be useful in academic work, then please cite: (arXiv link)

@article{optimistix2024,
    title={Optimistix: modular optimisation in JAX and Equinox},
    author={Jason Rader and Terry Lyons and Patrick Kidger},
    journal={arXiv:2402.09983},
    year={2024},
}

See also: other libraries in the JAX ecosystem

Always useful
Equinox: neural networks and everything not already in core JAX!
jaxtyping: type annotations for shape/dtype of arrays.

Deep learning
Optax: first-order gradient (SGD, Adam, ...) optimisers.
Orbax: checkpointing (async/multi-host/multi-device).
Levanter: scalable+reliable training of foundation models (e.g. LLMs).

Scientific computing
Diffrax: numerical differential equation solvers.
Lineax: linear solvers.
BlackJAX: probabilistic+Bayesian sampling.
sympy2jax: SymPy<->JAX conversion; train symbolic expressions via gradient descent.
PySR: symbolic regression. (Non-JAX honourable mention!)

Awesome JAX
Awesome JAX: a longer list of other JAX projects.

Credit

Optimistix was primarily built by Jason Rader (@packquickly): Twitter; GitHub; Website.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

optimistix-0.0.8.tar.gz (54.5 kB view details)

Uploaded Source

Built Distribution

optimistix-0.0.8-py3-none-any.whl (83.5 kB view details)

Uploaded Python 3

File details

Details for the file optimistix-0.0.8.tar.gz.

File metadata

  • Download URL: optimistix-0.0.8.tar.gz
  • Upload date:
  • Size: 54.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for optimistix-0.0.8.tar.gz
Algorithm Hash digest
SHA256 dc544f91e37f8bc6d85e3a50005ded17ce8e7a093306e6caf8add2938ed88397
MD5 18a7bc80c6026e3384e6b6d1909e5bda
BLAKE2b-256 3b52a936727f501e97d72da5eefa304df217f60986e47e65dbe945b915206b61

See more details on using hashes here.

File details

Details for the file optimistix-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: optimistix-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 83.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for optimistix-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4efa3e01a1d7047a5b2a14f75e4fb4cbef9281507c667da00b4969153d56ce33
MD5 f0721a971ed00af44552612e8af3dca4
BLAKE2b-256 f584a0e1cf42f6e0c643bf3c01d3e14d260a77c74859b28a25815c2788712dc3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page