Package: profit
Probabilistic Response Model Fitting with Interactive ToolsThis is a collection of tools for studying parametric dependencies of
black-box simulation codes or experiments and construction of reduced
order response models over input parameter space.proFit can be fed with a number of data points consisting of different
input parameter combinations and the resulting output of the simulation under
investigation. It then fits a response-surface through the point cloud
using Gaussian process regression (GPR) models.
This probabilistic response model allows to predict ("interpolate") the output
at yet unexplored parameter combinations including uncertainty estimates.
It can also tell you where to put more training points to gain maximum new
information (experimental design) and automatically generate and start
new simulation runs locally or on a cluster. Results can be explored and checked
visually in a web frontend.Telling proFit how to interact with your existing simulations is easy
and requires no changes in your existing code. Current functionality covers
starting simulations locally or on a cluster viaSlurm, subsequent
surrogate modelling usingGPy,scikit-learn,
as well as an active learning algorithm to iteratively sample at interesting
points and a Markov-Chain-Monte-Carlo (MCMC) algorithm. The web frontend to interactively explore the point cloud
and surrogate is based onplotly/dash.FeaturesCompute evaluation points (e.g. from a random distribution) to run simulationTemplate replacement and automatic generation of run directoriesStarting parallel runs locally or on the cluster (SLURM)Collection of result output and postprocessingResponse-model fitting using Gaussian Process Regression and Linear RegressionActive learning to reduce number of samples neededMCMC to find a posterior parameter distribution (similar to active learning)Graphical user interface to explore the resultsInstallationCurrently, the code is under heavy development, so it should be cloned
from GitHub via Git and pulled regularly.Requirementssudoaptinstallpython3-devbuild-essentialTo enable compilation of the fortran modules the following is needed:sudoaptinstallgfortranDependenciesnumpy, scipy, matplotlib, sympy, pandasChaosPyGPyscikit-learnh5pyplotly/dash- for the UIZeroMQ- for messagingsphinx - for documentation, only needed whendocsis specifiedtorch, GPyTorch - only needed whengpuis specifiedAll dependencies are configured insetup.cfgand should be installed automatically when usingpip.Automatic tests usepytest.Windows 10To install proFit under Windows 10 we recommend usingWindows Subsystem
for Linux (WSL2)with the Ubuntu 20.04 LTS distribution (install guide).After the installation of WSL2 execute the following steps in your Linux terminal (when asked pressyto continue):Make sure you have the right version of Python installed and the basic developer toolset availablesudoaptupdate
sudoaptinstallpython3python3-pippython3-devbuild-essentialTo install proFit from Git (see below), make sure that the project is located in the Linux file system
not the Windows system.To configure the Python interpreter available in your Linux distribution in pycharm
(tested with professional edition) follow thisguide.Installation from PyPITo install the latest stable version of proFit, usepipinstallprofitFor the latest pre-release, usepipinstall--preprofitInstallation from GitTo install proFit for the current user (--user) in development-mode (-e) use:gitclonehttps://github.com/redmod-team/profit.gitcdprofit
pipinstall-e.--userFortranCertain surrogates require a compiled Fortran backend. To enable compilation of the fortran modules during install:USE_FORTRAN=1 pip install .Troubleshooting installation problemsMake sure you have all the requirements mentioned above installed.Ifpipis not recognized try the following:python3-mpipinstall-e.--userIf pip warns you about PATH or proFit is not found close and reopen the terminal
and typeprofit --helpto check if the installation was successful.Documentation usingSphinxInstall requirements for building the documentation usingsphinxpip install .[docs]Additionallypandocis required on a system level:sudo apt install pandocHowToExamples for different model codes are available underexamples/:fit: Simple fit via python interface.mockup: Simple model called by console command based on template directory.Also, the integration tests undertests/integration_tests/may be informative examples:active_learning:1D: One dimensional mockup with active learning2D: Two dimensional mockup with active learningLog: Active learning with logarithmic search spaceMCMC: Markov-Chain-Monte-Carlo application to mockup experimental datamockup:1D2DCustom postprocessor: Instead of the prebuilt postprocessor, a user-built class is used.Custom worker: A user-built worker function is used.Independent: Output with an independent (linear) variable additional to input parameters: f(t; u, v).KarhunenLoeve: Multi output surrogate model with Karhunen-Loeve encoder.Multi output: Multi output surrogate with two different output variables.StepsCreate and enter a directory (e.g.study) containingprofit.yamlfor your run.
If your code is based on text configuration files for each run, copy the according directory totemplateand
replace values of parameters to be varied within UQ/surrogate models by placeholders{param}.Running the simulations:profitrunto start simulations at all the points. Per default the generated input variables are written toinput.txtand the
output data is collected inoutput.txt.For each run of the simulation, proFit creates a run directory, fills the templates with the generated input data and
collects the results. Each step can be customized with theconfiguration file.To fit the model:profitfitCustomization can be done withprofit.yamlagain.Explore data graphically:profituistarts a Dash-based browser UIThe figure below gives a graphical representation of the typical profit workflow described above.
The boxes in red describe user actions while the boxes in blue are conducted by profit.ClusterproFit supports scheduling the runs on a cluster usingslurm. This is done entirely via the configuration files and
the usage doesn't change.profit uistarts adashserver and it is possible to remotely connect to it (e.g. viassh port forwarding)User-supplied filesaconfiguration file: (default:profit.yaml)Add parameters and their distributions viavariablesSet paths and filenamesConfigure the run backend (how to interact with the simulation)Configure the fit / surrogate modelthetemplatedirectorycontaining everything a simulation run needs (scripts, links to executables, input files, etc)input files use a template format where{variable_name}is substituted with the generated valuesa customPostprocessor(optional)if the default postprocessors don't work with the simulation a custom one can be specified using theincludeparameter in the configuration.Example directory structure: