You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A preliminary idea would be to provide a helper function that returns a callable that can be easily used with scipy.optimize functions or with scikit-optimize.
The returned callable would basically do three things:
setup a new simulation (i.e., update from an existing setup with a new set of free parameters)
run the simulation
compute and return the result of either an external function that takes simulation output as input or a function attached to the model as a process.
The signature of the helper function might look like (naming could be better):
in_dataset is an input xarray.Dataset, which has for example been created using xsimlab.create_setup(model=model, ...)
params is a list with the names of the model inputs that are free parameters. This will correspond to the input arguments of the returned function to minimize.
fvalue is either the name of the variable in Model that correspond to the value of the function to minimize or a callable that take an output xarray.Dataset (as returned by Dataset.xsimlab.run(model=model)) and that returns the value of the function to minimize.
Optionally, the helper function might also return initial guesses for each free parameter (i.e., x0), taken directly from in_dataset.
The text was updated successfully, but these errors were encountered:
A preliminary idea would be to provide a helper function that returns a callable that can be easily used with scipy.optimize functions or with scikit-optimize.
The returned callable would basically do three things:
The signature of the helper function might look like (naming could be better):
xsimlab.create_minimize_func(model, in_dataset, params, fvalue)
where:
model
is an instance ofxsimlab.Model
in_dataset
is an inputxarray.Dataset
, which has for example been created usingxsimlab.create_setup(model=model, ...)
params
is a list with the names of the model inputs that are free parameters. This will correspond to the input arguments of the returned function to minimize.fvalue
is either the name of the variable inModel
that correspond to the value of the function to minimize or a callable that take an outputxarray.Dataset
(as returned byDataset.xsimlab.run(model=model)
) and that returns the value of the function to minimize.Optionally, the helper function might also return initial guesses for each free parameter (i.e.,
x0
), taken directly fromin_dataset
.The text was updated successfully, but these errors were encountered: