Sanity checks for ML datasets: missing values, class imbalance, and data leakage.
Project description
DatasetSanity ๐งช
DatasetSanity is a lightweight Python package that helps data scientists and machine learning engineers identify common dataset issues before model training. It performs automated sanity checks on tabular datasets to detect missing values, severe class imbalance, and potential target leakageโissues that often lead to misleading model performance. DatasetSanity provides clear, actionable reports and integrates easily into existing ML workflows.
It helps detect common but critical data issuesโsuch as missing values, class imbalance, and potential data leakageโbefore model training.
Fix data problems before the model hides them.
๐ Why DatasetSanity?
Machine learning models can silently fail or produce misleading results due to poor dataset quality.
DatasetSanity is designed to fail fast by surfacing dataset issues early in the ML pipeline.
It is:
- โ Simple to use
- โก Lightweight
- ๐ฆ Easy to integrate
- ๐ Student-friendly
- ๐ Production-ready
โจ Features
-
๐ Missing Value Analysis
- Percentage of missing values per column
- Detection of empty columns and sparse rows
-
โ Class Imbalance Detection
- Binary and multi-class classification support
- Configurable imbalance thresholds
-
๐จ Data Leakage Detection
- Target-correlated features
- Duplicate target columns
- Train-test overlap checks (optional)
-
๐ Clear Reports
- Human-readable console output
- JSON output for pipelines (HTML planned)
๐ฆ Installation
How to run?
Create a conda environment
conda create -n datasanity python=3.8 -y
conda activate datasanity
pip install -r requirements_dev.txt
pip install datasetsanity
๐ง Quick Start (Python API)
from DatasetSanity import DatasetSanity
import pandas as pd
df = pd.read_csv("data.csv")
ds = DatasetSanity(
df=df,
target="label",
task="classification"
)
report = ds.run()
report.summary()
๐ฅ Command Line Interface (CLI)
datasetsanity check data.csv --target label
Example output:
โ Missing values check passed
โ Class imbalance detected
โ Potential data leakage found
๐ Report Export
report.to_json("report.json")
(HTML reports planned in future releases.)
๐ฏ Use Cases
- ML students validating datasets
- Data scientists performing pre-model checks
- ML engineers integrating dataset validation into pipelines
- Educators teaching data quality concepts
๐ Project Structure
DataSetSanity-PyPi-Package/
โโโ .github/
โ โโโ workflows/
โ โโโ .gitkeep
โ โโโ ci.yml
โโโ docs/ # optional documentation
โโโ src/
โ โโโ datasetsanity/
โ โโโ __init__.py
โ โโโ custom_exception.py
โ โโโ logger.py
โ โโโ py.typed
โโโ tests/
โ โโโ __init__.py
โ โโโ unit/
โ โ โโโ __init__.py
โ โ โโโ test_unit.py
โ โโโ integration/
โ โโโ __init__.py
โ โโโ test_int.py
โโโ .gitignore
โโโ LICENSE
โโโ MANIFEST.in
โโโ README.md
โโโ CONTRIBUTING.md
โโโ requirements.txt
โโโ requirements_dev.txt
โโโ setup.py
โโโ setup.cfg
โโโ pyproject.toml
โโโ template.py # cookiecutter template
โโโ pypi.ipynb # PyPI release notebook
โโโ pypi.excalidraw # PyPI release diagram
โโโ tox.ini
โโโ test.py # sandbox testing
๐ฃ Roadmap
- Regression task support
- Feature drift detection
- HTML & visual reports
- sklearn pipeline integration
- CI/CD dataset checks
๐ค Contributing
Contributions are welcome! Please read CONTRIBUTING.md before submitting issues or pull requests.
๐ License
This project is licensed under the MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datasetsanity-0.0.1.tar.gz.
File metadata
- Download URL: datasetsanity-0.0.1.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f7985a9f8eb5e2cdcafdcf3cef4e9e5783dc5b23fcb6e259579292fece44661
|
|
| MD5 |
e8fec86fb16c388efb01b1e90a49edfa
|
|
| BLAKE2b-256 |
a1b7f6b820cf33499530d77b4ed728aefcdce8261e37d35e907dff957dc02ade
|
File details
Details for the file datasetsanity-0.0.1-py3-none-any.whl.
File metadata
- Download URL: datasetsanity-0.0.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fa13e9be605713d4eb6451c3b01c1c57eec46cc2b0686e4cb54dddc1f0e2a3a
|
|
| MD5 |
5fc706faa8db89f95ccc12ab1e5961d9
|
|
| BLAKE2b-256 |
a4ccbb6fd44c6164aec9989e9eb68827db0623b98bfe9d83ae8b4c1d16f2a5c8
|