Announcing Squigglepy, a Python package for Squiggle

By Peter Wildeford @ 2022-10-19T18:34 (+90)

This is a linkpost to https://github.com/rethinkpriorities/squigglepy

Squiggle is a "simple programming language for intuitive probabilistic estimation". It serves as its own standalone programming language with its own syntax, but it is implemented in JavaScript.

I like the features of Squiggle and intend to use it frequently, but I also frequently want to use similar functionalities in Python, especially alongside other Python statistical programming packages like Numpy, Pandas, and Matplotlib.

The squigglepy package here implements many Squiggle-like functionalities in Python.

The package also has useful utility functions for Bayesian networks (using rejection sampling), pooling forecasts (via weighted geometric mean of odds and others), laplace (including the time-invariant version), and kelly betting.

The package and documentation are available on GitHub.

The package can be downloaded from Pypi using pip install squigglepy.

This package is unofficial and supported by myself and Rethink Priorities. It is not affiliated with or associated with the Quantified Uncertainty Research Institute, which maintains the Squiggle language (in JavaScript).

This package is also new and not yet in a stable production version, so you may encounter bugs and other errors. Please report those so they can be fixed. It's also possible that future versions of the package may introduce breaking changes.

This package is available under an MIT license.


Dawn Drescher @ 2022-10-19T19:27 (+14)

So cool! Strong upvote!

I also created a Python implementation of Squiggle with a very similar name! I’m unlikely to maintain it further since I’ve ended up focusing on impact markets. But maybe you can find something interesting in there to copy-paste into your version.

Peter Wildeford @ 2022-10-19T20:01 (+9)

Oh thanks! Sorry I didn't know about this. But with your permission I will look for things that I will copy into the package and I will credit you for those additions. Please let me know if I don't have permission to do that.

Dawn Drescher @ 2022-10-19T21:52 (+11)

You have all the permissions! I’d be delighted if it turns out my couple weeks of coding back then had more than exploratory value. :-D

Generally my hope is that Squiggle will allow us to combine the big-picture long-term thinking of current EA with the focus on quantification and interval-scale-based prioritization of < 2015 EA.

That it will be used by anyone who has to model something. That they’ll contribute their models back to some central repository. That we’ll get to recombine all these models and build exponentially more powerful ones from them with constant development time. That eventually our models will become powerful enough to capture the real world in all its relevant complexity.

I still find this vision inspiring. I just feel a lot of urgency about AGI for now, and impact markets seem more directly relevant to that.

Peter Wildeford @ 2022-10-21T05:07 (+7)

I used your tech to launch a new version of Squigglepy that lets you use ~ and @ as shorthand to sample and lets you add, subtract, etc. distributions directly without having to sample inbetween!

Dawn Drescher @ 2022-10-21T12:29 (+2)

😍🥳

BrownHairedEevee @ 2022-10-20T04:06 (+4)

Yeah, a "SquiggleHub" would be nice.

Dawn Drescher @ 2022-10-20T10:33 (+2)

Yes! The Python implementation can just use PyPI, but I imagine something custom is needed to support Squiggle models based on other interpreters.

Joseph Bloom @ 2022-10-21T21:08 (+3)

Thanks so much! Was hoping someone would do this soon!