Skip to main content

Score robot demonstrations by motion quality

Project description

democlean

PyPI License: MIT Python 3.10+

Quality scoring for robot demonstration datasets.

The Problem

Robot learning datasets often contain bad demonstrations—jerky movements, hesitation, inconsistent timing. Training on these hurts policy performance. Manual review doesn't scale.

democlean automatically scores episodes by motion quality using mutual information (MI) between states and actions. Episodes with smooth, purposeful motion score high. Jerky, inconsistent episodes score low.

Install

pip install democlean

Quick Start

democlean analyze lerobot/pusht

Output:

Dataset lerobot/pusht
Episodes: 50 | Dims: 2→2

Distribution
  ████████████████████  High   30
  ██████████            Medium 15
  █████                 Low     5

Mean   2.55   (typical for human teleop)
Std    0.27

Flagged (lowest MI)
  ep  46  1.897
  ep   6  1.984

What MI Measures

MI quantifies how predictable actions are given states.

  • High MI → smooth, purposeful motion
  • Low MI → jerky, hesitant, inconsistent

This is useful because motion quality correlates with demonstration quality. But MI is not a direct measure of task success—it measures how the robot moved, not what it achieved.

Score Ranges

MI Interpretation
>3.0 Very smooth
2.0–3.0 Typical human teleop
1.0–2.0 Moderate
<1.0 Noisy/random

Filtering Episodes

Keep top 80%:

democlean analyze lerobot/pusht --keep 0.8

Drop below threshold:

democlean analyze lerobot/pusht --min-mi 2.0

Save report:

democlean analyze lerobot/pusht --keep 0.8 -r report.json

Limitations

  1. Length correlation: MI correlates with episode length (r≈0.8). Longer episodes score higher. Use --normalize-length to adjust.

  2. Not task success: MI measures motion smoothness, not whether the task was completed. Use task-specific metrics for that.

  3. Sample size: Works best with 50+ episodes. Small datasets may not show meaningful variation.

When to Use

Good fit:

  • Human teleoperation data (quality varies by demonstrator)
  • Single task, single robot
  • 50+ episodes
  • Quick triage before training

Not a good fit:

  • Scripted simulation data (already uniform)
  • Multi-task datasets (MI biases toward easy tasks)
  • You need task success metrics

Python API

from democlean import DemoScorer

scorer = DemoScorer(k=3)
scores = scorer.score_dataset("lerobot/pusht")

# Filter
keep = scorer.filter_top_k(scores, percentile=80)
print(f"Keep episodes: {keep}")

CLI Reference

democlean analyze <dataset> [options]

Options:
  --keep R            Keep top R fraction (0-1)
  --top-k K           Keep top K episodes
  --min-mi T          Drop episodes below MI threshold
  --normalize-length  Adjust for episode length
  -k N                KSG neighbors (default: 3)
  --max-dim D         PCA reduce to D dimensions
  --ci                Bootstrap confidence intervals
  -r FILE             Save JSON report
  -q                  Quiet mode (JSON output only)
  --explain           Show interpretation guide

Credits

Inspired by DemInf (Hejna et al., RSS 2025).

Complements score_lerobot_episodes which catches visual issues—democlean catches motion issues.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

democlean-0.1.3.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

democlean-0.1.3-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file democlean-0.1.3.tar.gz.

File metadata

  • Download URL: democlean-0.1.3.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for democlean-0.1.3.tar.gz
Algorithm Hash digest
SHA256 7a07266cc933f34b6a201feda623f393d017759ead13367b1120876f04db5bc3
MD5 bd117fa047c88e216182976eb5bd6f23
BLAKE2b-256 b4dee4544cbeb0725d859cf06f8d55a3287f2fe71ce1c30a242e214210bb99a0

See more details on using hashes here.

File details

Details for the file democlean-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: democlean-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for democlean-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 64c168b576f3061ce66cfcdfe056f8755012519a798240af688bde041cbd09d7
MD5 2cc22a3b83c977d21009a6c91cc07578
BLAKE2b-256 64054f31a29d9c176da14853722412f2e4e2fdd585d1fbed0497abb26f54c344

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page