Skip to main content

Function minimization by brute force grid search in JAX

Project description

Brutax

Continuous Integration

When all else fails, why not a brute-force search! Brutax is a JAX library for function optimization by brute-force grid search. Features include:

  • Highly-parallel function evaluations
  • PyTree-valued grids
  • Customizable search behavior downstream
  • Smooth integration with JAX function transformations: JIT, autodiff, vectorization, and scaling across GPU/TPUs

Installation

pip install brutax

Quick example

import brutax
import jax.numpy as jnp

def fn(tree_grid_point, _):
    x, y = tree_grid_point
    return (x - 1.)**2 + (y - 2.)**2

# The `tree_grid` is the cartesian product of x and y grids
x_grid, y_grid = (jnp.arange(-5., 5., 1), jnp.arange(-5., 5., 0.1))
tree_grid = (x_grid, y_grid)
# Run grid search over (10 x 100) grid
sol = brutax.run_grid_search(
    fn, method=brutax.MinimumSearchMethod(), tree_grid=tree_grid, args=None
)
x_min, y_min = sol.value
assert jnp.isclose(x_min, 1.) and jnp.isclose(y_min, 2.)

Acknowledgements

  • The design of brutax is heavily inspired from the JAX non-linear optimization library optimistix.

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

brutax-0.0.2.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

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

brutax-0.0.2-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file brutax-0.0.2.tar.gz.

File metadata

  • Download URL: brutax-0.0.2.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for brutax-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c7c2f360210ddc2373fb50fc26b2f9e3f2439eb2171c0185b52fd4f1336ef620
MD5 6e082fe2e7a4dad2631a5fa52b9fb1d0
BLAKE2b-256 0496c60b54466353ae924d90c1e1186e5ba127614030670ad09265a469a1cd29

See more details on using hashes here.

Provenance

The following attestation bundles were made for brutax-0.0.2.tar.gz:

Publisher: publish.yml on michael-0brien/brutax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brutax-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: brutax-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for brutax-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cb481086d11cc090e8b72e77bec3f6e0c8066723f6eaa0ef9e2d57316239c49f
MD5 7f3e9da1a601c8ba2a1e601bda9f3f44
BLAKE2b-256 75bd7f43ad75c9be194dfd55604faa8dcb6f7a85e57d93dc55828876ab070944

See more details on using hashes here.

Provenance

The following attestation bundles were made for brutax-0.0.2-py3-none-any.whl:

Publisher: publish.yml on michael-0brien/brutax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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