Blue Elephants Inspecting Pandas Inspection and Execution of Machine Learning Pipelines in SQL

Maximilian E. Schüle, Luca Scalerandi, Alfons Kemper, Thomas Neumann

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

6 Scopus citations

Abstract

Data preprocessing, the step of transforming data into a suitable format for training a model, rarely happens within database systems but rather in external Python libraries and thus requires extraction from the database systems first. However, database systems are tuned for efficient data access and offer aggregate functions to calculate the distribution frequencies necessary to detect the under- or overrepresentation of a certain value within the data (bias). We argue that database systems with SQL are capable of executing machine learning pipelines aswell as discovering technical biases-introduced by data preprocessing-efficiently. Therefore, we present a set of SQL queries to cover data preprocessing and data inspection: During preprocessing, we annotate the tuples with an identifier to compute the distribution frequency of columns. To inspect distribution changes, we join the preprocessed dataset with the original one on the tuple identifier and use aggregate functions to count the number of occurrences per sensitive column. This allows us to detect operations which filter out tuples and thus introduce a technical bias even for columns preprocessing has removed. To automatically generate such queries, our implementation extends the mlinspect project to transpile existing data preprocessing pipelines written in Python to SQL queries, while maintaining detailed inspection results using views or common table expressions (CTEs). The evaluation proves that a modern beyond main-memory database system, i.e. Umbra, accelerates the runtime for preprocessing and inspection. Even PostgreSQL as a disk-based database system shows similar performance for inspection to Umbra when materialising views.

Original languageEnglish
Title of host publicationProceedings of the 26th International Conference on Extending Database Technology, EDBT 2023
PublisherOpenProceedings.org
Pages40-52
Number of pages13
ISBN (Electronic)9783893180882
DOIs
StatePublished - 2023
Event26th International Conference on Extending Database Technology, EDBT 2023 - Ioannina, Greece
Duration: 28 Mar 202331 Mar 2023

Publication series

NameAdvances in Database Technology - EDBT
Volume26
ISSN (Electronic)2367-2005

Conference

Conference26th International Conference on Extending Database Technology, EDBT 2023
Country/TerritoryGreece
CityIoannina
Period28/03/2331/03/23

Fingerprint

Dive into the research topics of 'Blue Elephants Inspecting Pandas Inspection and Execution of Machine Learning Pipelines in SQL'. Together they form a unique fingerprint.

Cite this