Hello everyone, it has been a while since I last wrote. In the first blog, I delineated the objective of the project and the theory supporting uncertainty quantification. This time we’ll be looking into the practical implementation of the dashboard. The application is built upon Dash.
Dash is a productive Python framework for building web analytic applications. Written on top of Flask, Plotly.js, and React.js, Dash is ideal for building data visualization apps with highly custom user interfaces in pure Python. Also, it is open-source, making it easy to understand the documentation and the underlying code.
In addition to Dash, several libraries are used to boost its performance. These include:
- Dash_html_components, a library that provides classes for HTML tags,
- Dash_core_components library which generates higher-level components such as graphs.
- Dash_bootstrap_components which provide multiple themes to customize the User Interface components such as Dropdown lists, Input boxes, Input button.
Dash allows developers to create some functions called Callbacks, these functions are automatically called by dash whenever Input conditions change.
This helps one to create dynamic features such as interactive plots and elements.
DASH WITH EQ
Coming back to our dashboard, the Analytical Model and Offline Model are two methods provided to the user to create polynomials, select basis functions and the solver method and then compute uncertainty.
The Analytical Model contains features such as adding a parameter (maximum 5), defining various properties such as distribution, statistical moments, min/max values and order. Now, as we know that different distribution has different attributes i.e. Uniform distribution has attributes min/max and order whereas Gaussian distribution has attributes mean, variance and order.
This is handled using Dash callbacks. For example, this is the view of the Analytical Model in work.
Data sharing is another concept that helps us to share Polynomial or Parameter data across different callbacks and creating multi-chain callbacks.
The Web-app will be used to perform parametric uncertainty quantification, with polynomials used to approximate expensive-to-compute computational models subject to uncertain inputs.
Before building an app to accept data from real world computational models, I am first building a proof-of-concept app where the model is an analytical function defined by the user. This “analytical” app lets the user define a model function, and its input parameters.
Then, various polynomial bases can be selected (Total-Order, Sparse-grid, Tensor-grid etc.). The specification of eq.Parameter’s and an eq.Basis allows quadrature points to be obtained, which act as a Design of Experiment (DoE), telling us where we must evaluate the model
After evaluating the model internally, the app computes the polynomial coefficients with using the solver method selected by the user. Finally, the polynomial is used to compute the uncertainty in the model’s output due the uncertainty in its inputs, and it plots a 3D plot of the fitted Polynomial on DOE points against the true value computed using function evaluations at these quadrature points.
REMAINING ADDITIONS TO THE DASHBOARD
Exception handling is an important task while creating this dashboard. The workflow for computing uncertainty is strict and rigid as you could not undergo a basis check before defining the parameters. Hence, it is important that the user do not deter from the workflow, this is managed using various dash exceptions such as
Prevent_initial_call. Disabling input boxes or using spinners are few methods that help in exception handling.
Other than this, few changes in the Style and the layout of the components have to be made. Currently, the style of the components is based on SPACELAB theme present in dash_bootstrap_components. This in addition to some CSS styling would provide a great User Interface.
In accordance with the timeline, the Analytical Model would be complete and ready to deploy on a server within a few days. This would be followed by the Offline model, which would work on the user’s custom data. Summing up the blog, there is as much uncertainty in the dashboard being overdue as in France winning the Euros2020 (oh wait!! ).