Skip to content

Commit

Permalink
fix website rendering (pymc-devs#540)
Browse files Browse the repository at this point in the history
* update conf.py to updated versions

* update rtd config

* Use older versions

* fix requirements

* try newer versions with older ablog
  • Loading branch information
OriolAbril authored Apr 6, 2023
1 parent f33145a commit cb142b4
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 55 deletions.
6 changes: 5 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ version: 2
sphinx:
configuration: examples/conf.py

build:
os: ubuntu-22.04
tools:
python: "3.10"

python:
version: "3.8"
install:
- requirements: requirements-docs.txt
5 changes: 4 additions & 1 deletion _templates/nb-badges.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{% if pagename in ablog %}

<!-- Generate correct links and render github/binder/colab badges -->
{% set gh_basepath = github_user + '/' + github_repo + '/blob/' + github_version + '/' %}
{% set encoded_base = github_user + '%252F' + github_repo %}
{% set gh_binder = github_user + '/' + github_repo + '/' + github_version %}
{% set doc_path_aux = doc_path | trim('/') %}
{% set file_path = doc_path_aux + '/' + pagename + page_source_suffix %}
{% set file_path = doc_path_aux + '/' + pagename + ".ipynb" %}
{% set encoded_path = file_path | replace("/", "%252F") %}


Expand All @@ -19,3 +21,4 @@
<img src="{{ pathto('_static/colab.svg', 1) }}" alt="Open In Colab"/></a>
</p>
</div>
{% endif %}
26 changes: 0 additions & 26 deletions _templates/page.html

This file was deleted.

13 changes: 13 additions & 0 deletions _templates/rendered_citation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- continuation of examples/page_footer.md -->
{% if pagename in ablog %}
{% set post = ablog[pagename] %}
{% for coll in post.author %}
{% if coll|length %}
{{ coll }}
{% if loop.index < post.author | length %},{% endif %}
{% else %}
{{ coll }}
{% if loop.index < post.author | length %},{% endif %}
{% endif %}
{% endfor %}. "{{ title.split(' — ')[0] }}". In: <i>PyMC Examples</i>. Ed. by PyMC Team. DOI: <a href={{ doi_url }}>{{ doi_code }}</a>
{% endif %}
74 changes: 51 additions & 23 deletions examples/case_studies/bart_heteroscedasticity.ipynb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "domestic-remove",
"metadata": {},
Expand All @@ -10,14 +9,13 @@
"# Modeling Heteroscedasticity with BART\n",
"\n",
":::{post} January, 2023\n",
":tags: bart regression \n",
":tags: BART, regression\n",
":category: beginner, reference\n",
":author: [Juan Orduz](https://juanitorduz.github.io/)\n",
":author: Juan Orduz\n",
":::"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "72588976-efc3-4adc-bec2-bc5b6ac4b7e1",
"metadata": {},
Expand Down Expand Up @@ -60,7 +58,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "4cae4407",
"metadata": {},
Expand Down Expand Up @@ -167,7 +164,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "6d6364a9",
"metadata": {},
Expand Down Expand Up @@ -206,7 +202,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "5c3971f2",
"metadata": {},
Expand All @@ -215,7 +210,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "e8a3ce48",
"metadata": {},
Expand All @@ -237,7 +231,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "a29b706c",
"metadata": {},
Expand All @@ -253,7 +246,52 @@
"outputs": [
{
"data": {
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.50.0 (0)\n -->\n<!-- Pages: 1 -->\n<svg width=\"138pt\" height=\"260pt\"\n viewBox=\"0.00 0.00 138.00 259.91\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 255.91)\">\n<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-255.91 134,-255.91 134,4 -4,4\"/>\n<g id=\"clust1\" class=\"cluster\">\n<title>cluster2 x 200</title>\n<path fill=\"none\" stroke=\"black\" d=\"M20,-129.95C20,-129.95 110,-129.95 110,-129.95 116,-129.95 122,-135.95 122,-141.95 122,-141.95 122,-231.91 122,-231.91 122,-237.91 116,-243.91 110,-243.91 110,-243.91 20,-243.91 20,-243.91 14,-243.91 8,-237.91 8,-231.91 8,-231.91 8,-141.95 8,-141.95 8,-135.95 14,-129.95 20,-129.95\"/>\n<text text-anchor=\"middle\" x=\"93\" y=\"-137.75\" font-family=\"Times,serif\" font-size=\"14.00\">2 x 200</text>\n</g>\n<g id=\"clust2\" class=\"cluster\">\n<title>cluster200</title>\n<path fill=\"none\" stroke=\"black\" d=\"M26,-8C26,-8 104,-8 104,-8 110,-8 116,-14 116,-20 116,-20 116,-109.95 116,-109.95 116,-115.95 110,-121.95 104,-121.95 104,-121.95 26,-121.95 26,-121.95 20,-121.95 14,-115.95 14,-109.95 14,-109.95 14,-20 14,-20 14,-14 20,-8 26,-8\"/>\n<text text-anchor=\"middle\" x=\"97.5\" y=\"-15.8\" font-family=\"Times,serif\" font-size=\"14.00\">200</text>\n</g>\n<!-- w -->\n<g id=\"node1\" class=\"node\">\n<title>w</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"65\" cy=\"-198.43\" rx=\"48.58\" ry=\"37.45\"/>\n<text text-anchor=\"middle\" x=\"65\" y=\"-209.73\" font-family=\"Times,serif\" font-size=\"14.00\">w</text>\n<text text-anchor=\"middle\" x=\"65\" y=\"-194.73\" font-family=\"Times,serif\" font-size=\"14.00\">~</text>\n<text text-anchor=\"middle\" x=\"65\" y=\"-179.73\" font-family=\"Times,serif\" font-size=\"14.00\">BART_w</text>\n</g>\n<!-- y -->\n<g id=\"node2\" class=\"node\">\n<title>y</title>\n<ellipse fill=\"lightgrey\" stroke=\"black\" cx=\"65\" cy=\"-76.48\" rx=\"43.27\" ry=\"37.45\"/>\n<text text-anchor=\"middle\" x=\"65\" y=\"-87.78\" font-family=\"Times,serif\" font-size=\"14.00\">y</text>\n<text text-anchor=\"middle\" x=\"65\" y=\"-72.78\" font-family=\"Times,serif\" font-size=\"14.00\">~</text>\n<text text-anchor=\"middle\" x=\"65\" y=\"-57.78\" font-family=\"Times,serif\" font-size=\"14.00\">Gamma</text>\n</g>\n<!-- w&#45;&gt;y -->\n<g id=\"edge1\" class=\"edge\">\n<title>w&#45;&gt;y</title>\n<path fill=\"none\" stroke=\"black\" d=\"M65,-160.79C65,-149.38 65,-136.65 65,-124.63\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"68.5,-124.31 65,-114.31 61.5,-124.31 68.5,-124.31\"/>\n</g>\n</g>\n</svg>\n",
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Generated by graphviz version 2.50.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"138pt\" height=\"260pt\"\n",
" viewBox=\"0.00 0.00 138.00 259.91\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 255.91)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-255.91 134,-255.91 134,4 -4,4\"/>\n",
"<g id=\"clust1\" class=\"cluster\">\n",
"<title>cluster2 x 200</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M20,-129.95C20,-129.95 110,-129.95 110,-129.95 116,-129.95 122,-135.95 122,-141.95 122,-141.95 122,-231.91 122,-231.91 122,-237.91 116,-243.91 110,-243.91 110,-243.91 20,-243.91 20,-243.91 14,-243.91 8,-237.91 8,-231.91 8,-231.91 8,-141.95 8,-141.95 8,-135.95 14,-129.95 20,-129.95\"/>\n",
"<text text-anchor=\"middle\" x=\"93\" y=\"-137.75\" font-family=\"Times,serif\" font-size=\"14.00\">2 x 200</text>\n",
"</g>\n",
"<g id=\"clust2\" class=\"cluster\">\n",
"<title>cluster200</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M26,-8C26,-8 104,-8 104,-8 110,-8 116,-14 116,-20 116,-20 116,-109.95 116,-109.95 116,-115.95 110,-121.95 104,-121.95 104,-121.95 26,-121.95 26,-121.95 20,-121.95 14,-115.95 14,-109.95 14,-109.95 14,-20 14,-20 14,-14 20,-8 26,-8\"/>\n",
"<text text-anchor=\"middle\" x=\"97.5\" y=\"-15.8\" font-family=\"Times,serif\" font-size=\"14.00\">200</text>\n",
"</g>\n",
"<!-- w -->\n",
"<g id=\"node1\" class=\"node\">\n",
"<title>w</title>\n",
"<ellipse fill=\"none\" stroke=\"black\" cx=\"65\" cy=\"-198.43\" rx=\"48.58\" ry=\"37.45\"/>\n",
"<text text-anchor=\"middle\" x=\"65\" y=\"-209.73\" font-family=\"Times,serif\" font-size=\"14.00\">w</text>\n",
"<text text-anchor=\"middle\" x=\"65\" y=\"-194.73\" font-family=\"Times,serif\" font-size=\"14.00\">~</text>\n",
"<text text-anchor=\"middle\" x=\"65\" y=\"-179.73\" font-family=\"Times,serif\" font-size=\"14.00\">BART_w</text>\n",
"</g>\n",
"<!-- y -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>y</title>\n",
"<ellipse fill=\"lightgrey\" stroke=\"black\" cx=\"65\" cy=\"-76.48\" rx=\"43.27\" ry=\"37.45\"/>\n",
"<text text-anchor=\"middle\" x=\"65\" y=\"-87.78\" font-family=\"Times,serif\" font-size=\"14.00\">y</text>\n",
"<text text-anchor=\"middle\" x=\"65\" y=\"-72.78\" font-family=\"Times,serif\" font-size=\"14.00\">~</text>\n",
"<text text-anchor=\"middle\" x=\"65\" y=\"-57.78\" font-family=\"Times,serif\" font-size=\"14.00\">Gamma</text>\n",
"</g>\n",
"<!-- w&#45;&gt;y -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>w&#45;&gt;y</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M65,-160.79C65,-149.38 65,-136.65 65,-124.63\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"68.5,-124.31 65,-114.31 61.5,-124.31 68.5,-124.31\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<graphviz.graphs.Digraph at 0x7f31ae9c47f0>"
]
Expand All @@ -272,7 +310,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "9aa885a3",
"metadata": {},
Expand All @@ -292,13 +329,7 @@
"text": [
"Multiprocess sampling (4 chains in 4 jobs)\n",
"PGBART: [w]\n",
"PGBART: [w]\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"PGBART: [w]\n",
"Sampling 4 chains for 1_000 tune and 1_000 draw iterations (4_000 + 4_000 draws total) took 136 seconds.\n",
"The rhat statistic is larger than 1.01 for some parameters. This indicates problems during sampling. See https://arxiv.org/abs/1903.08008 for details\n"
]
Expand All @@ -313,7 +344,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "eba7cee5",
"metadata": {},
Expand Down Expand Up @@ -392,7 +422,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "d1775acb",
"metadata": {},
Expand All @@ -401,7 +430,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "b743d58b-2678-4e17-9947-a8fe4ed03e21",
"metadata": {},
Expand Down Expand Up @@ -479,7 +507,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "pymc-examples-env",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -493,7 +521,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.10.0"
},
"vscode": {
"interpreter": {
Expand Down
6 changes: 3 additions & 3 deletions examples/case_studies/bart_heteroscedasticity.myst.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jupytext:
format_name: myst
format_version: 0.13
kernelspec:
display_name: pymc-examples-env
display_name: Python 3 (ipykernel)
language: python
name: python3
---
Expand All @@ -14,9 +14,9 @@ kernelspec:
# Modeling Heteroscedasticity with BART

:::{post} January, 2023
:tags: bart regression
:tags: BART, regression
:category: beginner, reference
:author: [Juan Orduz](https://juanitorduz.github.io/)
:author: Juan Orduz
:::

+++
Expand Down
4 changes: 4 additions & 0 deletions examples/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def setup(app: Sphinx):
"logo": {
"link": "https://www.pymc.io",
},
"article_header_end": ["nb-badges"],
"show_prev_next": True,
"article_footer_items": ["rendered_citation.html"],
}
version = os.environ.get("READTHEDOCS_VERSION", "")
version = version if "." in version else "main"
Expand Down Expand Up @@ -118,6 +121,7 @@ def setup(app: Sphinx):
"contributors": ("PyMC Contributors", "https://docs.pymc.io"),
}
blog_default_author = "contributors"
post_show_prev_next = False
fontawesome_included = True
# post_redirect_refresh = 1
# post_auto_image = 1
Expand Down
2 changes: 1 addition & 1 deletion requirements-docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pymc-sphinx-theme==0.13
sphinx-design
sphinx-copybutton
sphinxcontrib-bibtex
ablog
ablog<0.11
sphinxext-opengraph
sphinx-codeautolink
sphinx-notfound-page
Expand Down

0 comments on commit cb142b4

Please sign in to comment.