Giter Site home page Giter Site logo

Comments (7)

rrkarim avatar rrkarim commented on August 27, 2024

Also why not renaming initialize_state to initialize_sampling_state (also add additional state parameter) to remove redundant code in build_logp_and_deterministic_functions with all the state/observed checks?

from pymc4.

twiecki avatar twiecki commented on August 27, 2024

Those sound like reasonable changes and requests, happy to review PRs!

from pymc4.

rrkarim avatar rrkarim commented on August 27, 2024

Working on it, guess there are some related issues to fix first.

from pymc4.

ColCarroll avatar ColCarroll commented on August 27, 2024

@rrkarim are you making progress on this? i may try to tackle it today. I want to be able to just

data = pm.sample(model())

and have data be the arviz object. This will require:

  • Update import paths to get sample at the top level
  • Wrap the return value of sample into the arviz object
  • Add the untransformed values into the trace (probably as Deterministics? this looks at least a little tricky)

I think the first two will be easy, and I will tackle those first.

from pymc4.

rrkarim avatar rrkarim commented on August 27, 2024

@ColCarroll, yes, the third one is, indeed, looks little tricky with my knowledge of the current design requirements. So yeah, change what you need to.

from pymc4.

lucianopaz avatar lucianopaz commented on August 27, 2024

I wouldn't add them as Deterministics. The executors are used in different contexts for different purposes. The transformed executor is used in sample and in sample_posterior_predictive, and the latter relies on distributions being in untransformed, transformed or observed values in the sampling state, but never in deterministics. I can tackle this issue later this week but I would do the following:

  1. The deterministic values are collected with a callback that does a forward pass through the model, so it also collects the untransformed distribution values. I would simply change this callback to also return the relevant subset of untransformed variables that should be included into the trace.
  2. To know the list of distributions that should be stored, we could either rely on the test forward pass that we do in build logp function, or we could add an attribute to the sampling state, that stores the names of the autotransformed distributions.

from pymc4.

ColCarroll avatar ColCarroll commented on August 27, 2024

Thanks, @lucianopaz and @rrkarim!

I think I got to the same place as you are suggesting with 1. I am just finding it hard to figure out where to add that collection logic! 😁

I am relying on the nice pymc4.utils.NameParts.is_transformed to decide if a distribution should be stored.

from pymc4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.