pymc-devs / pymc-devs/pymc-examples

ODE Notebooks Cleanup

Open
#502 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
398
Forks
325
Avg merge
9d 15m
Merged PRs (30d)
1

Description

ODE Notebooks

  • Lotka-Volterra with manual gradients
  • pymc3.ode: Shapes and benchmarking
  • GSoC 2019: Introduction of pymc3.ode API

URLS

Issue description

I'm suggesting we delete these three notebooks, and salvage three very short ODE examples that are not covered elsewhere (Fitzhugh-Nagumo model, enzymatic reaction, SIR model).

The main issue with these notebooks is that they are not very relevant for someone trying to perform inference on an ODE. The notebook Lotka-Volterra with manual gradients is very long and isn't a method that people should implement on their own. pymc3.ode: Shapes and benchmarking is more about profiling than ODEs, and GSoC 2019: Introduction of pymc3.ode API focuses only on the pymc.ODE module, which is very slow.

More Background
I am working on updating the ODE notebooks. After taking stock of the existing examples, I developed a new notebook that covers multiple methods for performing inference on ODEs (draft here)

It seems like the state-of-the-art for ODEs is moving on from the old example notebooks. The cutting edge is likely sunode or diffrax (or DifferentialEquations.jl) which all use autodifferentiation. Pymc.ODE is slow and should probably not be highlighted too much in the docs.

However, I did find that the Scipy ODE solver combined with non-gradient-based inference (e.g., DEMetropolis) was relatively simple and effective!

Proposed solution

Based on this information, I suggest to moving the Fitzhugh-Nagumo model, enzymatic reaction model, and SIR models into new short notebooks that just perform inference using Scipy and DEMetropolis.

Also note that pymc3.ode: Shapes and benchmarking is mostly about timing code and inspecting computational graphs, not ODEs. If there is valuable information in this notebook, then it should be moved to the "How to" folder of the PyMC examples (and needs a lot more text explaining what problem it is solving).

I can rework the existing notebooks once the broader team chimes in.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the three linked ODE notebooks: ODE_with_manual_gradients.html, ODE_API_shapes_and_benchmarking.html, and ODE_API_introduction.html. Review the draft ODE_Lotka_Volterra_multiple_ways.html and identify the Fitzhugh-Nagumo, enzymatic reaction, and SIR examples to retain. Done means the old notebooks are removed or their useful profiling content is relocated, and the retained examples are short inference notebooks using SciPy and DEMetropolis.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.