Abstract
VeridicalFlow (vflow) is an open-source Python library designed to bake "trustworthiness" into data science pipelines by automating the Predictability-Computability-Stability (PCS) framework. It allows researchers to easily swap single pipeline steps for sets of alternative "judgment calls"—such as different imputation or scaling methods—to ensure that final scientific conclusions are robust and not merely artifacts of arbitrary coding choices.
Introduction
In a typical data science workflow, practitioners make hundreds of "judgment calls": which outlier detection method to use, how to handle missing values, or which hyperparameters are sufficient. Often, these choices are arbitrary. The danger is that a discovery might only exist under one specific, fragile combination of these choices. This lack of stability is a major contributor to the reproducibility crisis in science.
While frameworks like PCS exist to theorize about these problems, existing software (like standard scikit-learn pipelines) makes it computationally and syntactically exhausting to test every possible combination of these choices. VeridicalFlow aims to bridge this gap by providing a simple interface to build and analyze "perturbed" pipelines.
Methods and Framework
The core innovation of VeridicalFlow is the Vset (Veridical Set) abstraction. Instead of a pipeline step being a single function (e.g., SimpleImputer(strategy='mean')), a Vset represents a collection of functions representing different perturbations (e.g., mean, median, and KNN imputation).
The PCS Pillars
The library is built to support the three pillars of the PCS framework:
- Predictability: Wrappers to screen models based on their predictive performance, acting as a "reality check."
- Computability: Integration with Ray for distributed parallelization and joblib for caching, ensuring that running hundreds of pipeline variations is computationally feasible.
- Stability: Built-in tools to calculate "perturbation statistics" (like mean and standard deviation) across all valid pipeline paths to assess result fluctuations.
Pipeline Execution
When multiple Vsets are connected, the library automatically handles the Cartesian product of all possible paths through the pipeline. Computation is deferred via lazy evaluation, allowing users to build and inspect complex pipeline graphs before committing resources. This dynamic approach is more akin to the computational graphs found in deep learning frameworks like PyTorch than to traditional static pipelines.
Demonstration and Results
As a software announcement, the utility of vflow is demonstrated through a synthetic example using a Random Forest Regressor. The API handles 300 different combinations of data resampling, preprocessing, and hyperparameter tuning with minimal code.
Key features demonstrated include:
- Code Efficiency: Defining a complex perturbed pipeline requires only a few lines of code.
- Automated Analysis: The
perturbation_statsfunction immediately summarizes how stable a metric (e.g., feature importance) is across all variations. - Interoperability: The package works seamlessly with the existing Python ecosystem, specifically
scikit-learn,pandas,MLFlow, andRay.
Discussion and Limitations
VeridicalFlow shifts the focus from finding a single "best" model to understanding the distribution of reasonable models. If a feature remains important across hundreds of pipeline variations, it can be trusted far more than if it appeared in only one. By using vflow, the "science" (deciding which perturbations are reasonable) is separated from the "engineering" (tracking experiments, parallelizing code, and caching results).
However, users must be wary of combinatorial explosion. While parallelization helps, the number of paths grows exponentially with each new Vset. Scientific judgment is still required to choose "reasonable" perturbations rather than testing everything blindly. Future work aims to expand the flexibility of Vsets beyond standard fit/transform methods, allowing for more general, non-linear research workflows.
Summary updated