Closed galenseilis closed 4 months ago
:tada: Welcome to PyMC! :tada: We're really excited to have your input into the project! :sparkling_heart:
If you haven't done so already, please make sure you check out our Contributing Guidelines and Code of Conduct.
@galenseilis Thanks for reporting, that definitely should be fixed (pt
is import pytensor.tensor as pt
). But I'd also like to know if what you're trying to do really requires this?
@twiecki Thank you for the clarification on
pt
.
Sure, let us start with clarifying what I am trying to do. I have three goals. They're sequentially-dependent in the sense that achieving goal 3 depends on achieving goal 2 which depends on achieving goal 1. However, it would still count for something if I achieved goal 1 alone, or only goal 1 and goal 2.
The first is just to understand how it works, unconditioned on "trying to do something else". Is a working example required to understand how pymc.Model
works? Maybe not, but I recommend it.
The second goal is to understand where I might use it. What is the use case for making a PyMC model this way? Often a tool is created for a desired set of use cases, and I would like to understand what was the desired use case for being able to build models this way. Is a working example required to understand the use cases of inheriting from pymc.Model
? Maybe not, but I recommend it.
The third goal is assess whether it is suitable for a project I am at the product design stage of. The concept is a Python package for random graphs, random hypergraphs, and random simplicial complexes among other things. PyMC is one of the tools I am considering for providing the Monte Carlo methods. If I go with PyMC, I want to make a decision about my model classes inheriting from pymc.Model
exor using the usual context wrapper within my classes' __init__
to store the PyMC model as an attribute. Whether I subclass or use the context wrapper will depend on what I learn from goals 1 and 2. Is a working example required to understand what subclassing from pymc.Model
would look like in my project? Maybe not, but I recommend it.
Maybe https://github.com/pymc-devs/pymc-experimental/blob/main/pymc_experimental/model_builder.py#L30 could help you?
That looks potentially useful for developing NetMC. Certainly something to weigh against in goal 3. If there are alternatives to pymc.Model
I should consider them.
model_builder.py
is interesting, but has that stalled?
It would be nice to know some conventions for instantiating complex models, but when I look to the doc, I always come back to the same broken example.
If there are no desire to fix it, could we/I at least remove the example?
Didn't know it was broken?
Issue with current documentation:
The documentation for
pymc.Model
seems to give some conceptual gist of how it works, but the example given in the documentation does not work.There are no imports, and I am not sure where
pt
is coming from inpt.constant(1)
. I have thought maybept
was for "PyTensor" but there is noconstant
in the namespace ofpt
resulting fromimport pytensor as pt
. There is apymc.math.constant
, but I am unsure if that is the same thing.But it is also unclear if the imports are the only issue. Here is some code where I have attempted to address the above namespace issues.
Running the above I get an
AttributeError
that I don't think is related because it occurs atsuper().__init__(name, model)
.Idea or request for content:
Please provide a minimum working example.