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 → actions are temporally smooth, low jerk, purposeful Low MI → actions are jerky, hesitant, inconsistent timing

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.

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.2.tar.gz (16.2 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.2-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: democlean-0.1.2.tar.gz
  • Upload date:
  • Size: 16.2 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.2.tar.gz
Algorithm Hash digest
SHA256 d577d3446ea558824a738256b5ea3168207ee24b7f100eb3e8da91616ab22616
MD5 007a9937da9c5bda9dbaafbd2cf541b5
BLAKE2b-256 dd20d12d307309377eb6fcfdf716f545f3b8cba07e83b389273900cc2d66bdb5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: democlean-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 82ecce9dfeb92a26429904fcb683d29264d8d6e8dcf2c1aacbef19fe854ac100
MD5 665ee8d6ceb805128d135040d178a9b9
BLAKE2b-256 9007ae4da8c4b962c2d3c4112460b20dc37a204fea7fc26b0a6706ad729938b2

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