Skip to main content

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.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. It is being co-maintained by Johanna Haffner (@johannahaffner): GitHub; Website.

Metadata

Release files for optimistix 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for optimistix 0.1.0
File Size Uploaded
optimistix-0.1.0.tar.gz 70.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for optimistix 0.1.0
File Interpreter ABI Platform
optimistix-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 171.9 kB

Release files / optimistix-0.1.0.tar.gz

Download URL optimistix-0.1.0.tar.gz
Size 70.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f05c9104748e87e1dc10a0b4a2be94e427f98c3eab0b1d41ea24a593d76be03d
BLAKE2b-256 checksum
How to use checksums
5c0b3bdc0e698cb0d264e5dca0b5bb171342a950a43fa6e046d8c57189298422
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / optimistix-0.1.0-py3-none-any.whl

Download URL optimistix-0.1.0-py3-none-any.whl
Size 101.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8edda7bf7fe48839c93fcd72bce750c950ed9f7033158303150b7ab395add81
BLAKE2b-256 checksum
How to use checksums
63536a81a6ebb1739f19c32002139719d4ee021a349d5bdbe066910feed327a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.11

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page