GithubHelp home page GithubHelp logo

Comments (3)

rlouf avatar rlouf commented on July 28, 2024 1

I'll do better than that and open a PR shortly with what I'm more or less sure of and add the explanation there.

from aemcmc.

rlouf avatar rlouf commented on July 28, 2024

I am currently not sure how to handle the sampler parameters in this situation. The caller, either machine or human, has to know that the sampling step requires extra parameters. I was first thinking of passing instructions in the form of a string, but this is not a good idea, at least not in AeMCMC: it complicates handling of these step functions by a program downstream.

A better idea is to deal with the distinction at the type level e.g. with SamplingAlgorithm and ParametrizedSamplingAlgorithm. NUTS would be a ParametrizedSamplingAlgorithm and contain the necessary information about its parameters (expected type, rank and shape for instance). These classes can return instructions that humans can understand with their __str__ method.

Something along the lines of (for a single variable):

# To be continued
class NUTS(ParametrizedSamplingAlgorithm):


    def __init__(self, variable):
        ndims = variable.shape[0]

        self.parameters = {}
        self.parameters["step_size"] = (None, config.floatX)}
        self.parameters["inverse_mass_matrix"] = [
            (ndims,config.floatX),
            ((ndims,ndims), config.floatX)
        ]

        # Reparametrize the variables here

    def  construct_step(self):
        """Returns the step function for the given variable"""
        pass

    def __str__(self):
        """Print infotmation about this sampling step:
         1. The variables being assigned the algorithms
         2. The properties of the parameters
         3. The algorithm
         4. The transformations applied.
        """
        pass

The adaptation that NUTS requires is an extra difficulty, but we don't need to figure this out to have a first working version of the sampler builder. I currently leans towards letting the caller handle this using the sampling step types since sampling steps and parameter updates are decoupled. We shouldn't make opinionated decisions about which adaptation algorithm to use in AeMCMC anyway.

(In lack of a better place, I'll also add here that our rewrites need to carry information that is both machine readable: "what distributions are involved?" "What kind of rewrite is this", which mean we could export a database of relation should we want to. And also readable for humans who will need to understand how we built samplers)

from aemcmc.

brandonwillard avatar brandonwillard commented on July 28, 2024

I am currently not sure how to handle the sampler parameters in this situation. The caller, either machine or human, has to know that the sampling step requires extra parameters. I was first thinking of passing instructions in the form of a string, but this is not a good idea, at least not in AeMCMC: it complicates handling of these step functions by a program downstream.

Can you provide pseudo-code examples for the relevant scenarios(s)? Without something like that, I'm not confident that I would end up addressing all the relevant concerns together.

from aemcmc.

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.