The Dirty Data/Artificial Intelligence Machine Learning Paradox

The Dirty Data/Artificial Intelligence Machine Learning Paradox

Bad data can ruin a machine learning process. Learn why data is important for a ML algorithm and how sanitizepy tries to clean dirty data.

Series: Attention because it's all you need. (14 articles)

  1. 2
    The Dirty Data/Artificial Intelligence Machine Learning Paradox This article
Machine Learning Engineer | Frontend Developer | Deep Learning & Generative AI | RAG, MLOps & AWS

Dirty data and AI/ML

Machine Learning model can be mathematically correct, well-trained and yet produce awful results. Sometimes, the issue is not the model. It's the data.**** Missing values, duplicates, inconsistent data types, incorrect values, unusual strings, outliers and messy columns can silently destroy the whole Machine Learning pipeline. Which leads to a question:**** Why are we still treating data cleaning as a bunch of random pandas methods?

The Issue With Traditional Data Cleaning

Many data cleaning pipelines eventually become something like:
df.drop_duplicates()
df.fillna(...)
df["age"] = ...
df["name"] = ...
It works, but what happens if someone asks: What was wrong with the dataset? Why was this particular value modified? What exact changes were made during the cleaning process? Did the dataset improve after that? Individual methods may be fine. The real problem is understanding and control over the entire cleaning process.

What Is sanitizepy?

It is the problem sanitizepy solves. sanitizepy is an open-source Python package for tabular data quality inspection, explainable cleaning, preprocessing, profiling, anomaly detection and validation. The key principle is understanding the dataset before making any modifications. Rather than immediately making changes to DataFrame, the workflow might look like this:
Inspect → Plan → Clean → Profile → Validate
The inspection stage produces a dataset health score and actual findings. The cleaning plan is previewed before executing it and the cleaning process is designed to be deterministic and traceable.

What Makes It Unique?

Not that it cannot fill the missing values or remove duplicates. These operations already exist. The question is**** What if data cleaning could explain itself?**** sanitizepy provides findings with information about what is wrong, why it matters, severity and evidence. Before-after impact metrics and audit trail is provided rather than making silent modifications of the input dataset. In addition to that, it offers profiling, data contracts, anomaly detection, text quality analysis, type coercion, text normalization, encoding repair and near-duplicates detection.

Why is It Important For AI/ML?

Before training a Machine Learning model, the dataset is prepared. But preparation should not mean: "Run a few cleaning methods and hope everything will be fine." It should mean:
Understand the data → identify issues → apply deliberate changes → measure the impact → validate the result.
That is what sanitizepy does. I am building it based on the following principle: Better data preparation means better foundations for Machine Learning.

How Is This Project Evolving?

sanitizepy is currently in development. It is not a set of useful pandas functions I am trying to develop here. It is a reliable, transparent data quality layer before Machine Learning. And this is just the beginning.

Series: Attention because it's all you need. (14 articles)

  1. 2
    The Dirty Data/Artificial Intelligence Machine Learning Paradox This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article