TuringLang / TuringLang/AbstractMCMC.jl

Provide standard API to get **one sample** in a "structured" way

Open
#65 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
108
Forks
20
PR merge metrics
No merged PRs in 30d

Description

Hey,
This might be me wanting crazy things again but here is my proposal:
Should we provide an abstract function (to overload), taking state, sample and model to return samples in a predefined way.
Let me give an example. Given a Turing model

@model function mymodel(x, y)
	s ~ Gamma(1, 1)
	w ~ Normal(0, s)
    y ~ MvNormal(x .* w, 1)
end
x = rand(5)
y = rand(5)

there would be a function which given the current sample and model returns (s=0.354123, w=0.154658)

The motivation behind this is to make more "universal" callback functions (the callback mafia is here again). Right now defining a callback function needs to be tailored for each model.
However having a to_named_tuple (which would be optional to implement), would allow to build many more generic functions built upon AbstractMCMC.

So I am pretty sure I am missing out why this is not making sense or that I am missing the bigger picture and I would be happy to hear why I am terribly wrong about this :)

PS: The NamedTuple is just a proposition, my proposal is more about having a convention about the output.

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

Review the existing AbstractMCMC callback conventions and the proposed inputs of state, sample, and model. The issue is complete only when the project agrees on a structured single-sample API, including its output convention and implementation scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.