sbi icon indicating copy to clipboard operation
sbi copied to clipboard

Allow parameters to have different data types and shapes

Open alvorithm opened this issue 5 years ago • 4 comments

Background

Our current idea of the parameters of a simulator is either something structured (such as a cross-section matrix) or a plurality of scalars and vectors that can be joined into one long vector and whose prior is a set of independent priors over diffferent coordinates (@janfb?).

Goal

It should be possible to have differently-shaped parameters such as e.g. a positive rate, a covariance matrix, and a speed vector passed in, each of them with their own private factor prior (i.e. no need to build an Independent prior to become, formally, a prior over all of them). This is more expressive, and more clear.

Caveats

  • This would require to be able to use lists of tensors instead of now just a single tensor, as input, and correspondingly, conforming (same-length, matching-output-shape) prior distributions.
  • The construction of the neural network, if honoring the structured nature of the inputs, may become complex.

alvorithm avatar Jun 08 '20 17:06 alvorithm

Actually, I think we cannot handle multi-dimensional parameters yet, e.g., no matrices. If a user wants to define a prior over a matrix she has to implement a prior wrapper that returns a flattened version and then change her simulator such that it takes this flattened vector and reshapes it into a matrix for simulation.

janfb avatar Jun 08 '20 18:06 janfb

Update: we do not require an explicit prior object anymore, at least not for NPE. One can just pass pre-simulated theta and x.

theta must be a tensor though. Thus, if you have differently shaped "sub-priors" you need to take care of how to reshape this into a one-dimensional tensor.

janfb avatar Feb 28 '24 15:02 janfb