Skip to content

Commit

Permalink
Add coix tutorials (#18)
Browse files Browse the repository at this point in the history
* Added tutorial notebooks

* Fixed typos and bug (changed factor to unit node) in tutorial 2

* fixed formating

* fixed indentation and issue with level-one headlines

* Changes order of tutorials

* .

* fixed doc generation

* Update README

* .

* delete empty cell

* changes proposed in comments

---------

Co-authored-by: Du Phan <[email protected]>
  • Loading branch information
zmheiko and fehiepsi authored Mar 27, 2024
1 parent 709f9e6 commit 766b9ca
Show file tree
Hide file tree
Showing 8 changed files with 2,090 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
docs/notebooks

# Compiled python modules.
*.pyc

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
[![Documentation Status](https://readthedocs.org/projects/coix/badge/?version=latest)](https://coix.readthedocs.io/en/latest/?badge=latest)
[![PyPI version](https://badge.fury.io/py/coix.svg)](https://badge.fury.io/py/coix)

Inference Combinators in JAX (Coix) is a machine learning framework used to
develop inference algorithms that are composed of probabilistic programs.
Coix (COmbinators In jaX) is a flexible and backend-agnostic implementation of inference combinators [(Stites and Zimmermann et al., 2021)](https://arxiv.org/abs/2103.00668), a set of program transformations for compositional inference with probabilistic programs. Coix ships with backends for numpyro and oryx, and a set of pre-implemented losses and utility functions that allows to implement and run a wide variety of inference algorithms out-of-the-box.

*This is not an officially supported Google product.*

15 changes: 11 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,18 @@

# -- Copy notebook files

if not os.path.exists("tutorials"):
os.makedirs("tutorials")
if not os.path.exists("notebooks"):
os.makedirs("notebooks")

if not os.path.exists("notebooks/figures"):
os.makedirs("notebooks/figures")

for src_file in glob.glob("../notebooks/*.ipynb"):
shutil.copy(src_file, "tutorials/")
shutil.copy(src_file, "notebooks/")

for src_file in glob.glob("../notebooks/figures/*"):
shutil.copy(src_file, "notebooks/figures/")


# add index file to `notebooks` path, `:orphan:` is used to
# tell sphinx that this rst file needs not to be appeared in toctree
Expand Down Expand Up @@ -198,7 +205,7 @@
for src_file in glob.glob("../notebooks/*.ipynb") + glob.glob(
"../examples/*.py"
):
toctree_path = "tutorials/" if src_file.endswith("ipynb") else "examples/"
toctree_path = "notebooks/" if src_file.endswith("ipynb") else "examples/"
filename = os.path.splitext(src_file.split("/")[-1])[0]
png_path = "_static/img/" + toctree_path + filename + ".png"
# use Coix logo if not exist png file
Expand Down
3 changes: 3 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Coix Documentation
:caption: Tutorials and Examples
:name: tutorials

notebooks/tutorial_part1_vae
notebooks/tutorial_part2_api
notebooks/tutorial_part3_smcs
examples/anneal
examples/anneal_oryx
examples/gmm_oryx
Expand Down
Binary file added notebooks/figures/smcs_nvi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
436 changes: 436 additions & 0 deletions notebooks/tutorial_part1_vae.ipynb

Large diffs are not rendered by default.

1,044 changes: 1,044 additions & 0 deletions notebooks/tutorial_part2_api.ipynb

Large diffs are not rendered by default.

593 changes: 593 additions & 0 deletions notebooks/tutorial_part3_smcs.ipynb

Large diffs are not rendered by default.

0 comments on commit 766b9ca

Please sign in to comment.