From 84573252efb2081254341cfdc254ea38ac3d4fe8 Mon Sep 17 00:00:00 2001 From: Ricardo Vieira Date: Fri, 3 Feb 2023 13:17:24 +0100 Subject: [PATCH 1/6] Update API reference listings --- docs/api_reference.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/api_reference.rst b/docs/api_reference.rst index b47e912fa..f6d86b055 100644 --- a/docs/api_reference.rst +++ b/docs/api_reference.rst @@ -9,13 +9,40 @@ methods in the current release of PyMC experimental. :maxdepth: 2 +:mod:`pymc_experimental` +============================= + +.. automodule:: pymc_experimental.marginal_model + :members: MarginalModel + +.. automodule:: pymc_experimental.model_builder + :members: ModelBuilder + + +:mod:`pymc_experimental.inference` +============================= + +.. automodule:: pymc_experimental.inference.fit + :members: fit + + :mod:`pymc_experimental.distributions` ============================= +.. automodule:: pymc_experimental.distributions.continuous + :members: GenExtreme + .. automodule:: pymc_experimental.distributions.histogram_utils :members: histogram_approximation +:mod:`pymc_experimental.gp` +============================= + +.. automodule:: pymc_experimental.gp.latent_approx + :members: HSGP + + :mod:`pymc_experimental.utils` ============================= @@ -24,3 +51,4 @@ methods in the current release of PyMC experimental. .. automodule:: pymc_experimental.utils.prior :members: prior_from_idata + From d3019172a70f3c42c3c1984e8b5c74b38de784c9 Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Tue, 14 Feb 2023 20:47:20 +0100 Subject: [PATCH 2/6] improve api page+some fixes --- docs/_templates/autosummary/base.rst | 5 ++ docs/_templates/autosummary/class.rst | 29 +++++++++ docs/api_reference.rst | 62 +++++++++---------- docs/conf.py | 6 +- pymc_experimental/distributions/continuous.py | 8 +-- pymc_experimental/marginal_model.py | 1 + 6 files changed, 74 insertions(+), 37 deletions(-) create mode 100644 docs/_templates/autosummary/base.rst create mode 100644 docs/_templates/autosummary/class.rst diff --git a/docs/_templates/autosummary/base.rst b/docs/_templates/autosummary/base.rst new file mode 100644 index 000000000..3fe9858d7 --- /dev/null +++ b/docs/_templates/autosummary/base.rst @@ -0,0 +1,5 @@ +{{ objname | escape | underline }} + +.. currentmodule:: {{ module }} + +.. auto{{ objtype }}:: {{ objname }} diff --git a/docs/_templates/autosummary/class.rst b/docs/_templates/autosummary/class.rst new file mode 100644 index 000000000..574b853a5 --- /dev/null +++ b/docs/_templates/autosummary/class.rst @@ -0,0 +1,29 @@ +{{ objname | escape | underline}} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + + {% block methods %} + .. automethod:: __init__ + + {% if methods %} + .. rubric:: {{ _('Methods') }} + + .. autosummary:: + {% for item in methods %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block attributes %} + {% if attributes %} + .. rubric:: {{ _('Attributes') }} + + .. autosummary:: + {% for item in attributes %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} diff --git a/docs/api_reference.rst b/docs/api_reference.rst index f6d86b055..1fdb19d0e 100644 --- a/docs/api_reference.rst +++ b/docs/api_reference.rst @@ -4,51 +4,51 @@ API Reference This reference provides detailed documentation for all modules, classes, and methods in the current release of PyMC experimental. +.. currentmodule:: pymc_experimental +.. autosummary:: + :toctree: generated/ -.. toctree:: - :maxdepth: 2 + marginal_model.MarginalModel + model_builder.ModelBuilder +Inference +========= -:mod:`pymc_experimental` -============================= +.. currentmodule:: pymc_experimental.inference +.. autosummary:: + :toctree: generated/ -.. automodule:: pymc_experimental.marginal_model - :members: MarginalModel + fit -.. automodule:: pymc_experimental.model_builder - :members: ModelBuilder +Distributions +============= -:mod:`pymc_experimental.inference` -============================= +.. currentmodule:: pymc_experimental.distributions +.. autosummary:: + :toctree: generated/ -.. automodule:: pymc_experimental.inference.fit - :members: fit + GenExtreme + histogram_utils.histogram_approximation -:mod:`pymc_experimental.distributions` -============================= +Gaussian Processess +=================== -.. automodule:: pymc_experimental.distributions.continuous - :members: GenExtreme +.. currentmodule:: pymc_experimental.gp +.. autosummary:: + :toctree: generated/ -.. automodule:: pymc_experimental.distributions.histogram_utils - :members: histogram_approximation + latent_approx.HSGP -:mod:`pymc_experimental.gp` -============================= +Utils +===== -.. automodule:: pymc_experimental.gp.latent_approx - :members: HSGP +.. currentmodule:: pymc_experimental.utils +.. autosummary:: + :toctree: generated/ - -:mod:`pymc_experimental.utils` -============================= - -.. automodule:: pymc_experimental.utils.spline - :members: bspline_interpolation - -.. automodule:: pymc_experimental.utils.prior - :members: prior_from_idata + spline.bspline_interpolation + prior.prior_from_idata diff --git a/docs/conf.py b/docs/conf.py index f45b3407c..a7ebd77cd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -56,16 +56,18 @@ # ones. extensions = [ "sphinx.ext.autodoc", + "sphinx.ext.autosummary", "sphinx.ext.viewcode", "sphinx.ext.napoleon", "sphinx.ext.mathjax", "nbsphinx", + "matplotlib.sphinxext.plot_directive", ] nbsphinx_execute = "never" # Add any paths that contain templates here, relative to this directory. -# templates_path = ["_templates"] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: @@ -81,7 +83,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +# language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/pymc_experimental/distributions/continuous.py b/pymc_experimental/distributions/continuous.py index e214f0081..9baf630dc 100644 --- a/pymc_experimental/distributions/continuous.py +++ b/pymc_experimental/distributions/continuous.py @@ -119,13 +119,13 @@ class GenExtreme(Continuous): Parameters ---------- - mu: float + mu : float Location parameter. - sigma: float + sigma : float Scale parameter (sigma > 0). - xi: float + xi : float Shape parameter - scipy: bool + scipy : bool Whether or not to use the Scipy interpretation of the shape parameter (defaults to `False`). diff --git a/pymc_experimental/marginal_model.py b/pymc_experimental/marginal_model.py index aed93adb5..599509bfb 100644 --- a/pymc_experimental/marginal_model.py +++ b/pymc_experimental/marginal_model.py @@ -54,6 +54,7 @@ class MarginalModel(Model): Marginalize over a single variable .. code-block:: python + import pymc as pm from pymc_experimental import MarginalModel From 3cc8d8071cef513154a13e7744876acda49a225a Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Tue, 14 Feb 2023 20:47:38 +0100 Subject: [PATCH 3/6] update to pymc theme --- docs/conf.py | 19 +++++++++++-------- docs/index.rst | 11 +---------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index a7ebd77cd..e831458f2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -99,7 +99,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = "pydata_sphinx_theme" +html_theme = "pymc_sphinx_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -112,14 +112,17 @@ "show_toc_level": 2, "navigation_depth": 4, "search_bar_text": "Search the docs...", - "icon_links": [ - { - "name": "GitHub", - "url": "https://github.com/pymc-devs/pymc-experimental", - "icon": "fab fa-github-square", - }, - ], + "use_search_override": False, + "logo": {"text": project}, } +html_context = { + "github_user": "pymc-devs", + "github_repo": "pymc-experimental", + "github_version": "main", + "doc_path": "docs", + "default_mode": "light", +} + # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, diff --git a/docs/index.rst b/docs/index.rst index b5dfef6fd..28cf4c9a3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -38,16 +38,7 @@ Contributors ============ See the `GitHub contributor page `_. -Contents -======== - .. toctree:: - :maxdepth: 4 + :hidden: api_reference - -Indices -======= - -* :ref:`genindex` -* :ref:`modindex` From 8de640b1f169400756a8c768009ef57036db420d Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Tue, 14 Feb 2023 20:51:04 +0100 Subject: [PATCH 4/6] add pymc theme to requirements --- requirements-docs.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements-docs.txt b/requirements-docs.txt index 0b024fea9..185288a8b 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -1,3 +1,4 @@ nbsphinx>=0.4.2 pydata-sphinx-theme>=0.6.3 sphinx>=4 +git+https://github.com/pymc-devs/pymc-sphinx-theme From cccde20ca8820d5a9d2d03194f1280fa1f49c646 Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Tue, 14 Feb 2023 20:56:29 +0100 Subject: [PATCH 5/6] fix indent in docstring --- pymc_experimental/distributions/continuous.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymc_experimental/distributions/continuous.py b/pymc_experimental/distributions/continuous.py index 9baf630dc..2de72c769 100644 --- a/pymc_experimental/distributions/continuous.py +++ b/pymc_experimental/distributions/continuous.py @@ -60,7 +60,7 @@ def rng_fn( class GenExtreme(Continuous): r""" - Univariate Generalized Extreme Value log-likelihood + Univariate Generalized Extreme Value log-likelihood The cdf of this distribution is From 22ae39b7a692556d9e66d8f5deabf87fb319727a Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Tue, 28 Feb 2023 17:15:37 +0100 Subject: [PATCH 6/6] run pre-commit --- docs/api_reference.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/api_reference.rst b/docs/api_reference.rst index 1fdb19d0e..2d85c3ab4 100644 --- a/docs/api_reference.rst +++ b/docs/api_reference.rst @@ -51,4 +51,3 @@ Utils spline.bspline_interpolation prior.prior_from_idata -