Plot Functions
There are plot recipes and user plots defined in DyadModelOptimizer 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:Experimentobject.prob:InverseProblemobject.x: parameters/initial conditions included in the optimization.
ii.
DyadModelOptimizer.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:Experimentobject.r:CalibrationResultobject.
Keyword Arguments
kwargs: These kwargs get forwarded to Plots.jl'splotfunction. Some of the useful ones can besize,layoutetc.
iii.
plot(cd::CollocationData; vars="states", kwargs...)Plots the collocated data stored in CollocationData object against the ground truth (if available)
Arguments:
cd:CollocationDataobject.
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'splotfunction. Some of the useful ones can besize,layoutetc.
vi.
DyadModelOptimizer.convergenceplot — Functionconvergenceplot(r; full = false, stack = false, kwargs...)Plots the loss history.
Arguments
r: Single or a vector ofCalibrationResultobjects.
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'splotfunction. Some of the useful ones can besize,layoutetc.
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:ParameterEnsembleobject obtained from doingparametric_uq.experiment:Experimentobject.
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: aVectorof model states, whose trajectories are plotted. Defaults to all saved states inexperiment.show_data:Bool, defaults tofalse. Determines whether data ofexperimentis also plotted. Iftruedata is plotted as a scatter plot on top of the state trajectories.kwargs: These kwargs get forwarded to Plots.jl'splotfunction. Some of the useful ones can besize,layoutetc.
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 InverseProblemprob, 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:ParameterEnsembleobject obtained from doingparametric_uq.prob:InverseProblemobject.
Keyword Arguments:
experiment_names:Vectorcontaining 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. TheTupleshould 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. Iftruedata is plotted as a scatter plot on top of the state trajectories.kwargs: These kwargs get forwarded to Plots.jl'splotfunction. Some of the useful ones can besizeetc.
iii.
DyadModelOptimizer.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:Experimentobject.ps:ParameterEnsembleobject 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 ofexperimentis also plotted. Iftruedata is plotted as a scatter plot on top of the state trajectories.states: aVectorof model states, whose trajectories are plotted. Defaults to all saved states inexperiment.kwargs: These kwargs get forwarded to Plots.jl'splotfunction. Some of the useful ones can besize,layoutetc.
iv.
DyadModelOptimizer.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 ofexperimentis also plotted. Iftruedata is plotted as a scatter plot on top of the state trajectories.kwargs: These kwargs get forwarded to Plots.jl'splotfunction. Some of the useful ones can besize,layoutetc.