Skip to content

Commit 6c9e72a

Browse files
committed
docs: include frozen cell output in docs
1 parent bc6d954 commit 6c9e72a

File tree

14 files changed

+87
-0
lines changed

14 files changed

+87
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"hash": "94e4388705073729b94725a15410d650",
3+
"result": {
4+
"engine": "jupyter",
5+
"markdown": "---\ntitle: Nutpie Documentation\n---\n\n\n\n`nutpie` is a high-performance library designed for Bayesian inference, that\nprovides efficient sampling algorithms for probabilistic models. It can sample\nmodels that are defined in PyMC or Stan (numpyro and custom hand-coded\nlikelihoods with gradient are coming soon).\n\n- Faster sampling than either the PyMC or Stan default samplers. (An average\n ~2x speedup on `posteriordb` compared to Stan)\n- All the diagnostic information of PyMC and Stan and some more.\n- GPU support for PyMC models through jax.\n- A more informative progress bar.\n- Access to the incomplete trace during sampling.\n- *Experimental* normalizing flow adaptation for more efficient sampling of\n difficult posteriors.\n\n## Quickstart: PyMC\n\nInstall `nutpie` with pip, uv, pixi, or conda:\n\nFor usage with pymc:\n\n```bash\n# One of\npip install \"nutpie[pymc]\"\nuv add \"nutpie[pymc]\"\npixi add nutpie pymc numba\nconda install -c conda-forge nutpie pymc numba\n```\n\nAnd then sample with\n\n\n::: {#1c2d97ba .cell execution_count=1}\n``` {.python .cell-code}\nimport nutpie\nimport pymc as pm\n\nwith pm.Model() as model:\n mu = pm.Normal(\"mu\", mu=0, sigma=1)\n obs = pm.Normal(\"obs\", mu=mu, sigma=1, observed=[1, 2, 3])\n\ncompiled = nutpie.compile_pymc_model(model)\ntrace = nutpie.sample(compiled)\n```\n\n::: {.cell-output .cell-output-display}\n```{=html}\n\n<style>\n :root {\n --column-width-1: 40%; /* Progress column width */\n --column-width-2: 15%; /* Chain column width */\n --column-width-3: 15%; /* Divergences column width */\n --column-width-4: 15%; /* Step Size column width */\n --column-width-5: 15%; /* Gradients/Draw column width */\n }\n\n .nutpie {\n max-width: 800px;\n margin: 10px auto;\n font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n //color: #333;\n //background-color: #fff;\n padding: 10px;\n box-shadow: 0 4px 6px rgba(0,0,0,0.1);\n border-radius: 8px;\n font-size: 14px; /* Smaller font size for a more compact look */\n }\n .nutpie table {\n width: 100%;\n border-collapse: collapse; /* Remove any extra space between borders */\n }\n .nutpie th, .nutpie td {\n padding: 8px 10px; /* Reduce padding to make table more compact */\n text-align: left;\n border-bottom: 1px solid #888;\n }\n .nutpie th {\n //background-color: #f0f0f0;\n }\n\n .nutpie th:nth-child(1) { width: var(--column-width-1); }\n .nutpie th:nth-child(2) { width: var(--column-width-2); }\n .nutpie th:nth-child(3) { width: var(--column-width-3); }\n .nutpie th:nth-child(4) { width: var(--column-width-4); }\n .nutpie th:nth-child(5) { width: var(--column-width-5); }\n\n .nutpie progress {\n width: 100%;\n height: 15px; /* Smaller progress bars */\n border-radius: 5px;\n }\n progress::-webkit-progress-bar {\n background-color: #eee;\n border-radius: 5px;\n }\n progress::-webkit-progress-value {\n background-color: #5cb85c;\n border-radius: 5px;\n }\n progress::-moz-progress-bar {\n background-color: #5cb85c;\n border-radius: 5px;\n }\n .nutpie .progress-cell {\n width: 100%;\n }\n\n .nutpie p strong { font-size: 16px; font-weight: bold; }\n\n @media (prefers-color-scheme: dark) {\n .nutpie {\n //color: #ddd;\n //background-color: #1e1e1e;\n box-shadow: 0 4px 6px rgba(0,0,0,0.2);\n }\n .nutpie table, .nutpie th, .nutpie td {\n border-color: #555;\n color: #ccc;\n }\n .nutpie th {\n background-color: #2a2a2a;\n }\n .nutpie progress::-webkit-progress-bar {\n background-color: #444;\n }\n .nutpie progress::-webkit-progress-value {\n background-color: #3178c6;\n }\n .nutpie progress::-moz-progress-bar {\n background-color: #3178c6;\n }\n }\n</style>\n```\n:::\n\n::: {.cell-output .cell-output-display}\n```{=html}\n\n<div class=\"nutpie\">\n <p><strong>Sampler Progress</strong></p>\n <p>Total Chains: <span id=\"total-chains\">6</span></p>\n <p>Active Chains: <span id=\"active-chains\">0</span></p>\n <p>\n Finished Chains:\n <span id=\"active-chains\">6</span>\n </p>\n <p>Sampling for now</p>\n <p>\n Estimated Time to Completion:\n <span id=\"eta\">now</span>\n </p>\n\n <progress\n id=\"total-progress-bar\"\n max=\"8400\"\n value=\"8400\">\n </progress>\n <table>\n <thead>\n <tr>\n <th>Progress</th>\n <th>Draws</th>\n <th>Divergences</th>\n <th>Step Size</th>\n <th>Gradients/Draw</th>\n </tr>\n </thead>\n <tbody id=\"chain-details\">\n \n <tr>\n <td class=\"progress-cell\">\n <progress\n max=\"1400\"\n value=\"1400\">\n </progress>\n </td>\n <td>1400</td>\n <td>0</td>\n <td>1.35</td>\n <td>1</td>\n </tr>\n \n <tr>\n <td class=\"progress-cell\">\n <progress\n max=\"1400\"\n value=\"1400\">\n </progress>\n </td>\n <td>1400</td>\n <td>0</td>\n <td>1.28</td>\n <td>3</td>\n </tr>\n \n <tr>\n <td class=\"progress-cell\">\n <progress\n max=\"1400\"\n value=\"1400\">\n </progress>\n </td>\n <td>1400</td>\n <td>0</td>\n <td>1.29</td>\n <td>3</td>\n </tr>\n \n <tr>\n <td class=\"progress-cell\">\n <progress\n max=\"1400\"\n value=\"1400\">\n </progress>\n </td>\n <td>1400</td>\n <td>0</td>\n <td>1.23</td>\n <td>3</td>\n </tr>\n \n <tr>\n <td class=\"progress-cell\">\n <progress\n max=\"1400\"\n value=\"1400\">\n </progress>\n </td>\n <td>1400</td>\n <td>0</td>\n <td>1.40</td>\n <td>3</td>\n </tr>\n \n <tr>\n <td class=\"progress-cell\">\n <progress\n max=\"1400\"\n value=\"1400\">\n </progress>\n </td>\n <td>1400</td>\n <td>0</td>\n <td>1.28</td>\n <td>1</td>\n </tr>\n \n </tr>\n </tbody>\n </table>\n</div>\n```\n:::\n:::\n\n\nFor more information, see the detailed [PyMC usage guide](pymc-usage.qmd).\n\n## Quickstart: Stan\n\nStan needs access to a compiler toolchain, you can find instructions for those\n[here](https://mc-stan.org/docs/cmdstan-guide/installation.html#cpp-toolchain).\nYou can then install nutpie through pip or uv:\n\n```bash\n# One of\npip install \"nutpie[stan]\"\nuv add \"nutpie[stan]\"\n```\n\n\n\n::: {#700ed270 .cell execution_count=3}\n``` {.python .cell-code}\nimport nutpie\n\nmodel = \"\"\"\ndata {\n int<lower=0> N;\n vector[N] y;\n}\nparameters {\n real mu;\n}\nmodel {\n mu ~ normal(0, 1);\n y ~ normal(mu, 1);\n}\n\"\"\"\n\ncompiled = (\n nutpie\n .compile_stan_model(code=model)\n .with_data(N=3, y=[1, 2, 3])\n)\ntrace = nutpie.sample(compiled)\n```\n\n::: {.cell-output .cell-output-display}\n```{=html}\n\n<style>\n :root {\n --column-width-1: 40%; /* Progress column width */\n --column-width-2: 15%; /* Chain column width */\n --column-width-3: 15%; /* Divergences column width */\n --column-width-4: 15%; /* Step Size column width */\n --column-width-5: 15%; /* Gradients/Draw column width */\n }\n\n .nutpie {\n max-width: 800px;\n margin: 10px auto;\n font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n //color: #333;\n //background-color: #fff;\n padding: 10px;\n box-shadow: 0 4px 6px rgba(0,0,0,0.1);\n border-radius: 8px;\n font-size: 14px; /* Smaller font size for a more compact look */\n }\n .nutpie table {\n width: 100%;\n border-collapse: collapse; /* Remove any extra space between borders */\n }\n .nutpie th, .nutpie td {\n padding: 8px 10px; /* Reduce padding to make table more compact */\n text-align: left;\n border-bottom: 1px solid #888;\n }\n .nutpie th {\n //background-color: #f0f0f0;\n }\n\n .nutpie th:nth-child(1) { width: var(--column-width-1); }\n .nutpie th:nth-child(2) { width: var(--column-width-2); }\n .nutpie th:nth-child(3) { width: var(--column-width-3); }\n .nutpie th:nth-child(4) { width: var(--column-width-4); }\n .nutpie th:nth-child(5) { width: var(--column-width-5); }\n\n .nutpie progress {\n width: 100%;\n height: 15px; /* Smaller progress bars */\n border-radius: 5px;\n }\n progress::-webkit-progress-bar {\n background-color: #eee;\n border-radius: 5px;\n }\n progress::-webkit-progress-value {\n background-color: #5cb85c;\n border-radius: 5px;\n }\n progress::-moz-progress-bar {\n background-color: #5cb85c;\n border-radius: 5px;\n }\n .nutpie .progress-cell {\n width: 100%;\n }\n\n .nutpie p strong { font-size: 16px; font-weight: bold; }\n\n @media (prefers-color-scheme: dark) {\n .nutpie {\n //color: #ddd;\n //background-color: #1e1e1e;\n box-shadow: 0 4px 6px rgba(0,0,0,0.2);\n }\n .nutpie table, .nutpie th, .nutpie td {\n border-color: #555;\n color: #ccc;\n }\n .nutpie th {\n background-color: #2a2a2a;\n }\n .nutpie progress::-webkit-progress-bar {\n background-color: #444;\n }\n .nutpie progress::-webkit-progress-value {\n background-color: #3178c6;\n }\n .nutpie progress::-moz-progress-bar {\n background-color: #3178c6;\n }\n }\n</style>\n```\n:::\n\n::: {.cell-output .cell-output-display}\n```{=html}\n\n<div class=\"nutpie\">\n <p><strong>Sampler Progress</strong></p>\n <p>Total Chains: <span id=\"total-chains\">6</span></p>\n <p>Active Chains: <span id=\"active-chains\">0</span></p>\n <p>\n Finished Chains:\n <span id=\"active-chains\">6</span>\n </p>\n <p>Sampling for now</p>\n <p>\n Estimated Time to Completion:\n <span id=\"eta\">now</span>\n </p>\n\n <progress\n id=\"total-progress-bar\"\n max=\"8400\"\n value=\"8400\">\n </progress>\n <table>\n <thead>\n <tr>\n <th>Progress</th>\n <th>Draws</th>\n <th>Divergences</th>\n <th>Step Size</th>\n <th>Gradients/Draw</th>\n </tr>\n </thead>\n <tbody id=\"chain-details\">\n \n <tr>\n <td class=\"progress-cell\">\n <progress\n max=\"1400\"\n value=\"1400\">\n </progress>\n </td>\n <td>1400</td>\n <td>0</td>\n <td>1.29</td>\n <td>1</td>\n </tr>\n \n <tr>\n <td class=\"progress-cell\">\n <progress\n max=\"1400\"\n value=\"1400\">\n </progress>\n </td>\n <td>1400</td>\n <td>0</td>\n <td>1.27</td>\n <td>3</td>\n </tr>\n \n <tr>\n <td class=\"progress-cell\">\n <progress\n max=\"1400\"\n value=\"1400\">\n </progress>\n </td>\n <td>1400</td>\n <td>0</td>\n <td>1.34</td>\n <td>3</td>\n </tr>\n \n <tr>\n <td class=\"progress-cell\">\n <progress\n max=\"1400\"\n value=\"1400\">\n </progress>\n </td>\n <td>1400</td>\n <td>0</td>\n <td>1.33</td>\n <td>1</td>\n </tr>\n \n <tr>\n <td class=\"progress-cell\">\n <progress\n max=\"1400\"\n value=\"1400\">\n </progress>\n </td>\n <td>1400</td>\n <td>0</td>\n <td>1.41</td>\n <td>3</td>\n </tr>\n \n <tr>\n <td class=\"progress-cell\">\n <progress\n max=\"1400\"\n value=\"1400\">\n </progress>\n </td>\n <td>1400</td>\n <td>0</td>\n <td>1.29</td>\n <td>3</td>\n </tr>\n \n </tr>\n </tbody>\n </table>\n</div>\n```\n:::\n:::\n\n\nFor more information, see the detailed [Stan usage guide](stan-usage.qmd).\n\n",
6+
"supporting": [
7+
"index_files"
8+
],
9+
"filters": [],
10+
"includes": {
11+
"include-in-header": [
12+
"<script src=\"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js\" integrity=\"sha512-c3Nl8+7g4LMSTdrm621y7kf9v3SDPnhxLNhcjFJbKECVnmZHTdo+IRO05sNLTH/D3vA6u1X32ehoLC7WFVdheg==\" crossorigin=\"anonymous\"></script>\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js\" integrity=\"sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==\" crossorigin=\"anonymous\" data-relocate-top=\"true\"></script>\n<script type=\"application/javascript\">define('jquery', [],function() {return window.jQuery;})</script>\n"
13+
]
14+
}
15+
}
16+
}

docs/_freeze/nf-adapt/execute-results/html.json

+16
Large diffs are not rendered by default.

docs/_freeze/pymc-usage/execute-results/html.json

+16
Large diffs are not rendered by default.
Loading

docs/_freeze/sample-stats/execute-results/html.json

+16
Large diffs are not rendered by default.
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)