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.

Why

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

democlean scores episodes by motion quality using mutual information (MI) between states and actions.

Install

pip install democlean

Usage

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

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

Mean   2.55   (typical for human teleop)

Flagged (lowest MI)
  ep  46  1.897
  ep   6  1.984

Filtering

democlean analyze lerobot/pusht --keep 0.8           # keep top 80%
democlean analyze lerobot/pusht --min-mi 2.0         # drop below threshold
democlean analyze lerobot/pusht --keep 0.8 -r out.json

What MI Measures

MI quantifies how predictable actions are given states.

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

MI measures how the robot moved, not what it achieved. Use task-specific metrics for success rates.

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

When to Use

Good fit:

  • Human teleoperation data
  • 50+ episodes
  • Quick triage before training

Not a good fit:

  • Scripted simulation (already uniform)
  • Multi-task datasets
  • Need task success metrics

Limitations

  1. Length correlation — MI correlates with episode length (r≈0.8). Use --normalize-length to adjust.
  2. Not task success — Measures motion quality, not task completion.
  3. Sample size — Works best with 50+ episodes.

Python API

from democlean import DemoScorer

scorer = DemoScorer(k=3)
scores = scorer.score_dataset("lerobot/pusht")
keep = scorer.filter_top_k(scores, percentile=80)

CLI Options

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

Credits

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

Complements score_lerobot_episodes for visual quality.

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.5.tar.gz (16.0 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.5-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for democlean-0.1.5.tar.gz
Algorithm Hash digest
SHA256 23766ff479d434bbf0250ddc672773a0456103eec45cb04674f787531899b701
MD5 76bf9773c86c260a887076b0e604d79a
BLAKE2b-256 fa756ef3a39af19a16dc11a6b9bb58f4c8d04d233085f80231c68b6a85270cd7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for democlean-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8dbab38dc184a9d45d6cc6404baf15773d629a40962efdd282c541a78389c967
MD5 67da387e09d88ef0945fc6fe6e28d556
BLAKE2b-256 f29a90ed6a16ce96294468385db683b0c325584d70c75ba89e19f93bd17e8c94

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