June 16, 2016

Parameter fit as a run-ready workflow

 

Every day we strive to simplify working in pSeven for our users. No matter how complex the task is, pSeven enables workflow experts to prepare some frequently used computation in the form of a run-ready workflow, simplifying the problem for their colleagues by creating a user-friendly pSeven-based application for this specific task. Of course, this approach requires a lot of flexibility from the system, both in run-time computation (which is achieved by generic blocks like PythonScript or ShellScript) and in visualization (see Custom visualization with PageViewer). Our goal is to give experts the opportunity to capture their knowledge in an easily reusable form.

Let us see how you can create a run-ready workflow for a generic computation problem. Suppose you have a 1D sample that must be fit by some function (curve) with several parameters. For maximum flexibility we will treat this function as a custom expression y=f(x, A, B, C, ...) with an unknown number of parameters to tune. Fitting is performed using a non-linear least squares method that requires solving a potentially non-trivial optimization problem depending on the fit expression.

The workflow solving this problem contains 3 main parts. The first one is input validation, so incorrect parameter input will produce clear diagnostic messages. Then we go into an optimization loop that actually performs fitting, using pSeven's capabilities for global optimization. The final part consists of a few visualization blocks that generate images to be shown on the Analyze screen.

Figure 1. Workflow on the Run screen

As it is a run-ready workflow, you can configure it directly from the Run screen without editing the workflow itself. Not only this simplifies the configuration as you see only the relevant parameters (selected by expert), but also enables using the workflow in pSeven Runner. On the Run screen you can select a sample file and specify the fitting function (figure 1, [1]). Then you run the workflow and see found parameter values on the Outputs pane (figure 1, [2]). For more details, you can also switch to the Analyze screen to see how the solution evolved over time (figure 1, [3]).

Figure 2. Visualization using Page Viewer

In Analyze you find the full process history including the fit visualization, the current fit expression and parameter values (figure 2, [1]). You can browse through optimization steps using the page selector (figure 2, [2]). Note that just like the workflow, the report is also pre-configured by an expert to immediately show the most important aspects of the solution.

This workflow can be found in the example projects bundled with the recent pSeven 6.7 release. As every other run-ready workflow, it can be used both as a ready problem solving tool and as a starting point for your own run-ready workflows.

 

Figure 3. Parameter fit solution 

 

 

By Alexey Nazarenko, Senior Software Engineer, DATADVANCE