Drap: A Python Library for Representing and Computing with Arbitrary Empirical Probability Distributions

Drap: A Python Library for Representing and Computing with Arbitrary Empirical Probability Distributions
Chatura Samarakoon, Bilgesu Bilgin, Orestis Kaparounakis, Vasileios Tsoutsouras, and Phillip Stanley-Marbell. Under review, ACM Transactions on Mathematical Software (TOMS).

Abstract

This article presents Drap: a Python library for creating finite-dimensional representations of arbitrary probability distributions and carrying out arithmetic operations with these representations. The library implements two distribution representation methods and the associated arithmetic propagation rules required to compute with distributional information. We present the mathematical foundations underlying these methods and quantify the effect of the representation size on representation and propagation errors in terms of the Wasserstein distance. The results show that the errors asymptotically vanish as the inverse of the size of the representation. This allows Drap representations to be tuned to fit the constraints of a wide variety of applications, from those running on resource constrained embedded systems to large hardware-accelerated machine learning models. We show how Drap can leverage distributional information in a variety of such applications from finance modeling and sensor calibration to computer vision and robotics. We compare Drap to other common Python based probabilistic programming libraries to evaluate its features and performance.The results show that Drap performs 3× to 100× faster than Monte Carlo using Python loops (via Pyro) and in some benchmarks more than 500× faster than PaCAL, while achieving similar result accuracy.