Plot Functions
There are plot recipes and user plots defined in JuliaSimModelOptimizer for easy plotting of results:
Calibration
i.
plot(experiment::AbstractExperiment, prob::InverseProblem, x = initial_state(prob))
Plots the trajectories for each state of experiment
, when point x
is used to provide parameter and/or initial condition values that are optimized in prob
. The last argument, x
, defaults to the initial guess for the values of each parameter and initial condition to be optimized, as they were specified during model definition. x
can be a NamedTuple
or CalibrationResult
object.
Arguments:
experiment
:Experiment
object.prob
:InverseProblem
object.x
: parameters/initial conditions included in the optimization.
ii.
JuliaSimModelOptimizer.plot_shooting_segments
— Functionplot_shooting_segments(experiment::AbstractExperiment, r; kwargs...)
Plots each segment of the trajectory by simulating the experiment
using the parameters and initial conditions present in r
which is of type CalibrationResult
. This is used for visualizing results obtained using MultipleShooting
for calibration.
Arguments
experiment
:Experiment
object.r
:CalibrationResult
object.
Keyword Arguments
kwargs
: These kwargs get forwarded to Plots.jl'splot
function. Some of the useful ones can besize
,layout
etc.
iii.
plot(cd::CollocationData; vars="states", kwargs...)
Plots the collocated data stored in CollocationData
object against the ground truth (if available)
Arguments:
cd
:CollocationData
object.
Keyword Arguments:
vars
: This can be either "states" or "derivatives" to plot the states and derivatives of it respectively.kwargs
: These kwargs get forwarded to Plots.jl'splot
function. Some of the useful ones can besize
,layout
etc.
vi.
JuliaSimModelOptimizer.convergenceplot
— Functionconvergenceplot(r; full = false, stack = false, kwargs...)
Plots the loss history.
Arguments
r
: Single or a vector ofCalibrationResult
objects.
Keyword Arguments
full
: Boolean variable to indicate whether the full loss history is to be plotted or not. If set tofalse
, monotonically non increasing curve is plotted, i.e., loss is updated only when it decreases.stack
: Boolean variable to plot different loss histories in the same plot or in separate plots.kwargs
: These kwargs get forwarded to Plots.jl'splot
function. Some of the useful ones can besize
,layout
etc.
Parametric Uncertainty Quantification
i.
plot(ps::AbstractParametricUncertaintyEnsemble, experiment::AbstractExperiment; summary = true, quantile = [0.05, 0.95], show_data = false, kwargs...)
Plot the trajectories corresponding to each set of parameters (and/or initial conditions) from an ensemble given as result of parametric uncertainty quantification (i.e. results from parametric_uq
).
Arguments:
ps
:ParameterEnsemble
object obtained from doingparametric_uq
.experiment
:Experiment
object.
Keyword Arguments:
summary
:Bool
, defaults totrue
. Determines whether summary statistics of the trajectories are plotted. Iftrue
, a mean trajectory is shown with a band around it representing a lower and upper quantile of the state distribution at each saved timepoint.quantile
: Defaults to[0.05, 0.95]
. A vector of two elements, corresponding to the lower and upper quantile of the distribution of each state at each saved timepoint, to be plotted ifsummary == true
.states
: aVector
of model states, whose trajectories are plotted. Defaults to all saved states inexperiment
.show_data
:Bool
, defaults tofalse
. Determines whether data ofexperiment
is also plotted. Iftrue
data is plotted as a scatter plot on top of the state trajectories.kwargs
: These kwargs get forwarded to Plots.jl'splot
function. Some of the useful ones can besize
,layout
etc.
ii.
plot(ps::AbstractParametricUncertaintyEnsemble, prob::InverseProblem; summary = true, quantile = [0.05, 0.95], show_data = false, kwargs...)
Plots the state trajectories of experiments that are part of InverseProblem
prob
, using an ensemble given as result of parametric uncertainty quantification (i.e. results from parametric_uq
).
Each experiment is shown in a separate subplot.
Arguments:
ps
:ParameterEnsemble
object obtained from doingparametric_uq
.prob
:InverseProblem
object.
Keyword Arguments:
experiment_names
:Vector
containing the names of experiments to be plotted. These experiments need to be part ofprob
.layout
:Tuple{Int, Int}
. Determines how experiments are shown on the plotting window. Defaults to one experiment per row. TheTuple
should look like(number_of_rows, number_of_columns)
.summary
:Bool
, defaults totrue
. Determines whether summary statistics of the trajectories are plotted. Iftrue
, a mean trajectory is shown with a band around it representing a lower and upper quantile of the state distribution at each saved timepoint.quantile
: Defaults to[0.05, 0.95]
. A vector of two elements, corresponding to the lower and upper quantile of the distribution of each state at each saved timepoint, to be plotted ifsummary == true
.show_data
:Bool
, defaults tofalse
. Determines whether data of each plotted experiment is also shown. Iftrue
data is plotted as a scatter plot on top of the state trajectories.kwargs
: These kwargs get forwarded to Plots.jl'splot
function. Some of the useful ones can besize
etc.
iii.
JuliaSimModelOptimizer.confidenceplot
— Functionconfidenceplot(experiment::AbstractExperiment, ps::AbstractParametricUncertaintyEnsemble; confidence = 0.8, kwargs...)
Plots the trajectories for each state of experiment
for a given confidence value of the quantile.
Arguments
experiment
:Experiment
object.ps
:ParameterEnsemble
object obtained from doingparametric_uq
.
Keyword Arguments:
confidence
: Defaults to0.8
. A scalar value that shows the level of confidence (n-th quantile in loss) that the obtained plot is a good fit in comparison to the actual experimental data, out of the generated samples.show_data
:Bool
, defaults totrue
, in order to show the dergee of fit with the actual data. Determines whether data ofexperiment
is also plotted. Iftrue
data is plotted as a scatter plot on top of the state trajectories.states
: aVector
of model states, whose trajectories are plotted. Defaults to all saved states inexperiment
.kwargs
: These kwargs get forwarded to Plots.jl'splot
function. Some of the useful ones can besize
,layout
etc.
iv.
JuliaSimModelOptimizer.confidence_plot_shooting_segments
— Functionconfidence_plot_shooting_segments(experiment::AbstractExperiment, ps::AbstractParametricUncertaintyEnsemble; kwargs...)
Plots the trajectories for each state of experiment
for a given confidence value of the quantile.
Keyword Arguments:
confidence
: Defaults to0.8
. A scalar value that shows the level of confidence that the obtained plot is a good fit in comparison to the actual experimental data, out of the generated samples.show_data
:Bool
, defaults totrue
, in order to show the dergee of fit with the actual data. Determines whether data ofexperiment
is also plotted. Iftrue
data is plotted as a scatter plot on top of the state trajectories.kwargs
: These kwargs get forwarded to Plots.jl'splot
function. Some of the useful ones can besize
,layout
etc.