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.10+ and JAX 0.4.38+ and Equinox 0.11.11+.

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).
paramax: parameterizations and constraints for PyTrees.

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.11.tar.gz (66.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

optimistix-0.0.11-py3-none-any.whl (97.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: optimistix-0.0.11.tar.gz
  • Upload date:
  • Size: 66.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for optimistix-0.0.11.tar.gz
Algorithm Hash digest
SHA256 cfce0de98e7e9fdbcc2ce6d49a9f82cd3166fd0eee29c0c7a1983f8aefd37757
MD5 d3f513e322f399e1ecf146d7bc35f3a4
BLAKE2b-256 35100d2318a80016a42e2dbcae0be1bea3f51fce0ff5bd919afe532e1e03f0ed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: optimistix-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 97.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for optimistix-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 acb4fb23b598db03e376900fcb61aee8dd511de41411e849661c0ffe9e4cd1c6
MD5 78dd6905f4fc3860e0f2e34d653c0a8d
BLAKE2b-256 ac08085ca409275952524e907156d9091a76b97d2c81a1099b2cb48a08c5ca3c

See more details on using hashes here.

Supported by

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