Table of Contents
Fetching ...

PyTracer: Automatically profiling numerical instabilities in Python

Yohan Chatelain, Nigel Yong, Gregory Kiar, Tristan Glatard

TL;DR

PyTracer, a profiler to quantify numerical instability in Python applications, is developed, designed to be agnostic to numerical noise model, allowing for numerical profiling through Monte-Carlo Arithmetic, random rounding, random data perturbation, or structured noise for a particular application.

Abstract

Numerical stability is a crucial requirement of reliable scientific computing. However, despite the pervasiveness of Python in data science, analyzing large Python programs remains challenging due to the lack of scalable numerical analysis tools available for this language. To fill this gap, we developed PyTracer, a profiler to quantify numerical instability in Python applications. PyTracer transparently instruments Python code to produce numerical traces and visualize them interactively in a Plotly dashboard. We designed PyTracer to be agnostic to numerical noise model, allowing for tool evaluation through Monte-Carlo Arithmetic, random rounding, random data perturbation, or structured noise for a particular application. We illustrate PyTracer's capabilities by testing the numerical stability of key functions in both SciPy and Scikit-learn, two dominant Python libraries for mathematical modeling. Through these evaluations, we demonstrate PyTracer as a scalable, automatic, and generic framework for numerical profiling in Python.

PyTracer: Automatically profiling numerical instabilities in Python

TL;DR

PyTracer, a profiler to quantify numerical instability in Python applications, is developed, designed to be agnostic to numerical noise model, allowing for numerical profiling through Monte-Carlo Arithmetic, random rounding, random data perturbation, or structured noise for a particular application.

Abstract

Numerical stability is a crucial requirement of reliable scientific computing. However, despite the pervasiveness of Python in data science, analyzing large Python programs remains challenging due to the lack of scalable numerical analysis tools available for this language. To fill this gap, we developed PyTracer, a profiler to quantify numerical instability in Python applications. PyTracer transparently instruments Python code to produce numerical traces and visualize them interactively in a Plotly dashboard. We designed PyTracer to be agnostic to numerical noise model, allowing for tool evaluation through Monte-Carlo Arithmetic, random rounding, random data perturbation, or structured noise for a particular application. We illustrate PyTracer's capabilities by testing the numerical stability of key functions in both SciPy and Scikit-learn, two dominant Python libraries for mathematical modeling. Through these evaluations, we demonstrate PyTracer as a scalable, automatic, and generic framework for numerical profiling in Python.
Paper Structure (33 sections, 5 equations, 14 figures, 2 tables)

This paper contains 33 sections, 5 equations, 14 figures, 2 tables.

Figures (14)

  • Figure 1: Pytracer workflow
  • Figure 2: Pytracer visualization layout.
  • Figure 3: Absolute value of the mean and standard deviation values for fft 1D inputs within RR mode (log scale). The real part is shown in blue and the imaginary part in orange.
  • Figure 4: Absolute value of the mean and standard deviation values for fft 1D outputs within RR mode (log scale).
  • Figure 5: bspline results within RR mode. sepfir2d and convol2d have a similar precision.
  • ...and 9 more figures