-
Notifications
You must be signed in to change notification settings - Fork 3
mopt api
One of the main component is the algorithm that determines the next parameter value to compute the model at.
The objective function is a key element, it represents the problem the use is trying to solve. Taking a list of input parameters, this function will return an overall criteria to be minimized as well as additional infomrmations about the solution. In particular it should return the values of the moments used to form the overall crtiteria.
-
pa list of parameter values. This contains both the parameter that estimated and all other important parameters like grid sizes, calibrated parameters, etc... -
msa list of moments to consider
It should return a list res with the following elements:
-
p: the list of parameters stored back -
value: the objective value of the function evaluated atp -
sm: a data.table of the simulated moments with a columnnameand a columnvalue. -
infos: a list of additional information that could be relevant. -
time: time spent in the function evaluation -
chain: the chain number,pshould contain it too.
To see a very basic example see the joint normal objective function.
The algorithm is the code that decides on how to explore the space of the parameters. The packages comes with several implemented algorithms that can be used in parallel, but the user can easily design its own.
An algo takes the following arguments:
-
chainsthis is a data.table that contains information about past evaluations. Each row is an evaluations. Important columns of that table are:-
ithe chain id -
nthe evaluation number -
p.*are parameter values -
m.*are moment values -
d.*are additional informations like convergence -
valuethe objective value
-
-
evalsa data.frame with the new evaluations -
optsa list of configuration paramaters for the algorithm -
pdesca data.table of the parameters to sample with bounds -
priva list that stores the internal state of the list. This will facilitate the interuption and restarting of a given algorithm.
The return value consist of the private object that can be used to store some internal state and a list of parameter sets to be sent to the worker nodes.
- a list object with the following fields:
-
psa list of list of parameters. The mains list should be of the size of the number of chains -
privinternal state that will be given back at next evaluation -
evalsthe new values with accepted/rejected draws
-