Visualisations
Creating a surrogate model means taking a classic, mechanistic model and substituting it with a fast, approximate, semi-neural ODE. This transformation limits an engineer's visibility into the model's behaviour. Visualisations play a vital role in analyzing a final surrogate model because users need the ability to inspect a surrogate's performance and accuracy across its entire sampling space in order to confidently put it to use in production. To this end, JuliaSim Surrogates provides a stunning dashboard, which enables users to analyze their surrogate models in fine detail.
The dashboard above uses a parallel coordinate plot to illustrate every trajectory through simulation space. It also allows users to interactively select and filter trajectories based on specified parameter value intervals. This helps to unpack the surrogate at a high level, but users can drill down even further. Under the parallel coordinate plot are smaller plots which react to the current selections and show detailed results of each and every parameter combination.
Generating Dashboard Data
This Visualizations.jl
dashboard can be easily constructed with the appropriate data, and the Visualisations.jl
module makes obtaining this data easy.
Visualisations.generate_dashboard_data
— Functiongenerate_dashboard_data(
surr,
train_ed::Union{Nothing, ExperimentData}
) -> Dict{String}
generate_dashboard_data(
surr,
train_ed::Union{Nothing, ExperimentData},
valid_ed::Union{Nothing, ExperimentData};
sim,
error_metric,
filepath,
field,
kwargs...
) -> Dict{String}
Generates Data for visualizing using JuliaSimViz.jl
Arguments
surr
: Surrogate whose predictions and errors are to be predicted and visualisedtrain_ed
: Experiment Data generated using DataGeneration which is used for training of a surrogatevalid_ed
: Experiment Data generated using DataGeneration which is used for validation of a surrogatesim
: DEProblem/FMU for surrogatization or time taken for simulating the original system incase it is not available like in the case of externally generated datasetserror_metric
: Error metric for comparing the predictions of the surrogate and ground truth. This can be a symbol for using inbuilt functions - eg. :relerror for relative error, :abserror for absolute error or a custom function. For usage with one's own custom error metric, the function passed must be of the formf(truth,pred)
wheretruth
is the ground truth of your data, andpred
is the prediction data - both of form states x time. The expected return value of any error metric (both inbuilt and custom) should be a matrix of the same dimensions as the argumentsfilepath
: The path for saving the dashboard data on to the disk as a jld2 filefield
: field of theExperimentData
with which the surrogate was trained. It can be either:states
or:observables
kwargs
: Additional keyword arguments used for simulating the original DEProblem/FMU if the data was generated using JuliaSim infrastructure for the purposes of timing it for computing speedup
Visualising Results
Once the data is generated, the JuliaSimViz
dashboard can be generated in a JuliaSim IDE session by executing the visualise_surrogate_results
function. This will open the dashboard specifically designed to understand and analyse any surrogate model.
Visualisations.visualise_surrogate_results
— FunctionCreates the surrogate dashboard app for visualising in VSCode
visualise_surrogate_results(data; kwargs...)
...
Arguments
data
: Dashboard data dictionary generated usinggenerate_dashboard_data
kwargs
: Optional keyword arugments forPlutoVSCodeApp.create_app
function call
...