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.2rc1.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.2rc1-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: brutax-0.0.2rc1.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.2rc1.tar.gz
Algorithm Hash digest
SHA256 2f1375b6d50446b51812f5ea0f1bdf2d87406c9eafffb351e93579a74bf0e7db
MD5 e1e39fffaab286e96373424614a2a071
BLAKE2b-256 b5e2a7b300d41b143429567a799c85e98f0ecbf4d8c9acadca3ccdaa70783cfc

See more details on using hashes here.

Provenance

The following attestation bundles were made for brutax-0.0.2rc1.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.2rc1-py3-none-any.whl.

File metadata

  • Download URL: brutax-0.0.2rc1-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.2rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef77aa439cce4adb6121a49b950ac80d5cbc769f647fc572d3ac5bbff59d7f54
MD5 80b5c4db4f144565c15431b33d7307d3
BLAKE2b-256 b4a02f136dd267f601766321f2ee201cb41e5be459b4438a57f901fedf0cd69b

See more details on using hashes here.

Provenance

The following attestation bundles were made for brutax-0.0.2rc1-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