Recent Releases of genjax

genjax - v0.10.3

What's Changed

  • Kill the manual CHANGELOG (we already have an automated one). by @femtomc in https://github.com/ChiSym/genjax/pull/1564
  • [Cold Harbor, 1 / N] Organize the lowest levels of the GenJAX compiler. by @femtomc in https://github.com/ChiSym/genjax/pull/1566
  • New logo, docs assets clean up. by @femtomc in https://github.com/ChiSym/genjax/pull/1568
  • Update README.md to taste. by @femtomc in https://github.com/ChiSym/genjax/pull/1570
  • Bump webfactory/ssh-agent from 0.9.0 to 0.9.1 by @dependabot in https://github.com/ChiSym/genjax/pull/1575
  • Add support for sample_shape to primitive distributions by @sritchie in https://github.com/ChiSym/genjax/pull/1576

Full Changelog: https://github.com/ChiSym/genjax/compare/v0.10.2...v0.10.3

- Python
Published by sritchie about 1 year ago

genjax - v0.10.2

What's Changed

  • Show mapping tutorial in docs by @fzaiser in https://github.com/ChiSym/genjax/pull/1557
  • Do a little cleanup around InitialStylePrimitive. by @femtomc in https://github.com/ChiSym/genjax/pull/1556
  • Update usage of JAX partialeval / wrapinit to accept debug info by @femtomc in https://github.com/ChiSym/genjax/pull/1563

Full Changelog: https://github.com/ChiSym/genjax/compare/v0.10.1...v0.10.2

- Python
Published by sritchie about 1 year ago

genjax - v0.10.1

What's Changed

  • Fix cookbook doc by @MathieuHuot in https://github.com/ChiSym/genjax/pull/1539
  • Add citation file, research code disclaimer (GEN-1009, GEN-1010) by @sritchie in https://github.com/ChiSym/genjax/pull/1542
  • Add CNAME file, fix github pages address by @sritchie in https://github.com/ChiSym/genjax/pull/1545
  • [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/ChiSym/genjax/pull/1544
  • Add colab buttons, public colab link to notebook (GEN-1014, GEN-1015) by @sritchie in https://github.com/ChiSym/genjax/pull/1546
  • Downgrade poetry (GEN-990) by @sritchie in https://github.com/ChiSym/genjax/pull/1549
  • improving cookbook on adding a distribution to GenJAX by @MathieuHuot in https://github.com/ChiSym/genjax/pull/1540
  • Fix up new issue templates (GEN-1016) by @sritchie in https://github.com/ChiSym/genjax/pull/1550
  • Gen1D cookbook: intro to modelling and block-gibbs by @MathieuHuot in https://github.com/ChiSym/genjax/pull/1541
  • add orcids (GEN-1033) by @sritchie in https://github.com/ChiSym/genjax/pull/1547
  • Add mapping tutorial to the cookbook (inactive) by @fzaiser in https://github.com/ChiSym/genjax/pull/1552
  • Remove EditRequest restriction for DiMap by @fzaiser in https://github.com/ChiSym/genjax/pull/1551
  • Update README.md by @femtomc in https://github.com/ChiSym/genjax/pull/1554

New Contributors

  • @fzaiser made their first contribution in https://github.com/ChiSym/genjax/pull/1552

Full Changelog: https://github.com/ChiSym/genjax/compare/v0.10.0...v0.10.1

- Python
Published by sritchie about 1 year ago

genjax - v0.10.0

What's Changed

Breaking Changes

  • Remove MaskSel, Flag => bool in a number of spots (GEN-979) by @sritchie in https://github.com/ChiSym/genjax/pull/1529
  • Expunge the concept of Constraint; just rely on choice map everywhere. by @femtomc in https://github.com/ChiSym/genjax/pull/1532
  • Clean up the usage of the trace primitive and remove global "handler stack". by @femtomc in https://github.com/ChiSym/genjax/pull/1531

Fixes

  • Fix mix side-effecting issue (GEN-986) by @sritchie in https://github.com/ChiSym/genjax/pull/1537
  • use existing index to descend to subtrace in SwitchTrace by @littleredcomputer in https://github.com/ChiSym/genjax/pull/1536

Cookbook

  • Adding IndexRequest for Vmap and cookbook entry on IndexRequest by @MathieuHuot in https://github.com/ChiSym/genjax/pull/1518
  • Add mathjax support for $, $$ delimiters (GEN-975) by @sritchie in https://github.com/ChiSym/genjax/pull/1525
  • fix math rendering in notebooks (GEN-987) by @sritchie in https://github.com/ChiSym/genjax/pull/1535

Misc

  • Clarify which keyword arg flip and bernoulli populate in tfd.Bernoulli (GEN-626) by @sritchie in https://github.com/ChiSym/genjax/pull/1526
  • warn on implicit use of log scale in categorical, bernoulli by @littleredcomputer in https://github.com/ChiSym/genjax/pull/1528
  • Tighten up types on getsubmap, getsubtrace (GEN-980) by @sritchie in https://github.com/ChiSym/genjax/pull/1530
  • Upgrade to beartype 0.20.0 by @sritchie in https://github.com/ChiSym/genjax/pull/1538
  • Remove extra google auth calls by @sritchie in https://github.com/ChiSym/genjax/pull/1522
  • Remove docs on deprecated ^ for choicemaps (GEN-961) by @sritchie in https://github.com/ChiSym/genjax/pull/1524

Full Changelog: https://github.com/ChiSym/genjax/compare/v0.9.3...v0.10.0

- Python
Published by sritchie about 1 year ago

genjax - v0.9.3: bugfix release

What's Changed

  • Take multiple address components in get_submap by @sritchie in https://github.com/ChiSym/genjax/pull/1516
  • Adding a cookbook on speedup using incremental computation by @MathieuHuot in https://github.com/ChiSym/genjax/pull/1499
  • equip assess with readable error if address absent by @littleredcomputer in https://github.com/ChiSym/genjax/pull/1517
  • Add tfpdistribution back into appropriate _init__ by @sritchie in https://github.com/ChiSym/genjax/pull/1520

Full Changelog: https://github.com/ChiSym/genjax/compare/v0.9.2...v0.9.3

- Python
Published by sritchie over 1 year ago

genjax - v0.9.2: simpler trace printing

What's Changed

  • remove info parameter from DimapCombinator by @sritchie in https://github.com/ChiSym/genjax/pull/1511
  • remove Combinator suffix from combinators by @sritchie in https://github.com/ChiSym/genjax/pull/1514
  • remove ExactDensityFromCallables by @littleredcomputer in https://github.com/ChiSym/genjax/pull/1510
  • fix printed repr of genjax distributions created by lambda by @littleredcomputer in https://github.com/ChiSym/genjax/pull/1515

Full Changelog: https://github.com/ChiSym/genjax/compare/v0.9.1...v0.9.2

- Python
Published by sritchie over 1 year ago

genjax - v0.9.1, trace simplification proceeds

What's Changed

  • Restrict Selection to static addresses only by @sritchie in https://github.com/ChiSym/genjax/pull/1507
  • Remove Projection in favor of Selection by @sritchie in https://github.com/ChiSym/genjax/pull/1509
  • GEN-963 move get_subtrace to Trace by @littleredcomputer in https://github.com/ChiSym/genjax/pull/1508

Full Changelog: https://github.com/ChiSym/genjax/compare/v0.9.0...v0.9.1

- Python
Published by sritchie over 1 year ago

genjax - v0.9.0: Trace tidying, we're on pypi!

This is the first GenJAX release published to PyPI proper.

Pypi page: https://pypi.org/project/genjax/ Docs live here: https://chisym.github.io/genjax/

What's Changed

New Stuff

  • Adding some TFP distributions (initially Gamma), a test, nuking Bates as it doesn't work by @MathieuHuot in https://github.com/ChiSym/genjax/pull/1493
  • Add switch to ChoiceMapBuilder (GEN-897) by @sritchie in https://github.com/ChiSym/genjax/pull/1469
  • Add all, none, leaf and S[()] == S.none (GEN-945) by @sritchie in https://github.com/ChiSym/genjax/pull/1492
  • Implement project for VmapCombinator by @sritchie in https://github.com/ChiSym/genjax/pull/1505

Changes / Fixes

  • Fix Switch choicemap | behavior with static chms (GEN-908) by @sritchie in https://github.com/ChiSym/genjax/pull/1468
  • Remove EmptyConstraint and MaskedConstraint as unnecessary concepts by @femtomc in https://github.com/ChiSym/genjax/pull/1477
  • Allow kwarg construction of masks (GEN-944) by @sritchie in https://github.com/ChiSym/genjax/pull/1491
  • gen-946 deprecate get_sample by @littleredcomputer in https://github.com/ChiSym/genjax/pull/1489
  • GEN-957 internal StaticTrace improvements by @littleredcomputer in https://github.com/ChiSym/genjax/pull/1500

Cookbook

  • Cleanup cookbook titles after moving away from quarto by @MathieuHuot in https://github.com/ChiSym/genjax/pull/1498
  • Adding a cookbook entry on importance method by @MathieuHuot in https://github.com/ChiSym/genjax/pull/1494
  • Cookbook on update by @MathieuHuot in https://github.com/ChiSym/genjax/pull/1496
  • Move cookbooks out from under quarto, into docs directory. by @femtomc in https://github.com/ChiSym/genjax/pull/1483

Misc

  • relax python bounds, upgrade studio by @sritchie in https://github.com/ChiSym/genjax/pull/1497
  • Pypi genstudio, publish, bump python to 3.11 by @sritchie in https://github.com/ChiSym/genjax/pull/1476
  • Tidy readme for the new pypi world by @sritchie in https://github.com/ChiSym/genjax/pull/1479
  • Move docs to GitHub Pages by @sritchie in https://github.com/ChiSym/genjax/pull/1487
  • Remove unnecessary gcloud action by @sritchie in https://github.com/ChiSym/genjax/pull/1478
  • Fix Codecov integration by @sritchie in https://github.com/ChiSym/genjax/pull/1484
  • Replace chi-collective with ChiSym in all docs, badges by @sritchie in https://github.com/ChiSym/genjax/pull/1502
  • Fix coverage badge by @sritchie in https://github.com/ChiSym/genjax/pull/1503
  • Tweak description for pypi by @sritchie in https://github.com/ChiSym/genjax/pull/1475

Full Changelog: https://github.com/ChiSym/genjax/compare/v0.8.1...v0.8.2

- Python
Published by sritchie over 1 year ago

genjax - v0.8.1

What's Changed

  • fix: slack command typo by @cameronfreer in https://github.com/probcomp/genjax/pull/1457
  • Fix non-Diff return value issue (GEN-902) by @sritchie in https://github.com/probcomp/genjax/pull/1461
  • Don't depend on removed jax.interpreters.ad code (GEN-896) by @sritchie in https://github.com/probcomp/genjax/pull/1465
  • Fix assess in vmap (GEN-903) by @sritchie in https://github.com/probcomp/genjax/pull/1464

New Contributors

  • @cameronfreer made their first contribution in https://github.com/probcomp/genjax/pull/1457

Full Changelog: https://github.com/probcomp/genjax/compare/v0.8.0...v0.8.1

- Python
Published by sritchie over 1 year ago

genjax - v0.8.0: simpler ChoiceMaps, new combinators

GenJAX 0.8.0 is here! We have a few minor breaking changes, a nice set of new features and a bunch of ChoiceMap improvements for your pleasure. The sections below list out each PR that was merged since the previous release, along with some exposition about the new features where appropriate.

To install this new version, run

bash pip install keyring keyrings.google-artifactregistry-auth pip install "genjax==0.8.0" --extra-index-url https://us-west1-python.pkg.dev/probcomp-caliban/probcomp/simple/

or bump the version to "0.8.0" wherever you've pinned your current version.

Thanks to @georgematheos , @esli999 , @MathieuHuot , @femtomc, @limarta and @ahiser1117 for code, testing, bug reports and repros.

Breaking Changes

  • dimap's post-xform should accept the original args (GEN-781) by @sritchie in https://github.com/probcomp/genjax/pull/1429
  • Present transformed args to post_fn for DimapCombinator by @sritchie in https://github.com/probcomp/genjax/pull/1449

dimap's post argument and contramap's argument now accept 3 arguments: the pre-transformed input args, the post-transformed input args, and the return value. Before they only took the pre-transformed args and the return value.

  • make genjax.flip return a boolean (GEN-869) by @sritchie in https://github.com/probcomp/genjax/pull/1451

Fixes / new stuff

  • Add exponential distribution. by @femtomc in https://github.com/probcomp/genjax/pull/1417
  • Fix vmap over Pytree (GEN-853) by @sritchie in https://github.com/probcomp/genjax/pull/1433

This fix allows you to use pytree instances as the input to a vmapped model.

  • Add a "static" version of Const (GEN-852) by @sritchie in https://github.com/probcomp/genjax/pull/1434

This allows you to use Const.unwrap(x) on a Const or non-Const object; Const.unwrap acts as identity when supplied with a non-Const.

  • Make @genjax.gen work on methods (GEN-541) by @sritchie in https://github.com/probcomp/genjax/pull/1349

It's now possible to use the @gen decorator on the method of a class. See below for an example:

python In [5]: import jax ...: import genjax ...: from genjax._src.core.pytree import Pytree ...: from genjax._src.core.typing import Array, ArrayLike ...: ...: ...: @genjax.gen ...: def outside(x): ...: return genjax.normal(x, 1.0) @ "x" ...: ...: @Pytree.dataclass ...: class Model(Pytree): ...: foo: ArrayLike ...: bar: ArrayLike ...: ...: @genjax.gen ...: def run(self, x): ...: y = genjax.normal(self.foo, self.bar) @ "y" ...: z = genjax.normal(x, 1.0) @ "z" ...: return y + z ...: ...: key = jax.random.PRNGKey(0) ...: m = Model(foo=4.0, bar=6.0) ...: m.run.simulate(key, (1.0,)).get_choices() Out[5]: Static({ 'y': Choice(v=<jax.Array(-4.405305, dtype=float32)>), 'z': Choice(v=<jax.Array(1.3905154, dtype=float32)>), })

  • maskediterate, maskediterate_final (GEN-327, GEN-859) by @sritchie in https://github.com/probcomp/genjax/pull/1450

We have two new combinators! masked_iterate and masked_iterate_final are similar to their non-masked variants, except instead of providing an initial value, you provide a pair of initial_value and a boolean array. The nth iteration will be scored if the nth boolean entry is True, and not scored if its entry is False.

For example:

```python masks = jnp.array([True, True])

@genjax.gen def step(x): _ = ( genjax.normal.mask().vmap(in_axes=(0, None, None))(masks, x, 1.0) @ "rats" ) return x

Create some initial traces:

key = jax.random.key(0) masksteps = jnp.arange(10) < 5 model = step.maskediteratefinal() initparticle = model.simulate(key, (0.0, masksteps)) initparticle.get_choices() ```

image

  • (StaticGenerativeFunction) Prevents allocation and accumulation of score, when its available in callee subtraces. by @femtomc in https://github.com/probcomp/genjax/pull/1418
  • Allow PythonicPytree indexing using JAX arrays by @georgematheos in https://github.com/probcomp/genjax/pull/1440

ChoiceMap

Breaking change — any place you've used an ellipsis like ... to query a ChoiceMap, please replace it with :.

ChoiceMap instances now automatically simplify! There is no more "filtered choicemap", as all filters are pushed down to the leaves:

```python lside = C["x"].set({"y":1.0, "z": 2.0}).mask(jnp.array(True)) rside = C["x", "b"].set(1.0)

lside | rside ```

image

We've also gotten rid of any returned Indexed choicemap layer. JAX's arrays already keep track of their indexing; there's no need to introduce another Indexed layer on our side.

```python @genjax.gen def kernel(mean): # Three independent choices x = genjax.normal(mean, 1.0) @ "x" y = genjax.normal(x, 2.0) @ "y" # Conditioned on x z = genjax.normal(0.0, 3.0) @ "z" return x + y + z

vmappedmodel = kernel.vmap() key = jax.random.key(0) chm = vmappedmodel.simulate(key, (jnp.arange(10.0),)).get_choices() chm ```

image

You can still query this choicemap like before, with a : to note the index:

python chm[:, "x"]

image

But you can also just omit the : and get the value via chm["x"]. Any non-string entries you place into the braces will be pushed down to the array-shaped leaves of the choicemap.

  • Update choicemap cookbook (GEN-568) by @MathieuHuot in https://github.com/probcomp/genjax/pull/1381
  • Remove ellipsis support from queries, add SwitchChm (GEN-698, GEN-696, GEN-542) by @sritchie in https://github.com/probcomp/genjax/pull/1421
  • Enforce "Mask has scalar flag", allow vectorized Mask (GEN-768, GEN-765, GEN-769) by @sritchie in https://github.com/probcomp/genjax/pull/1423
  • remove Filtered, fix MaskTrace vmappability (GEN-662, GEN-569, GEN-775, GEN-767) by @sritchie in https://github.com/probcomp/genjax/pull/1422
  • Remove Xor, chip away at Or (GEN-774) by @sritchie in https://github.com/probcomp/genjax/pull/1436
  • Remove Indexed layers with None address by @sritchie in https://github.com/probcomp/genjax/pull/1437

Edit

  • (1 / N) Remove ChoiceMapEditRequest, replace with StaticRequest by @femtomc in https://github.com/probcomp/genjax/pull/1404
  • (2 / N) Do a bit of re-org to support deriving the implementations of edit for primitive EditRequest types by @femtomc in https://github.com/probcomp/genjax/pull/1407
  • (3 / N) Add an edit request which can be used to forcibly coerce Diff values according to user input. by @femtomc in https://github.com/probcomp/genjax/pull/1406
  • (5 / N) Add HMC as an EditRequest. by @femtomc in https://github.com/probcomp/genjax/pull/1408
  • (6 / N) Add Rejuvenate -- a proposal-driven regeneration EditRequest by @femtomc in https://github.com/probcomp/genjax/pull/1411
  • (7 / N) Add IndexRequest edit to ScanCombinator by @femtomc in https://github.com/probcomp/genjax/pull/1405

Cookbook

  • Cookbook cleaning splitting by @MathieuHuot in https://github.com/probcomp/genjax/pull/1380
  • clarifying how to use indexed-choicemap by @MathieuHuot in https://github.com/probcomp/genjax/pull/1425
  • convert adev_example notebook to genstudio by @mhuebert in https://github.com/probcomp/genjax/pull/1414
  • update adevexample with latest code from adevdemo by @mhuebert in https://github.com/probcomp/genjax/pull/1447
  • adev: interactive cell (GEN-708) by @mhuebert in https://github.com/probcomp/genjax/pull/1416

Misc

  • Support JAX>=0.4.34 by removing recast_to_float0 and using our own implementation. by @femtomc in https://github.com/probcomp/genjax/pull/1410
  • Adding a test for mask scan combinator by @MathieuHuot in https://github.com/probcomp/genjax/pull/1443

Full Changelog: https://github.com/probcomp/genjax/compare/v0.7.0...v0.8.0

- Python
Published by sritchie over 1 year ago

genjax - v0.7.0

GenJAX 0.7.0

New things

  • scan and vmap will now return the same detailed validation errors that you receive with jax.vmap and jax.lax.scan (https://github.com/probcomp/genjax/pull/1369)
  • Thanks to @limarta for adding genjax.dirichlet, aliasing the tensorflow-probability distribution!
  • project is now implemented for SwitchCombinator: https://github.com/probcomp/genjax/pull/1382

ChoiceMap upgrades

Shape validation

ChoiceMaps now have an invalid_subset method that takes a generative function and an args tuple and return the subset of the ChoiceMap that can be statically shown to never be accessed. This is a great way of checking for typos in your addresses or mismatched index-vs-static layers. We're planning on wiring this in to the GFI so that you see warnings if the invalid_subset isn't empty.

If you have no invalid addresses this method will return None.

```python import genjax

@genjax.gen def model(x): y = genjax.bernoulli(0.5) @ "y" return x + y

# Create a ChoiceMap with extra choices chm = genjax.ChoiceMap.d({"y": 1, "z": 2, "w": 3})

# Identify invalid choices extras = chm.invalid_subset(model, (1,))

assert "z" in extras # "z" is an extra choice not in the model assert "w" in extras # "w" is an extra choice not in the model assert "y" not in extras # "y" is a valid choice in the model

# The returned ChoiceMap contains only the invalid choices assert extras == genjax.ChoiceMap.d({"z": 2, "w": 3}) ```

ChoiceMap slicing

This release introduces new functionality for creating and accessing ChoiceMaps using slices. We're not all the way toward FULL slice support but we're getting there. Here are some examples:

```python import jax.numpy as jnp from genjax import ChoiceMapBuilder as C

# Create a ChoiceMap with a 2D array using ChoiceMapBuilder chm = C[:, "x", :].set(jnp.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]))

# Access elements using int or scalar int addresses, a single non-full slice, and full slices at the tail assert chm[0, "x", 1] == 2 assert jnp.all(chm[1, "x", :] == jnp.array([4, 5, 6])) assert jnp.all(chm[0:2, "x", :] == jnp.array([[1, 2, 3], [4, 5, 6]])) assert jnp.all(chm[:, "x", :] == jnp.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]))

# Create a ChoiceMap with nested structure nested_chm = C["y", :, "z", :].set(jnp.arange(20).reshape(4, 5))

# Access nested elements using various slice combinations assert nestedchm["y", 2, "z", 3] == 13 assert jnp.all(nestedchm["y", 1:3, "z", :] == jnp.array([[5, 6, 7, 8, 9], [10, 11, 12, 13, 14]])) ```

ChoiceMap simplification

Printing of ChoiceMaps in notebooks is much cleaner now. You might even say that it sparks joy. Many nested statically-addressed choicemaps now print as a nested dictionary with Choice leaves:

image

If you do have a difficult-to-read ChoiceMap with masks and indices, try callling simplify() on your ChoiceMap:

image

This will push down all filters to the leaves, leaving you with a tidier, easier-to-read data structure.

ChoiceMap miscellany / PRs

  • Implement __and__ dunder for choicemaps for intersection of 2 chms by @sritchie in https://github.com/probcomp/genjax/pull/1367
  • Add filter pushdowns to choice maps, tidy rendering / names (GEN-162, GEN-422, GEN-598, GEN-167) by @sritchie in https://github.com/probcomp/genjax/pull/1359
  • modify StaticChm to wrap a dict by @sritchie in https://github.com/probcomp/genjax/pull/1354
  • Convert nested Static choicemaps into a single Static with nested dicts (GEN-617) by @sritchie in https://github.com/probcomp/genjax/pull/1363
  • Remove EmptyChm in favor of StaticChm({}) by @sritchie in https://github.com/probcomp/genjax/pull/1358
  • Add a switch static method to ChoiceMap by @sritchie in https://github.com/probcomp/genjax/pull/1365
  • Static ChoiceMap shape validation, vmap and scan validation upgrades (GEN-418, GEN-83) by @sritchie in https://github.com/probcomp/genjax/pull/1369
  • Restrict Indexed lookups in ChoiceMap to working cases (5/N) by @sritchie in https://github.com/probcomp/genjax/pull/1389
  • remove ChoiceMapConstraint inheritance from ChoiceMap (6/N) by @sritchie in https://github.com/probcomp/genjax/pull/1390
  • Add _ChoiceMapBuilder.update, Choice.build by @sritchie in https://github.com/probcomp/genjax/pull/1401
  • Add slicing support to ChoiceMap and ChoiceMapBuilder (GEN-424, GEN-587 ) by @sritchie in https://github.com/probcomp/genjax/pull/1392

Edit

  • Change signature of edit to always pass argdiffs (2 / N) by @femtomc in https://github.com/probcomp/genjax/pull/1356
  • (1 / N) Add edit method to EditRequest, rename the update EditRequest to IncrementalChoiceMapRequest. by @femtomc in https://github.com/probcomp/genjax/pull/1370
  • (2 / N) Add Regenerate request to support a "regenerate" edit for Distributions and StaticGenerativeFunction by @femtomc in https://github.com/probcomp/genjax/pull/1372

Fixes

These issues are various bugfixes that we addressed for 0.7.0:

  • Fix docs page installation formatting, mix example (GEN-563) by @sritchie in https://github.com/probcomp/genjax/pull/1338
  • fix Diff methods, add tests (GEN-242) by @sritchie in https://github.com/probcomp/genjax/pull/1385
  • Replace jax.random.split in StaticGenerativeFunction with jax.random.fold_in - a faster primitive by @femtomc in https://github.com/probcomp/genjax/pull/1394

Cookbook-related items

  • Cookbook entry on masking (GEN-135) by @MathieuHuot in https://github.com/probcomp/genjax/pull/1236
  • Make a few CSS tweaks and changes to layout of cookbook. by @femtomc in https://github.com/probcomp/genjax/pull/1340
  • Fixing ending cookbook dynamic_computation by @MathieuHuot in https://github.com/probcomp/genjax/pull/1342
  • Switch Mask's flag and value args by @sritchie in https://github.com/probcomp/genjax/pull/1364
  • Adding a first example as a cookbook entry of using ADEV for correctly differentiating probabilistic programs by @MathieuHuot in https://github.com/probcomp/genjax/pull/1250
  • Add test checking mapping of all dimensions by default (GEN-668) by @sritchie in https://github.com/probcomp/genjax/pull/1399
  • move recast_to_float0 into genjax (GEN-639) by @sritchie in https://github.com/probcomp/genjax/pull/1403

Housekeeping

The first of these is a breaking change; no one was using this and we want to tackle this again once we have clearer requirements.

  • implement remaining IgnoreKwargs, GenerativeFunctionClosure methods (2/N) by @sritchie in https://github.com/probcomp/genjax/pull/1386
  • Remove msgpack extra, serialization code by @sritchie in https://github.com/probcomp/genjax/pull/1344
  • Use pass vs UnimplementedError for abstract methods by @sritchie in https://github.com/probcomp/genjax/pull/1366
  • Upgrade to new treescope dependency, remove custom formatter (GEN-571) by @sritchie in https://github.com/probcomp/genjax/pull/1334
  • Fix safety issue in CI by @sritchie in https://github.com/probcomp/genjax/pull/1353
  • Remove unused inference testing code by @sritchie in https://github.com/probcomp/genjax/pull/1361
  • Add test showing that project works (GEN-316) by @sritchie in https://github.com/probcomp/genjax/pull/1360
  • Upgrade pyright, add missing override to IgnoreKwargs (GEN-573) by @sritchie in https://github.com/probcomp/genjax/pull/1343
  • Remove type aliases by @sharlaon in https://github.com/probcomp/genjax/pull/1396
  • poetry update, including treescope upgrade by @sritchie in https://github.com/probcomp/genjax/pull/1346
  • prefer key to PRNGKey by @sritchie in https://github.com/probcomp/genjax/pull/1398
  • Remove selection from MaskSel by @sritchie in https://github.com/probcomp/genjax/pull/1351
  • type-check inference package (GEN-484) by @sritchie in https://github.com/probcomp/genjax/pull/1348
  • Simplify SwitchCombinator implementation, implement project for switch (GEN-640) by @sritchie in https://github.com/probcomp/genjax/pull/1382
  • Tidy scan, vmap combinators (3/N) by @sritchie in https://github.com/probcomp/genjax/pull/1387

New Contributors

  • @sharlaon made their first contribution in https://github.com/probcomp/genjax/pull/1396

Full Changelog: https://github.com/probcomp/genjax/compare/v0.6.1...v0.7.0

- Python
Published by sritchie over 1 year ago

genjax - GenJAX 0.6.1 (because I fumbled the 0.6.0 release)

0.6.1, hot off the presses with this fix for Arijit's bug:

What's Changed

  • Fix mask combinator move from false (GEN-365) by @sritchie in https://github.com/probcomp/genjax/pull/1331
  • Full Changelog: https://github.com/probcomp/genjax/compare/v0.6.0...v0.6.1

- Python
Published by sritchie over 1 year ago

genjax - v0.6.0: Generic Types and Blue Steele

GenJAX 0.6.0

We have been burning through our backlog, and we're happy to introduce v0.6.0 with a number of quality-of-life improvements and bugfixes.

See the subheadings below for the big themes of this release.

Thank you all for the tickets you've been filing! We're now down below 10 issues on GitHub, and we plan on keeping our response time fast. Keep the issues coming.

@femtomc insisted that I include this release image:

New things

Generative functions created with @genjax.gen will now preserve their docstrings, so hovering over their symbols in your editor (or call help(my_gen_fn) will now show your docstring.

@littleredcomputer removed the explicit Flag type from user-facing code, leaving you all with one less idea to worry about.

  • Preserve docstring, metadata on genjax.gen-wrapped fns (GEN-76) by @sritchie in https://github.com/probcomp/genjax/pull/1317
  • Add default parameter to Mask.unwrap (GEN-483) by @sritchie in https://github.com/probcomp/genjax/pull/1316
  • Add partial_apply to StaticGenerativeFunction by @sritchie in https://github.com/probcomp/genjax/pull/1247
  • hide Flag, by making it a class of static operations by @littleredcomputer in https://github.com/probcomp/genjax/pull/1325

Types

You'll notice in GenJAX 0.6.0 that your editor is able to do MUCH more work tracking types through variables, and preventing Any from popping out. Generative functions, traces and many more classes now track their return type, allowing you to get that sweet sweet editor feedback as you interact with objects in GenJAX.

This also helped us identify awkward return types. SwitchCombinator's return value was R | Sum[R], for example. This was so ugly that we figured out how to remove Sum from the codebase, leaving you with less of a mental burden. Always nice in this tough world.

We've also turned on global typechecking for the GenJAX package. If we've declared a static type on some function and your code causes (at runtime) some non-matching value to show up, GenJAX will throw an error. This will help you fix your bug, OR generate a great bug report for us by pinpointing exactly what went wrong.

We are also now fully passing pyright with most of its "strict" settings turned on. This has been immensely helpful in identifying unreported bugs and making sure that we don't introduce regressions.

  • Replace Tuple, Dict, List typing with built-ins by @sritchie in https://github.com/probcomp/genjax/pull/1255
  • gen-420 and some type fixes by @littleredcomputer in https://github.com/probcomp/genjax/pull/1259
  • Remove Optional in favor of | None by @sritchie in https://github.com/probcomp/genjax/pull/1281
  • Annotate bare tuples by @sritchie in https://github.com/probcomp/genjax/pull/1279
  • add R generics throughout by @sritchie in https://github.com/probcomp/genjax/pull/1277
  • Turn on strict typechecking with exclusions by @sritchie in https://github.com/probcomp/genjax/pull/1297
  • Enable beartype globally by @sritchie in https://github.com/probcomp/genjax/pull/1266
  • Lock down types for SwitchCombinator, cast / throw in concrete idx case (GEN-486) by @sritchie in https://github.com/probcomp/genjax/pull/1301
  • Remove Sum type from SwitchCombinator's return (GEN-536) by @sritchie in https://github.com/probcomp/genjax/pull/1303

ChoiceMap and Selection

We've taken a first pass at making ChoiceMap and Selection more pleasant to use. The Selection and ChoiceMap tests now have many usage examples of how to build various ChoiceMaps and filter them using Selection instances.

The docs are also now fully fleshed out and show examples for every possible way to generate, combine and use these two types:

set now recognizes dictionaries, and set works recursively:

```python from genjax import ChoiceMapBuilder as C

C["top"].set({ "x": 3, "y": {"z": 4, "w": C["bottom"].set({"v": 5})}, }) ```

ChoiceMapBuilder is also no longer necessary, and can be accessed by ChoiceMap.builder. Or you can use the various static methods and instance methods to build up ChoiceMap instances.

We still don't have a good story for creating ChoiceMaps that match multi-dimensional vmaps, but we know that this is a top concern from users and we'll be fleshing out a better story here for the next big release.

  • Overhaul ChoiceMap docs, instance and class methods (GEN-308, GEN-328, GEN-544) by @sritchie in https://github.com/probcomp/genjax/pull/1305
  • ChoiceMap and Selection constructor optimizations (GEN-548, GEN-558) by @sritchie in https://github.com/probcomp/genjax/pull/1323
  • Allow wildcards in SelectionBuilder by @sritchie in https://github.com/probcomp/genjax/pull/1329

Fixes

These issues are various bugfixes that we addressed for 0.6.0:

  • Fix assess in switch combinator (GEN-433) by @sritchie in https://github.com/probcomp/genjax/pull/1293
  • add test for assess on tupled address trace (GEN-29) by @sritchie in https://github.com/probcomp/genjax/pull/1294
  • fix bug with flag.choose, and rename it; widen its use by @littleredcomputer in https://github.com/probcomp/genjax/pull/1276
  • Only allow scalar flags to Mask constructor (GEN-523) by @sritchie in https://github.com/probcomp/genjax/pull/1298
  • fix unwanted jnp.all in flag.where by @littleredcomputer in https://github.com/probcomp/genjax/pull/1291
  • Remove reverse, unroll flags from scan and friends (GEN-404) by @sritchie in https://github.com/probcomp/genjax/pull/1328
  • fix GEN-524 by equilibrating argdiff shape in VmapTrace by @littleredcomputer in https://github.com/probcomp/genjax/pull/1304
  • fix GEN-387, GEN-333 by @littleredcomputer in https://github.com/probcomp/genjax/pull/1306
  • Cookbook-related items

  • Fixing some problems in cookbooks after comments from Rif (GEN-388) by @MathieuHuot in https://github.com/probcomp/genjax/pull/1253

  • Separate cookbook for choice maps creation and selection (GEN-287) by @MathieuHuot in https://github.com/probcomp/genjax/pull/1216

  • Better looking cookbook outline (on the website) by @MathieuHuot in https://github.com/probcomp/genjax/pull/1257

  • cookbook entry on "Nested approximate marginalisation & RAVI stacks" (GEN-134) by @MathieuHuot in https://github.com/probcomp/genjax/pull/1215

  • Retval of Gaussian Mixture in Cookbook is the incorrect order by @ahiser1117 in https://github.com/probcomp/genjax/pull/1272

Housekeeping

  • Add install instructions to main docs site by @sritchie in https://github.com/probcomp/genjax/pull/1267
  • Fix GPU tests by @sritchie in https://github.com/probcomp/genjax/pull/1274
  • Fix safety check, run safety on PRs by @sritchie in https://github.com/probcomp/genjax/pull/1275
  • Remove register_exclusion by @sritchie in https://github.com/probcomp/genjax/pull/1280
  • Remove dead code by @sritchie in https://github.com/probcomp/genjax/pull/1283
  • Add vulture pre-commit hook by @sritchie in https://github.com/probcomp/genjax/pull/1284
  • Remove traceback util (no op). by @femtomc in https://github.com/probcomp/genjax/pull/1321
  • fix: .fl rule applying to floats in highlighted code (GEN-502) by @mhuebert in https://github.com/probcomp/genjax/pull/1308

Full Changelog: https://github.com/probcomp/genjax/compare/v0.5.1...v0.6.0

- Python
Published by sritchie over 1 year ago

genjax - v0.5.1: Pythonic Pytrees and permissive deps

What's new?

Iterate and Accumulate prepend their initial accumulator

1208 modifies the iterate and accumulate combinators to attach the initial accumulator at the front of the array returned by these generative functions.

jax.lax.scan does NOT do this because the type signature of (s -> a -> (s, b)) -> s -> [a] -> (s, [b]) doesn't allow it. (The accumulated type here is b, not s).

BUT in iterate and accumulate, s == b, and returning the initial accumulator matches the behavior of these functions everywhere they appear (in Clojure, Python, Haskell, Scala etc.).

Thanks to @littleredcomputer for suggesting this and @arijitnoobstar for noting that this would be useful for him as well.

  • Prepend initial accumulator in accumulate, iterate (GEN-346) by @sritchie in https://github.com/probcomp/genjax/pull/1208

genjax.PythonicPytree

We've introduced a new PythonicPytree base class that adds Pythonic operations to Pytrees, making them easier to work with. This class is particularly useful for Pytrees with uniform shape over leaves. Here are some examples of the new functionality:

Indexing and Slicing

You can now use bracket notation to index or slice a PythonicPytree:

python pytree = MyPythonicPytree(...) # Assume this is filled with some data first_element = pytree[0] # Get the first element across all leaves sliced_pytree = pytree[1:5] # Slice the pytree, getting elements 1 through 4

Length and Iteration

PythonicPytrees now support len() and can be iterated over:

python length = len(pytree) # Get the length of the pytree for element in pytree: # Iterate over each element of the pytree print(element)

Concatenation

You can concatenate two PythonicPytrees of the same type using +:

python pytree1 = MyPythonicPytree(...) pytree2 = MyPythonicPytree(...) combined_pytree = pytree1 + pytree2 # Concatenate the two pytrees

Prepending Elements

You can prepend a scalar element to each leaf in a PythonicPytree:

python scalar_element = 5 # Or any other scalar value new_pytree = pytree.prepend(scalar_element)

  • Adopt @huebert's Pythonic base class into Pytree. by @littleredcomputer in https://github.com/probcomp/genjax/pull/1243

New cookbooks

The GenJAX cookbook has a few new entries, thanks to @MathieuHuot 👍

Interpreted is gone, long live interpreted

The last vestiges of genjax.interpreted were removed in #1222.

Dependency massaging

We've relaxed the JAX dependency, making GenJAX easier to install in a Colab environment or alongside other libraries that have other demands:

  • constrain numpy to <2.0.0 by @sritchie in https://github.com/probcomp/genjax/pull/1231
  • Adjust JAX dependency, genstudio by @sritchie in https://github.com/probcomp/genjax/pull/1251

Minor fixes / changes

  • Fixes GEN-312 (score should be FloatArray) by @littleredcomputer in https://github.com/probcomp/genjax/pull/1213
  • fixes to ScanCombinator._update by @littleredcomputer in https://github.com/probcomp/genjax/pull/1212
  • Hotfix for TFP broadcasting in ExactDensity. by @femtomc in https://github.com/probcomp/genjax/pull/1214
  • Clean up easy pyright errors by @sritchie in https://github.com/probcomp/genjax/pull/1217
  • Fix pyright errors in exact_testbed by @sritchie in https://github.com/probcomp/genjax/pull/1218
  • Fix dimap args / retval mapping issue (GEN-345) by @sritchie in https://github.com/probcomp/genjax/pull/1209
  • Fix incorrect mask update weight (GEN-340) by @arijitnoobstar in https://github.com/probcomp/genjax/pull/1204
  • Change to explicit jax.lax usages (GEN-344) by @sritchie in https://github.com/probcomp/genjax/pull/1232
  • Replace all "assert True" statements with simple tests by @sritchie in https://github.com/probcomp/genjax/pull/1233
  • Change typechecking mode to standard by @sritchie in https://github.com/probcomp/genjax/pull/1226

New Contributors

  • @arijitnoobstar made their first contribution in https://github.com/probcomp/genjax/pull/1204

Full Changelog: https://github.com/probcomp/genjax/compare/v0.5.0...v0.5.1

- Python
Published by sritchie almost 2 years ago

genjax - v0.5.0

This release is focused on a better user experience for all of our new, enthusiastic users-and-bug-reporters. Special thanks for @arijitnoobstar, @derifatives, @georgematheos and @LarryLegend33 for kicking the tires on 0.4.0. We haven't fixed everything reported but we're making progress.

Breaking changes 🔪

There are a few small breaking changes in this release that merit the minor version bump to 0.5.0:

  • AddressBijectionCombinator and the associated genjax.map_addresses and the genjax.GenerativeFunction.map_addresses have been deleted over lack-of-use and correctness concerns
  • genjax.mix, genjax.switch and genjax.or_else were formerly "decorators", usable like this:

python @genjax.mix(model_b, model_c) @gen def mixture_model(): # model_a body here

but that implementation forced users into this awkward style:

python mixed_model = genjax.mix(model_b, model_c)(model_a)

The new genjax.mix implementation takes all models and returns a mixture model:

python mixed = genjax.mix(model_a, model_b, model_c, ...)

The same reasonable and change applies for genjax.or_else and genjax.switch.

What's new?

The GenJAX Cookbook

The GenJAX Cookbook is brimming with entries, thanks to @MathieuHuot: https://genjax.gen.dev/cookbook/index.html

“cookbook” entries are meant to be smaller investigations of some pattern, tip or “sharp edges” :hocho: in GenJAX. If you have ideas for cookbook entries, please raise them in #opengen-dev and we’ll make a Linear issue tracking the problem. (For bonus points, send us a PR adding a new notebook to https://github.com/probcomp/genjax and we’ll help you get it merged.)

Here’s the current list. Bon appétit!

  1. Getting started](https://genjax.gen.dev/cookbook/)
  2. Introduction
  3. Generative functions
  4. Methods of generative functions
  5. Debugging
  6. Saving traces
  7. Some oddities
  8. Conditionals
  9. Iterating computations
  10. Mixture models
  11. Custom distributions
  12. Importance sampling
  13. Custom proposals
  14. Dimap combinator

New Combinators!

We have four new combinators on top of genjax.scan

genjax.reduce and genjax.accumulate let your generative function consume a sequence and either return the final value (genjax.reduce) or an array of all intermediate values seen (genjax.accumulate):

```python

import genjax import jax.numpy as jnp

@genjax.gen ... def add(carry, x): ... return carry + x ...

normal call

add.simulate(key, (0,2)).getretval() Array(2, dtype=int32, weaktype=True)

accumulate takes the initial accumulator AND a vector of new entries, then returns a vector of all accumulators seen:

add.accumulate().simulate(key, (0, jnp.ones(4))).get_retval() Array([1., 2., 3., 4.], dtype=float32)

reduce has the same sig but only returns the last value:

add.reduce().simulate(key, (0,jnp.ones(10)).get_retval() Array(10., dtype=float32) ```

Given some number n, genjax.iterate transforms a generative function f into a new function that applies f iteratively n times and returns an array containing each of f(init), f(f(init)), etc. genjax.iterate_final is similar but only returns the final value:

```python

@genjax.gen ... def inc(prev): ... return prev + 1 ...

normal call

inc.simulate(key, (0,)).getretval() Array(1, dtype=int32, weaktype=True)

iterate takes the initial value (same signature!) and returns a vector of [f(x), f(f(x)), ...]

inc.iterate(n=4).simulate(key, (0,)).getretval() Array([1, 2, 3, 4], dtype=int32, weaktype=True)

iterate_final gives you the final thing, no intermediates

inc.iteratefinal(n=10).simulate(key, (0,)).getretval() Array(10, dtype=int32, weak_type=True) ```

Combinator Improvements

Minor fixes

  • Export Address and AddressComponent from genjax._src.core.generative (GEN-315) by @sritchie in https://github.com/probcomp/genjax/pull/1194
  • Change minimum Python version to 3.10; have nox test versions 3.10, 3… by @littleredcomputer in https://github.com/probcomp/genjax/pull/1182
  • genjax.repeat was re-implemented used dimap and vmap, removing two extra levels of ChoiceMap in the print representation
  • Fix dimap extra tupling (GEN-338) by @sritchie in https://github.com/probcomp/genjax/pull/1199
  • Fix scan combinator docs by @sritchie in https://github.com/probcomp/genjax/pull/1172
  • Tidy Is condition for slightly better error messages by @sritchie in https://github.com/probcomp/genjax/pull/1189
  • kill dataclass type errors with typevar (GEN-337) by @sritchie in https://github.com/probcomp/genjax/pull/1193
  • make gfi_boundary preserve types (GEN-313, GEN-336) by @sritchie in https://github.com/probcomp/genjax/pull/1192
  • Update URLs to GenJAX website by @horizon-blue in https://github.com/probcomp/genjax/pull/1175

New Contributors

  • @horizon-blue made their first contribution in https://github.com/probcomp/genjax/pull/1175
  • @MathieuHuot made their first contribution in https://github.com/probcomp/genjax/pull/1140

Full Changelog: https://github.com/probcomp/genjax/compare/v0.4.0...v0.5.0

- Python
Published by sritchie almost 2 years ago

genjax - 0.4.0: Combinators, Studio, Mega-Changes

GenJAX 0.4.0 is here!

First, the basics of how to get the library, then notes on what's changed.

GenJAX's docs now live at https://genjax.gen.dev/. To see this site and get access to the released GenJAX, you'll need to be a member of the GenJAX-Users Google group. If you can't see this link, send a note to @sritchie asking him to add you.

How to get it:

To install GenJAX using pip:

bash pip install keyring keyrings.google-artifactregistry-auth pip install genjax --extra-index-url https://us-west1-python.pkg.dev/probcomp-caliban/probcomp/simple/

If you're using Poetry:

bash poetry self update && poetry self add keyrings.google-artifactregistry-auth poetry source add --priority=explicit gcp https://us-west1-python.pkg.dev/probcomp-caliban/probcomp/simple/ poetry add genjax --source gcp

Then install JAX using this guide to choose the command for the architecture you're targeting. To run GenJAX without GPU support:

sh pip install jax[cpu]==0.4.28

On a Linux machine with a GPU, run the following command:

sh pip install jax[cuda12]==0.4.28

Quick example Open In Colab

The following code snippet defines a generative function called beta_bernoulli that

  • takes a shape parameter beta
  • uses this to create and draw a value p from a Beta distribution
  • Flips a coin that returns 1 with probability p, 0 with probability 1-p and returns that value

Then, we create an inference problem (by specifying a posterior target), and utilize sampling importance resampling to give produce single sample estimator of p.

We can JIT compile that entire process, run it in parallel, etc - which we utilize to produce an estimate for p over 50 independent trials of SIR (with K = 50 particles).

```python import jax import jax.numpy as jnp import genjax from genjax import beta, flip, gen, Target, ChoiceMap from genjax.inference.smc import ImportanceK

Create a generative model.

@gen def beta_bernoulli(α, β): p = beta(α, β) @ "p" v = flip(p) @ "v" return v

@jax.jit def runinference(obs: bool): # Create an inference query - a posterior target - by specifying # the model, arguments to the model, and constraints. posteriortarget = Target(beta_bernoulli, # the model (2.0, 2.0), # arguments to the model ChoiceMap.d({"v": obs}), # constraints )

# Use a library algorithm, or design your own - more on that in the docs!
alg = ImportanceK(posterior_target, k_particles=50)

# Everything is JAX compatible by default.
# JIT, vmap, to your heart's content.
key = jax.random.PRNGKey(314159)
sub_keys = jax.random.split(key, 50)
_, p_chm = jax.vmap(alg.random_weighted, in_axes=(0, None))(
    sub_keys, posterior_target
)

# An estimate of `p` over 50 independent trials of SIR (with K = 50 particles).
return jnp.mean(p_chm["p"])

(runinference(True), runinference(False)) ```

python (Array(0.6039314, dtype=float32), Array(0.3679334, dtype=float32))

What's Changed in 0.4.0

GenJAX now uses @mhuebert 's genstudio library for the "Welcome to GenJAX" intro notebook!

To install genstudio, follow the instructions above for authentication, then sub in genstudio instead of genjax in the pip/Poetry installation commands.

  • The genjax.static_gen_fn decorator is now the simpler genjax.gen
  • genjax.console() is now genjax.pretty()
  • The signature of update changes from gen_fn.update(key, tr, choice_map, argdiffs) -> gen_fn.update(key, tr, update_problem). See documentation on update to understand what an "update problem" is.
  • The signature of importance changes from gen_fn.importance(key choice_map, args) -> gen_fn.importance(key, constraint, args). See documentation on importance to understand what a "constraint" is.
  • New ChoiceMapBuilder interface for building choice maps
  • New Selection interface for building selections
  • All combinators are now available as methods on GenerativeFunction:

    • vmap
    • repeat
    • scan
    • mask
    • or_else
    • switch
    • mix
    • map_addresses
    • dimap
    • map
    • contramap
    • All combinators are also available in decorator form. See the docs page for more detail.

PRs since the last release

  • Fix workflow caching by @sritchie in https://github.com/probcomp/genjax/pull/1111
  • Add Colab link, update install instructions by @sritchie in https://github.com/probcomp/genjax/pull/1112
  • Add propose as a derived method to GenerativeFunction. by @femtomc in https://github.com/probcomp/genjax/pull/1113
  • Fix assess in vmap_combinator and add a test case. by @femtomc in https://github.com/probcomp/genjax/pull/1115
  • Patch to fix importance error with address bijection combinator. by @femtomc in https://github.com/probcomp/genjax/pull/1116
  • Add Laplace distribution to standard library of distributions. by @femtomc in https://github.com/probcomp/genjax/pull/1121
  • Restore ExactDensity to avoid deprecation issues. by @femtomc in https://github.com/probcomp/genjax/pull/1122
  • A few Pyright fixes. by @femtomc in https://github.com/probcomp/genjax/pull/1123
  • Fix "missing import" pyright errors by @sritchie in https://github.com/probcomp/genjax/pull/1124
  • Aggressively collapse empty choice maps when constructing choice maps. by @femtomc in https://github.com/probcomp/genjax/pull/1118
  • Prune the information module, we can restore with tests later. by @femtomc in https://github.com/probcomp/genjax/pull/1125
  • Collapse one level of selection / choice map indirection by @femtomc in https://github.com/probcomp/genjax/pull/1126
  • Reorder fields in addr fn choice map. by @femtomc in https://github.com/probcomp/genjax/pull/1127
  • Documentation for GenJAX 0.4.0 by @femtomc in https://github.com/probcomp/genjax/pull/1117
  • fix inaxes typing, bug with _staticcheck_broadcastable by @sritchie in https://github.com/probcomp/genjax/pull/1128
  • Collapse argdiffs into UpdateProblem -- finally, a unified interface. by @femtomc in https://github.com/probcomp/genjax/pull/1129
  • Final documentation PR for 0.4.0 by @femtomc in https://github.com/probcomp/genjax/pull/1130
  • Migrate genjax repo static site to private site (GEN-184) by @mhuebert in https://github.com/probcomp/genjax/pull/1139
  • Enable pre-commit.ci integration by @sritchie in https://github.com/probcomp/genjax/pull/1144
  • Fix docs-serve command, add docs-build-serve by @sritchie in https://github.com/probcomp/genjax/pull/1145
  • Add note about application-default login vs login by @sritchie in https://github.com/probcomp/genjax/pull/1159
  • convert intro notebook to studio.plot by @mhuebert in https://github.com/probcomp/genjax/pull/1120
  • Fix pyright errors, ArrayLike => Array by @sritchie in https://github.com/probcomp/genjax/pull/1163
  • Update minimum python version by @sritchie in https://github.com/probcomp/genjax/pull/1165
  • Clarify types in combinator decorators and methods by @sritchie in https://github.com/probcomp/genjax/pull/1142
  • Tidy combinator decorators, types, various renames (GEN-206, GEN-205) by @sritchie in https://github.com/probcomp/genjax/pull/1168
  • Change "Open in Colab" to point to colab enterprise by @sritchie in https://github.com/probcomp/genjax/pull/1166

New Contributors

  • @mhuebert made their first contribution in https://github.com/probcomp/genjax/pull/1139

Full Changelog: https://github.com/probcomp/genjax/compare/v0.3.1...v0.4.0

- Python
Published by sritchie almost 2 years ago

genjax -

Fixed a bug involving a missing implementation of importance for RepeatCombinator

  • https://github.com/probcomp/genjax/pull/1086

Full Changelog: https://github.com/probcomp/genjax/compare/v0.3.0...v0.3.1

- Python
Published by littleredcomputer about 2 years ago

genjax - v0.3.0: new Selection interface

The centerpiece of this release is a new DSL for constructing the selections required by choice_map.filter and trace.project. All selections are now constructed via Selection.at.

See the Selection type documentation for examples of the new syntax.

Detailed notes

This release removes specialized Selection types (like HierarchicalSelection, IndexedSelection, etc) and clarifies what exactly an address is in GenJAX, and how addresses are constructed from static and dynamic components.

Selection is still used in the same way (e.g. choice_map.filter(...) and trace.project(...)).

The key functionality is extracted into a single function of signature has_addr :: AddressComponent -> Tuple[Bool, Selection] (roughly, a selection should be able to answer: do I have this address component, and, given this component, do I contain anything after it?)

The functional DSL for constructing selections is inspired by query languages, and has overloads which make expressing complicated selections concise. The DSL is implemented here.

There's new functionality, which includes the ability to create "masked" selections (convenient: the only thing which is affected by masking is the Bool returned in the has_addr signature).

There's also new functionality, due to the fact that the DSL is JAX compatible by default -- meaning that jax.vmap(...) on selections which select over dynamic addresses will implicitly create "or" selections across those addresses. By virtue of the JAX compatibility, vmap can be useful in other ways: * ChoiceMap authors can also vmap(...) the has_addr function of dynamic selections in their ChoiceMap.filter or Trace.project implementations. * Users can vmap(choice_map.filter, in_axes=...)(selection) to create multiple slices of a choice map, across dynamic indices.

- Python
Published by sritchie about 2 years ago

genjax - v0.2.1

What's Changed

  • Fix bugs in mask combinator by @georgematheos in https://github.com/probcomp/genjax/pull/955

Full Changelog: https://github.com/probcomp/genjax/compare/v0.2.0...v0.2.1

- Python
Published by littleredcomputer over 2 years ago

genjax - v0.2.0 "Revenge of the GenSP-ith"

What's Changed

  • Bump notebook from 6.5.4 to 6.5.6 by @dependabot in https://github.com/probcomp/genjax/pull/872
  • Bump rpds-py from 0.16.2 to 0.17.1 by @dependabot in https://github.com/probcomp/genjax/pull/873
  • Bump ruff from 0.1.11 to 0.1.13 by @dependabot in https://github.com/probcomp/genjax/pull/874
  • Add PyPI Badge by @sritchie in https://github.com/probcomp/genjax/pull/870
  • link interpreted Jupyter demo to doc tree. Some interpreted code golf. by @littleredcomputer in https://github.com/probcomp/genjax/pull/875
  • Restore abstract_call to distributions by @littleredcomputer in https://github.com/probcomp/genjax/pull/879
  • Minor modifications to interpreted notebook text by @georgematheos in https://github.com/probcomp/genjax/pull/878
  • Create SECURITY.md by @femtomc in https://github.com/probcomp/genjax/pull/882
  • Implement Pytree as equinox.Module. by @femtomc in https://github.com/probcomp/genjax/pull/881
  • Bump overrides from 7.5.0 to 7.6.0 by @dependabot in https://github.com/probcomp/genjax/pull/884
  • Added callee sugar inheritance to repeat combinarot #885 by @mirkoklukas in https://github.com/probcomp/genjax/pull/886
  • Fixes #888 avoiding an unfortuante combination of jaxtyping depend… by @littleredcomputer in https://github.com/probcomp/genjax/pull/889
  • Hotfix for part of #890 by @femtomc in https://github.com/probcomp/genjax/pull/891
  • Bump dill from 0.3.7 to 0.3.8 by @dependabot in https://github.com/probcomp/genjax/pull/893
  • Bump coverage from 7.4.0 to 7.4.1 by @dependabot in https://github.com/probcomp/genjax/pull/894
  • Fix diff bug related to lifting constants into Diff(..., NoChange) by @femtomc in https://github.com/probcomp/genjax/pull/895
  • add instructions for giving someone artifact registry access by @sritchie in https://github.com/probcomp/genjax/pull/898
  • Bump mkdocs-git-revision-date-localized-plugin from 1.2.2 to 1.2.4 by @dependabot in https://github.com/probcomp/genjax/pull/904
  • Bump platformdirs from 4.1.0 to 4.2.0 by @dependabot in https://github.com/probcomp/genjax/pull/905
  • Bump referencing from 0.32.1 to 0.33.0 by @dependabot in https://github.com/probcomp/genjax/pull/906
  • Bump ruff from 0.1.14 to 0.1.15 by @dependabot in https://github.com/probcomp/genjax/pull/907
  • Bump optax from 0.1.8 to 0.1.9 by @dependabot in https://github.com/probcomp/genjax/pull/910
  • Bump xdoctest from 1.1.2 to 1.1.3 by @dependabot in https://github.com/probcomp/genjax/pull/911
  • Bump nbmake from 1.4.6 to 1.5.0 by @dependabot in https://github.com/probcomp/genjax/pull/912
  • Bump urllib3 from 2.1.0 to 2.2.0 by @dependabot in https://github.com/probcomp/genjax/pull/913
  • Bump markupsafe from 2.1.4 to 2.1.5 by @dependabot in https://github.com/probcomp/genjax/pull/914
  • Bump griffe from 0.39.1 to 0.40.0 by @dependabot in https://github.com/probcomp/genjax/pull/915
  • Bump webfactory/ssh-agent from 0.8.0 to 0.9.0 by @dependabot in https://github.com/probcomp/genjax/pull/923
  • Bump ruamel-yaml from 0.18.5 to 0.18.6 by @dependabot in https://github.com/probcomp/genjax/pull/924
  • Bump ipykernel from 6.29.0 to 6.29.2 by @dependabot in https://github.com/probcomp/genjax/pull/925
  • Bump debugpy from 1.8.0 to 1.8.1 by @dependabot in https://github.com/probcomp/genjax/pull/926
  • Bump jaxlib from 0.4.23 to 0.4.24 by @dependabot in https://github.com/probcomp/genjax/pull/927
  • Bump jax from 0.4.23 to 0.4.24 by @dependabot in https://github.com/probcomp/genjax/pull/928
  • Bump appnope from 0.1.3 to 0.1.4 by @dependabot in https://github.com/probcomp/genjax/pull/929
  • Bump numpy from 1.26.3 to 1.26.4 by @dependabot in https://github.com/probcomp/genjax/pull/930
  • Bump griffe from 0.40.0 to 0.40.1 by @dependabot in https://github.com/probcomp/genjax/pull/931
  • Bump fonttools from 4.47.2 to 4.48.1 by @dependabot in https://github.com/probcomp/genjax/pull/932
  • Remove accidental test secret printout by @sritchie in https://github.com/probcomp/genjax/pull/935
  • Bump watchdog from 3.0.0 to 4.0.0 by @dependabot in https://github.com/probcomp/genjax/pull/933
  • Bump pytz from 2023.3.post1 to 2024.1 by @dependabot in https://github.com/probcomp/genjax/pull/908
  • Bump certifi from 2023.11.17 to 2024.2.2 by @dependabot in https://github.com/probcomp/genjax/pull/909
  • Bump gitpython from 3.1.41 to 3.1.42 by @dependabot in https://github.com/probcomp/genjax/pull/940
  • Bump matplotlib from 3.8.2 to 3.8.3 by @dependabot in https://github.com/probcomp/genjax/pull/941
  • Bump urllib3 from 2.2.0 to 2.2.1 by @dependabot in https://github.com/probcomp/genjax/pull/942
  • Bump rpds-py from 0.17.1 to 0.18.0 by @dependabot in https://github.com/probcomp/genjax/pull/944
  • Bump fonttools from 4.48.1 to 4.49.0 by @dependabot in https://github.com/probcomp/genjax/pull/945
  • Bump setuptools from 69.0.3 to 69.1.0 by @dependabot in https://github.com/probcomp/genjax/pull/946
  • New inference core: "Episode v0: Revenge of the GenSP-ith" by @femtomc in https://github.com/probcomp/genjax/pull/917
  • restore @intepreted and @static with deprecation warnings for v0.1.2 by @littleredcomputer in https://github.com/probcomp/genjax/pull/900
  • Fix type annotation for MapCombinator.assess by @jburnim in https://github.com/probcomp/genjax/pull/937
  • v0.2.0 "Revenge of the GenSP-ith" by @femtomc in https://github.com/probcomp/genjax/pull/949
  • Update CHANGELOG. by @femtomc in https://github.com/probcomp/genjax/pull/951

New Contributors

  • @georgematheos made their first contribution in https://github.com/probcomp/genjax/pull/878
  • @mirkoklukas made their first contribution in https://github.com/probcomp/genjax/pull/886

Full Changelog: https://github.com/probcomp/genjax/compare/v0.1.1...v0.2.0

- Python
Published by femtomc over 2 years ago

genjax - v0.1.1: miniclass bugfix release

What's Changed

  • lowercase name, artifact registry deploy (#897)
  • Fix incremental for constants in Jaxpr (#895)
  • Bugfix for #890 (#891)
  • Fix issue 888 avoiding an unfortuante combination of jaxtyping dependency constraints (#896)

Full Changelog: https://github.com/probcomp/genjax/compare/v0.1.0...v0.1.1

- Python
Published by littleredcomputer over 2 years ago

genjax - 0.1.0: A New Hope

0.1.0 marks the first versioned GenJAX release. From this version forward, look to CHANGELOG.md for changes, and to each new version release for a proper migration guide.

Onward!

What's Changed

  • Remove automerge. by @femtomc in https://github.com/probcomp/genjax/pull/31
  • Propagation interpreter enables incremental computation. by @femtomc in https://github.com/probcomp/genjax/pull/98
  • Mrb/incremental by @femtomc in https://github.com/probcomp/genjax/pull/99
  • exporting beta distribution by @Joaoloula in https://github.com/probcomp/genjax/pull/216
  • Exporting categorical by @Joaoloula in https://github.com/probcomp/genjax/pull/211
  • Mrb/fix switch tracing by @femtomc in https://github.com/probcomp/genjax/pull/384
  • Fix PytreeClosure construction to correctly register concrete argumen… by @femtomc in https://github.com/probcomp/genjax/pull/387
  • Support pytree in in_axes for genjax.Map. by @midfield in https://github.com/probcomp/genjax/pull/400
  • Remove PytreeClosure, make closure conversion an opt-in decorator (DynamicClosure). by @femtomc in https://github.com/probcomp/genjax/pull/403
  • Support RH batch dimensions in SwitchChoiceMap indexing. by @midfield in https://github.com/probcomp/genjax/pull/410
  • SIR with custom proposal function by @limarta in https://github.com/probcomp/genjax/pull/408
  • Mrb/rif hotfixes by @femtomc in https://github.com/probcomp/genjax/pull/412
  • (Hotfix, 415): off-by-one error in Unfold. by @femtomc in https://github.com/probcomp/genjax/pull/416
  • Vector combinators defactor by @femtomc in https://github.com/probcomp/genjax/pull/413
  • Fix Map.update for #407. by @femtomc in https://github.com/probcomp/genjax/pull/425
  • Fix intro notebook links by @sritchie in https://github.com/probcomp/genjax/pull/429
  • Tests exposing switch_combinator update fails because of BooleanMask … by @derifatives in https://github.com/probcomp/genjax/pull/428
  • Refactor ChoiceMap merge interface -- to return new + discard by @femtomc in https://github.com/probcomp/genjax/pull/432
  • Starter implementation of a convenience StateSpaceCombinator by @femtomc in https://github.com/probcomp/genjax/pull/433
  • Optimize compile times via __abstract_call__ by @femtomc in https://github.com/probcomp/genjax/pull/441
  • Initial implementation of genjax.gentle. by @femtomc in https://github.com/probcomp/genjax/pull/442
  • Mrb/gentle by @femtomc in https://github.com/probcomp/genjax/pull/443
  • Mrb/compile times by @femtomc in https://github.com/probcomp/genjax/pull/444
  • The great key migration. by @femtomc in https://github.com/probcomp/genjax/pull/454
  • Add codepath to promote integers to arrays in IndexChoiceMap.new by @femtomc in https://github.com/probcomp/genjax/pull/457
  • The great SLAM bug squash. by @femtomc in https://github.com/probcomp/genjax/pull/460
  • Rewrite unfold importance to fix #463 by @derifatives in https://github.com/probcomp/genjax/pull/464
  • Prototype of reverse mode ADEV. by @femtomc in https://github.com/probcomp/genjax/pull/520
  • Interpreter defactor, trace translators, & GRASP by @femtomc in https://github.com/probcomp/genjax/pull/703
  • Restore introtogenjax notebook to executability by @littleredcomputer in https://github.com/probcomp/genjax/pull/744
  • port all unit tests from Static to Interpreted language by @littleredcomputer in https://github.com/probcomp/genjax/pull/757
  • Use poetry to create version numbers by @littleredcomputer in https://github.com/probcomp/genjax/pull/792
  • remove LanguageConstructor and lang(). Decorators act directly by @littleredcomputer in https://github.com/probcomp/genjax/pull/803
  • Tidy README, actions, add DEVELOPING.md by @sritchie in https://github.com/probcomp/genjax/pull/815
  • fix some loose ends from #803 by @littleredcomputer in https://github.com/probcomp/genjax/pull/817
  • Add pre-commit hooks for black, file formatting by @sritchie in https://github.com/probcomp/genjax/pull/816
  • Enable ruff linter, fix all lint warnings, disable the rest by @sritchie in https://github.com/probcomp/genjax/pull/818
  • Fix noxfile linting step by @sritchie in https://github.com/probcomp/genjax/pull/821
  • Replace .new methods with @dataclass init methods. by @littleredcomputer in https://github.com/probcomp/genjax/pull/820
  • Big bump to documentation. by @femtomc in https://github.com/probcomp/genjax/pull/822
  • Document release process, prepare pyproject.toml for release by @sritchie in https://github.com/probcomp/genjax/pull/823
  • Fix CI by pinning Python version by @sritchie in https://github.com/probcomp/genjax/pull/824
  • Revert README logo change by @sritchie in https://github.com/probcomp/genjax/pull/825
  • Update poetry.lock, pyproject.toml docs settings by @sritchie in https://github.com/probcomp/genjax/pull/832
  • Ignore site folder for docs generation by @sritchie in https://github.com/probcomp/genjax/pull/834
  • Build and deploy docs via GitHub Action by @sritchie in https://github.com/probcomp/genjax/pull/836
  • Add pypi release GitHub Action by @sritchie in https://github.com/probcomp/genjax/pull/837
  • Run pre-commit hooks by @sritchie in https://github.com/probcomp/genjax/pull/846
  • The remainder of the new rewrites. by @littleredcomputer in https://github.com/probcomp/genjax/pull/826
  • Run Ruff on Jupyter notebooks by @sritchie in https://github.com/probcomp/genjax/pull/848
  • fix json comma by @littleredcomputer in https://github.com/probcomp/genjax/pull/849
  • Run Jupyter notebooks in CI by @sritchie in https://github.com/probcomp/genjax/pull/847
  • fix docs build by @littleredcomputer in https://github.com/probcomp/genjax/pull/853
  • Update notebook index by @sritchie in https://github.com/probcomp/genjax/pull/852
  • Run notebooks on docs deploy, strip cell output in pre-commit by @sritchie in https://github.com/probcomp/genjax/pull/854
  • fix a warning by @littleredcomputer in https://github.com/probcomp/genjax/pull/855
  • Test docs in CI, all docs in strict mode by @sritchie in https://github.com/probcomp/genjax/pull/856
  • documentation and interpreted node demo notebook by @littleredcomputer in https://github.com/probcomp/genjax/pull/844
  • Prepare for 0.1.0 release by @sritchie in https://github.com/probcomp/genjax/pull/865
  • Split sugar callee methods into __call__ and apply. by @littleredcomputer in https://github.com/probcomp/genjax/pull/857
  • The Great Combinator Renaming by @littleredcomputer in https://github.com/probcomp/genjax/pull/867

New Contributors

  • Welcome to @littleredcomputer!
  • @Joaoloula made their first contribution in https://github.com/probcomp/genjax/pull/216
  • @midfield made their first contribution in https://github.com/probcomp/genjax/pull/395
  • @limarta made their first contribution in https://github.com/probcomp/genjax/pull/408
  • @sritchie made their first contribution in https://github.com/probcomp/genjax/pull/429
  • @derifatives made their first contribution in https://github.com/probcomp/genjax/pull/428

Full Changelog: https://github.com/probcomp/genjax/commits/v0.1.0

- Python
Published by sritchie over 2 years ago