izmailovpavel / understandingbdl

Other
231 stars 38 forks source link

Instantiate a SWAG model with given mean and variance #9

Closed mohitsharma29 closed 2 years ago

mohitsharma29 commented 3 years ago

Hey

Let's say I have a mean and variance vector obtained using some process. How do I instantiate a SWAG model to that mean and variance (that is, to a particular distribution)?

mohitsharma29 commented 3 years ago

After reading through your code, here is what I think I will have to do:

  1. Set mean and variance vectors in the init method somehow.
  2. Now this swag model will have my custom mean and variance. I see that the sample function will send an updated mean vector to util.set_weights which returns a model.
  3. This model is essentially my sample from the custom distribution I wanted.

I am mostly worried about doing everything right in 1. Please do let me know whether I am missing out on anything in this pipeline.

izmailovpavel commented 3 years ago

Hey @mohitsharma29, sorry for the late response. I am not sure what you want to do exactly. Do you want to get a SWAG model with a given (pre-computed) mean and variance? Do you have two values (mean and variance) for each of the parameters?