Skip to content

Separate the change of sampling space (θ) from VarInfo #253

@xukai92

Description

@xukai92

The target of this proposal is to reduce the memory used for storing the theta history as less as possible. Let's say θ is the variables which are associated with the sampler.

Key points:

  1. Sampler only changes and keep a track of the θ but not VarInfo.
  • VarInfo is only treated as a layer that sampler uses to interact with model.
  1. Each time sampler want to apply θ to the model, it firstly pass θ to VarInfo, and run the model with VarInfo and sampler.
  • It's sampler's responsibility to use the correct θ (e.g. use an old θ if a previous step is rejected) when evaluating the model.
  1. When passing VarInfo to another sampler, all the sampler need to do is vi[spl] = θ and pass this vi to the other sampler.
  • During the process of one sampler, it will never change values belong to other samplers in this case because vi[spl] = θ will not interact other space.

Running model is like

evalute(θ, model, spl, vi) = begin
  vi[spl] = θ
  model(vi=vi, sampler=spl)
end

Layer concept is like

---------------------------------
|              Model            | ----------> Sample
---------------------------------
         ↑                ↑              
-------------------       ↑
|     VarInfo     |       ↑
-------------------       ↑
         ↑                ↑
-------------------       ↑
|     Sampler     | <------
-------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions