Skip to main content

title: LabelLens emoji: 🔍 colorFrom: blue colorTo: purple sdk: docker app_file: app.py pinned: false license: mit

Label Lens

Training data quality analyzer for text classification datasets. Upload a CSV with text and label columns, get an automated quality report with actionable recommendations.

Features

  • Auto-detect columns — Automatically identifies text and label columns in your CSV
  • Class distribution analysis — Imbalance ratio, effective number of classes, long-tail detection, suggested focal loss weights
  • Duplicate detection — Exact duplicates and near-duplicates via TF-IDF cosine similarity, with cross-class conflicts flagged as critical
  • Label noise scoring — Cross-validated confidence scoring to surface likely mislabels
  • Actionable report — Severity ratings (Critical/Warning/Info) with specific recommendations
  • Interactive visualizations — Plotly charts for exploring your data

Quick Start

As a web app

pip install label-lens[app]
streamlit run app.py

Or with uv:

uv sync
uv run streamlit run app.py

A sample dataset is included for demo purposes.

As a library

pip install label-lens
import pandas as pd
from label_lens import (
    analyze_distribution,
    find_exact_duplicates,
    find_near_duplicates,
    score_label_noise,
    generate_report,
)

df = pd.read_csv("your_dataset.csv")  # must have 'text' and 'label' columns

dist = analyze_distribution(df)
dups = find_exact_duplicates(df)
near_dups = find_near_duplicates(df)
noise = score_label_noise(df)

report = generate_report(dist, dups, near_dups, noise)
print(report["overall_severity"])  # "Critical", "Warning", or "Info"
print(report["recommendations"])

If your CSV uses different column names, use prepare_dataframe to standardize them:

from label_lens import prepare_dataframe

df = prepare_dataframe(raw_df, text_col="content", label_col="category")

Installation

Requires Python 3.13+.

# Library only (pandas, numpy, scikit-learn)
pip install label-lens

# With Streamlit app and Plotly charts
pip install label-lens[app]

# Development
pip install label-lens[dev]

How It Works

Distribution analysis computes imbalance ratio, entropy-based effective class count, and identifies long-tail classes (<1% representation). It also calculates inverse-frequency focal loss alpha values.

Duplicate detection finds exact text matches and uses TF-IDF vectorization with chunked cosine similarity to find near-duplicates. Cross-class duplicates (same text, different labels) are flagged as critical since they represent definite labeling errors.

Noise scoring trains a logistic regression on TF-IDF features using stratified k-fold cross-validation. For each sample, it records the model's confidence in the given label. The bottom 5th percentile by confidence are flagged as mislabel suspects.

Project Structure

label_lens/
├── ingest.py         # Column detection, validation, DataFrame prep
├── distribution.py   # Class distribution analysis + visualization
├── duplicates.py     # Exact and near-duplicate detection
├── noise.py          # Label noise scoring via cross-validated confidence
├── report.py         # Aggregate findings and generate recommendations
└── utils.py          # Shared helpers

Development

# Install dev dependencies
uv sync --all-extras

# Run tests
pytest tests/ -v

# Lint and format
ruff check .
ruff format .

Deployment

Label Lens is designed for deployment on Hugging Face Spaces using Docker. The Dockerfile at the repo root handles the build.

Tech Stack

  • Python 3.13+
  • Streamlit
  • pandas / numpy
  • scikit-learn (TF-IDF, logistic regression, cross-validation)
  • Plotly

License

MIT


Built by Mike Noe

Metadata

Release files for label-lens 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for label-lens 0.1.0
File Size Uploaded Provenance Actions
label_lens-0.1.0.tar.gz 13.7 kB Without provenance Details for label_lens-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for label-lens 0.1.0
File Interpreter ABI Platform Actions
label_lens-0.1.0-py3-none-any.whl Python 3 none any Details for label_lens-0.1.0-py3-none-any.whl

Total release size: 25.8 kB

Release files / label_lens-0.1.0.tar.gz

Download URL label_lens-0.1.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6d07edddf9272a0fd0126dc3c63531de61cc1b61eba93f7f1280e07dbfe8a51e
BLAKE2b-256 checksum
How to use checksums
3fd9259602b2cd51106c158fdb16f9549d529b844228f8aa107191e571ecb150
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / label_lens-0.1.0-py3-none-any.whl

Download URL label_lens-0.1.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e0d1befe7716fdea22d44612d89133f55ac47eb1f412380febcb6232269e1f8
BLAKE2b-256 checksum
How to use checksums
d4e05db21e8fa7188488ad0a00af33c881488147667301c263596ccc0200996e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for label-lens 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page