BiasModelParamsSampler
-
class
aquila_borg.samplers.
BiasModelParamsSampler
A sampler that sample bias parameters using the borg forward model strategy.
It relies on block sampling and slice sampler approach to be able to do it on anything, though it is expected to be slow in the end.
The sampler will update the bias parameters using the mechanism of
aquila_borg.forward.BORGForwardModel.setModelParams()
. It is provided with an update on the key “biasParameters” which is a 1d array of the size as provided to the constructor.The array is initialized by introspection by querying
aquila_borg.forward.BORGForwardModel.getModelParam()
on the model with the nickname “bias” and the parameter “biasParameters”. On restart, those parameters will be reset correctly.- Example
For example the following python model would be interrogated by this sampler:
class Model(aquila_borg.forward.BORGForwardModel): # skip common section def setModelParams(self, params): if 'biasParameters' in params: print(" I am getting some parameters: " + repr(params)) def getModelParam(self, modelname, keyname): if modelname == 'bias' and keyname == 'biasParameters': print(" Let's return some numpy array with parameters" ) return np.array([0.0,1.0]) #This array must match the number of parameters
- Parameters
likelihood (Likelihood3d) – the likelihood to evaluate the quality of the parameter
model (BORGForwardModel) – the forward model element to pass the bias parameter upon
prefix (str) – Prefix for the bias parameter array
limiter (callable) – Function to be called before trying to sample the bias parameters
unlimited (callable) – Function to be called after a new sample of the bias parameters
Methods
|
|
|