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_segmentsFunction
plot_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

Keyword Arguments

  • kwargs: These kwargs get forwarded to Plots.jl's plot function. Some of the useful ones can be size, layout etc.
source

iii.

plot(cd::CollocationData; vars="states", kwargs...)

Plots the collocated data stored in CollocationData object against the ground truth (if available)

Arguments:

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's plot function. Some of the useful ones can be size, layout etc.

vi.

JuliaSimModelOptimizer.convergenceplotFunction
convergenceplot(r; full = false, stack = false, kwargs...)

Plots the loss history.

Arguments

Keyword Arguments

  • full: Boolean variable to indicate whether the full loss history is to be plotted or not. If set to false, 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's plot function. Some of the useful ones can be size, layout etc.
source

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:

Keyword Arguments:

  • summary: Bool, defaults to true. Determines whether summary statistics of the trajectories are plotted. If true, 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 if summary == true.
  • states: a Vector of model states, whose trajectories are plotted. Defaults to all saved states in experiment.
  • show_data: Bool, defaults to false. Determines whether data of experiment is also plotted. If true data is plotted as a scatter plot on top of the state trajectories.
  • kwargs: These kwargs get forwarded to Plots.jl's plot function. Some of the useful ones can be size, 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 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:

Keyword Arguments:

  • experiment_names: Vector containing the names of experiments to be plotted. These experiments need to be part of prob.
  • layout: Tuple{Int, Int}. Determines how experiments are shown on the plotting window. Defaults to one experiment per row. The Tuple should look like (number_of_rows, number_of_columns).
  • summary: Bool, defaults to true. Determines whether summary statistics of the trajectories are plotted. If true, 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 if summary == true.
  • show_data: Bool, defaults to false. Determines whether data of each plotted experiment is also shown. If true data is plotted as a scatter plot on top of the state trajectories.
  • kwargs: These kwargs get forwarded to Plots.jl's plot function. Some of the useful ones can be size etc.

iii.

JuliaSimModelOptimizer.confidenceplotFunction
confidenceplot(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

Keyword Arguments:

  • confidence: Defaults to 0.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 to true, in order to show the dergee of fit with the actual data. Determines whether data of experiment is also plotted. If true data is plotted as a scatter plot on top of the state trajectories.
  • states: a Vector of model states, whose trajectories are plotted. Defaults to all saved states in experiment.
  • kwargs: These kwargs get forwarded to Plots.jl's plot function. Some of the useful ones can be size, layout etc.
source

iv.

JuliaSimModelOptimizer.confidence_plot_shooting_segmentsFunction
confidence_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 to 0.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 to true, in order to show the dergee of fit with the actual data. Determines whether data of experiment is also plotted. If true data is plotted as a scatter plot on top of the state trajectories.
  • kwargs: These kwargs get forwarded to Plots.jl's plot function. Some of the useful ones can be size, layout etc.
source