pymc
pymc copied to clipboard
Write v4 upgrade guide
In anticipation of the big v4 release we should start to write a document walking people through the upgrade process. Specifically, this document should contain:
- Information about the Theano->Aesara switch
- Instructions and code on how to remove any former Theano installation and install Aesara
- A script to guide in the renaming of imports from Theano to Aesara for a code-base as well as NBs (I think @brandonwillard has some code for this already).
- [Please add more]
@MarcoGorelli is that something you can help with?
Hey @twiecki - which part did you want help with?
We should mention somewhere some of the benefits / future developments that are facilitated by this change, so that it doesn't look like we are just trying to reinvent the wheel (i.e., get people excited for the change and not simply bothered)
This will be also great to help outreachy interns learn how to update all the other notebooks to take advantage of all the improvements.
Maybe we can start by updating the getting started notebook https://github.com/pymc-devs/pymc-examples/issues/31 and from there start gathering and writing down all the changes that are needed to update the code.
Here are the basics:
-
theano
is nowaesara
-
theano.gof
is nowaesara.graph
and, more specifically,theano.gof.graph
isaesara.graph.basic
- config options previously under
.
-delimited "sections", liketheano.config.gcc
, are now replaced with double-underscores (e.g.theano.config.gcc.cxxflags
is nowaesara.config.gcc__cxxflags
) - most internal classes and functions are no longer exported at the package level (e.g.
theano.Variable
no longer works; useaesara.graph.basic.Variable
instead)
@MarcoGorelli Ideally the conversion script, is that something you are familiar with?
I think you could subclass ast.NodeVisitor
and override some methods like visit_ImportFrom
and visit_Name
(example) - I'm starting a new job next week though and likely won't have capacity for this in the near future though, sorry
I wrote a small template/example for Distribution
-to-RandomVariable
conversions here.
New ones:
- Transforms that take arguments require a callable as input that takes the rv and returns the needed arguments. They are now Uppercase, indicating they are a class that needs be instantiated when defined
interval(a, b) -> Interval(lambda rv: (a, b))
. - Lowerbound and Upperbound transforms were removed. The same functionality can still be obtained with
Interval(lambda rv: (None, upperbound))
orInterval(lambda rv: (lowerbound, None))
- Missing data
x
is now split automatically intox_observed
containing non-missing values (new),x_missing
containing only missing values (old), and a deterministicx
that combines the two (~newish). - One can no longer do
pm.Distribution.dist(x).logp(y)
/.logcdf(y)
.
I'd like to work on this. Can anyone please guide me a little bit on where to locate the upgrade guide and some general comments on the guide development?
We should also mention how size/ shape/ dims work and the new ellipsis functionality: https://github.com/pymc-devs/pymc3/pull/4696
testval -> initval (still being discussed in #4729)
This will be also great to help outreachy interns learn how to update all the other notebooks to take advantage of all the improvements.
Maybe we can start by updating the getting started notebook pymc-devs/pymc-examples#31 and from there start gathering and writing down all the changes that are needed to update the code.
oh hi I'm late here, but this sounds sensible, pinging on an issue for this notebook in pymc-examples
We have a simple one here: https://www.pymc-labs.io/blog-posts/the-quickest-migration-guide-ever-from-pymc3-to-pymc-v40/ that should suffice for 4.0.
@twiecki Shall we close this? It seems like things went smooth enough, and we can keep adding custom error messages when API changed to address local issues (e.g., #6032)