Results interface


This structure contains the results obtained from calling calibrate. The struct behaves like an AbstractVector, but it also provides a Tables.jl interface. The result is considered a table with a single row, the column names being the names in the search space. For example if the search_space contains something like [a => (0, 1.), (b => (0, 2.))], you can get the tuned value for a with result[:a], where result is the corresponding CalibrationResult.

One consequence for the Tables.jl interface is that one can easily create a DataFrame out of the result with just DataFrame(results), or can write it to as .csv file with CSV.write(io, result). To create a vector of pairs, Tables.columnnames(results) .=> results can be used.

A convergence plot showing how the value of the loss function evolved during calibration can be obtained using convergenceplot(result).

Note that the order of the columns in the result is not necessarily the order that was provided in the search_space argument of the inverse problem depending on internal optimizations. The recommended way of obtaining the order of the columns is via the Tables.jl interface, Tables.columnnames(results).


The structure contains the result of a parameter ensemble when a StochGlobalOpt method was used to generate the population. To export results to a DataFrame use DataFrame(ps) and to plot them use plot(ps, experiment), where ps is the ParameterEnsemble and experiment is the AbstractExperiment, whose default parameter (or initial condition) values will be used.


Saving calibration results

Since calibration results behave like tables, we can easily export the results to as .csv file using

CSV.write(io, res)

We can also read back the results in with import_res. Note that reconstructing the result requires the corresponding inverse problem to be defined.

prob = InverseProblem(...)
csv = CSV.File(fn)
icsv = import_res(csv, prob)

Importing results

import_res(res, prob)

Import a CalibrationResult object (CalibrationResult) from tabular data or a vector. If a table (in the sense of Tables.jl) in provided, it is assumed to have one row. Note that since a Vector is one column and calibration results are one row, the input is internally permuted.


  • res: tabular data that contains the results of a calibration. This could be e.g a DataFrame, a CSV.File or a Vector.
  • prob: an InverseProblem object.


julia> import_res([1,2], prob)
Calibration result imported from Array.

│ k1 │ c1 │
│  1 │  2 │

Using imported calibration results

We can use imported calibration results just like we had computed them in the current session. For example they can be used for simulating the results of an experiment given the known calibrated parameters:

csv = CSV.File(fn)
icsv = import_res(csv, prob)
isol = simulate(experiment, prob, icsv)

We can also use import_res to continue a calibration later. For example if we already have a calibration result saved in a file, we can continue the calibration from the imported results.

csv = CSV.File(fn)
icsv = import_res(csv, prob)
calibrate(icsv, SingleShooting(maxiters = 10^3))