raftaar 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- raftaar-0.1.0/CHANGELOG.md +78 -0
- raftaar-0.1.0/LICENSE +202 -0
- raftaar-0.1.0/MANIFEST.in +7 -0
- raftaar-0.1.0/PKG-INFO +242 -0
- raftaar-0.1.0/README.md +203 -0
- raftaar-0.1.0/examples/demo-video-script.md +208 -0
- raftaar-0.1.0/pyproject.toml +66 -0
- raftaar-0.1.0/setup.cfg +4 -0
- raftaar-0.1.0/src/raftaar/__init__.py +19 -0
- raftaar-0.1.0/src/raftaar/cli.py +101 -0
- raftaar-0.1.0/src/raftaar/metrics.py +479 -0
- raftaar-0.1.0/src/raftaar/provenance.py +110 -0
- raftaar-0.1.0/src/raftaar/report.py +155 -0
- raftaar-0.1.0/src/raftaar/synth.py +275 -0
- raftaar-0.1.0/src/raftaar/validate.py +161 -0
- raftaar-0.1.0/src/raftaar.egg-info/PKG-INFO +242 -0
- raftaar-0.1.0/src/raftaar.egg-info/SOURCES.txt +25 -0
- raftaar-0.1.0/src/raftaar.egg-info/dependency_links.txt +1 -0
- raftaar-0.1.0/src/raftaar.egg-info/entry_points.txt +2 -0
- raftaar-0.1.0/src/raftaar.egg-info/requires.txt +26 -0
- raftaar-0.1.0/src/raftaar.egg-info/top_level.txt +1 -0
- raftaar-0.1.0/tests/test_detectors.py +209 -0
- raftaar-0.1.0/tests/test_packaging.py +193 -0
- raftaar-0.1.0/web/Dockerfile +21 -0
- raftaar-0.1.0/web/README.md +19 -0
- raftaar-0.1.0/web/app.py +149 -0
- raftaar-0.1.0/web/templates/index.html +260 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
Named **Raftaar** — رفتار, *behaviour*, in Persian, Turkish and Urdu.
|
|
6
|
+
|
|
7
|
+
Behaviour cloning is the paradigm this tool serves, so the name says what the
|
|
8
|
+
library is about in one word to anyone who knows the field, and pairs with
|
|
9
|
+
[daftar](https://pypi.org/project/daftar/) (دفتر, *ledger*) as a second package
|
|
10
|
+
by the same author.
|
|
11
|
+
|
|
12
|
+
Renamed twice before release, from DemoScope via KineLens. "Demo" reads as a
|
|
13
|
+
demonstration *of a product* rather than demonstration *data*.
|
|
14
|
+
|
|
15
|
+
Deliberately not named `trajlint`, `trajscope` or `trajaudit`, all of which were
|
|
16
|
+
free: `trajlens` already exists on PyPI as a structural linter for LeRobot
|
|
17
|
+
datasets, and those names would read as derivative of a tool operating one layer
|
|
18
|
+
below this one.
|
|
19
|
+
|
|
20
|
+
`rename.py` is kept in the repository until first publication, so the name stays
|
|
21
|
+
cheap to change. It detects the current package name from `src/` rather than
|
|
22
|
+
hardcoding it, so it works however many times it is run.
|
|
23
|
+
|
|
24
|
+
## Packaging work (pre-release)
|
|
25
|
+
|
|
26
|
+
Raftaar existed as a working prototype: five detectors, a synthetic
|
|
27
|
+
environment with injected faults, a validation harness, a CLI and a browser
|
|
28
|
+
demo. This release turns it into something installable with `pip install
|
|
29
|
+
raftaar` without changing what the detectors do.
|
|
30
|
+
|
|
31
|
+
### Packaging
|
|
32
|
+
|
|
33
|
+
- `src/` layout, `pyproject.toml`, Apache 2.0 licence, `raftaar` console
|
|
34
|
+
script replacing `python -m raftaar.cli`.
|
|
35
|
+
- **The dependency surface is now three packages**: numpy, scipy,
|
|
36
|
+
scikit-learn. The prototype's `requirements.txt` also pulled matplotlib,
|
|
37
|
+
Flask and gunicorn — a web server and a plotting stack, for a CPU dataset
|
|
38
|
+
audit. Those are now the `[plot]` and `[web]` extras.
|
|
39
|
+
- `matplotlib` is imported lazily inside `report.plot()`. `raftaar scan`
|
|
40
|
+
writes its JSON and markdown on a machine without it and prints what it
|
|
41
|
+
skipped, instead of failing after the scan you just waited for.
|
|
42
|
+
- The Flask demo, its templates and the Dockerfile moved to `web/`, outside the
|
|
43
|
+
installable package. They are the Cloud Run demo, not the library.
|
|
44
|
+
|
|
45
|
+
### Tests
|
|
46
|
+
|
|
47
|
+
29 tests, where there were none. The detector tests are the point: every fault
|
|
48
|
+
is injected deliberately into the synthetic environment, so each detector is
|
|
49
|
+
scored against ground truth, in both directions — sensitivity (an injected
|
|
50
|
+
fault must be caught) and specificity (clean data must stay quiet).
|
|
51
|
+
|
|
52
|
+
Also pinned: the CLI round-trip, the public API, that importing `raftaar`
|
|
53
|
+
pulls neither matplotlib nor Flask nor torch, and that the synthetic
|
|
54
|
+
environment is deterministic under a fixed seed — which it has to be, since it
|
|
55
|
+
is the ground truth everything else is scored against.
|
|
56
|
+
|
|
57
|
+
### A documented limitation
|
|
58
|
+
|
|
59
|
+
Writing the specificity tests surfaced something the README had overstated.
|
|
60
|
+
"Clean data → no warnings" holds at 120 episodes, but below roughly 90
|
|
61
|
+
`ACTION_INCONSISTENCY` fires at *warning* severity on clean data. Near-identical
|
|
62
|
+
states genuinely do disagree when there are few episodes per region of the state
|
|
63
|
+
space, so the detector is under-powered rather than wrong — but a user scanning
|
|
64
|
+
40 episodes sees a warning on data that is fine.
|
|
65
|
+
|
|
66
|
+
Both behaviours are now pinned by tests, and the README says so. The test for
|
|
67
|
+
the spurious warning carries a note that if it ever starts failing because the
|
|
68
|
+
warning no longer appears, that is an improvement and the test should be
|
|
69
|
+
deleted.
|
|
70
|
+
|
|
71
|
+
### Optional provenance
|
|
72
|
+
|
|
73
|
+
`raftaar.provenance` records what produced a scan — dataset content hash,
|
|
74
|
+
Raftaar version, every detector's headline number — using
|
|
75
|
+
[daftar](https://pypi.org/project/daftar/) when installed. Entirely optional:
|
|
76
|
+
`available()` is checked before anything is imported, `track()` yields `None`
|
|
77
|
+
when daftar is absent, and `tracked_scan()` returns exactly what
|
|
78
|
+
`scan(load_dataset(path))` returns either way.
|
raftaar-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
raftaar-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: raftaar
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Know what your robot demonstrations will teach, before you train. Predicts which policy class will fail on a dataset, and where.
|
|
5
|
+
Author: Aslan Satary Dizaji
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/aslansd/raftaar
|
|
8
|
+
Project-URL: Repository, https://github.com/aslansd/raftaar
|
|
9
|
+
Project-URL: Issues, https://github.com/aslansd/raftaar/issues
|
|
10
|
+
Keywords: robotics,behaviour-cloning,imitation-learning,dataset-quality,demonstrations,lerobot,data-curation
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: numpy>=1.26
|
|
19
|
+
Requires-Dist: scipy>=1.11
|
|
20
|
+
Requires-Dist: scikit-learn>=1.4
|
|
21
|
+
Provides-Extra: plot
|
|
22
|
+
Requires-Dist: matplotlib>=3.8; extra == "plot"
|
|
23
|
+
Provides-Extra: validate
|
|
24
|
+
Requires-Dist: matplotlib>=3.8; extra == "validate"
|
|
25
|
+
Provides-Extra: web
|
|
26
|
+
Requires-Dist: flask>=3.0; extra == "web"
|
|
27
|
+
Requires-Dist: gunicorn>=22.0; extra == "web"
|
|
28
|
+
Provides-Extra: provenance
|
|
29
|
+
Requires-Dist: daftar>=0.8; extra == "provenance"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
32
|
+
Requires-Dist: matplotlib>=3.8; extra == "dev"
|
|
33
|
+
Provides-Extra: all
|
|
34
|
+
Requires-Dist: matplotlib>=3.8; extra == "all"
|
|
35
|
+
Requires-Dist: flask>=3.0; extra == "all"
|
|
36
|
+
Requires-Dist: gunicorn>=22.0; extra == "all"
|
|
37
|
+
Requires-Dist: daftar>=0.8; extra == "all"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
# Raftaar
|
|
41
|
+
|
|
42
|
+
**رفتار** — *behaviour.* The same word in Persian, Turkish and Urdu.
|
|
43
|
+
|
|
44
|
+
**Know what your demonstrations will teach, before you train.**
|
|
45
|
+
|
|
46
|
+
Raftaar reads a robot demonstration dataset and predicts *which policy class
|
|
47
|
+
will fail on it, and where* — without training anything. It runs on a CPU in
|
|
48
|
+
minutes.
|
|
49
|
+
|
|
50
|
+
Structural validators ("is this file corrupt, are the camera intrinsics valid")
|
|
51
|
+
are commoditising fast. Raftaar works one level up, on the **distribution**:
|
|
52
|
+
the geometry of the demonstrations themselves, and what a learning algorithm
|
|
53
|
+
will converge to when trained on them.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install raftaar
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Python 3.10+. Apache 2.0. Three dependencies — numpy, scipy, scikit-learn. No
|
|
60
|
+
GPU, no torch, no downloads.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## The failure that matters
|
|
65
|
+
|
|
66
|
+
A dataset containing two valid but incompatible strategies — half the operators
|
|
67
|
+
reach around an obstacle on the left, half on the right — will train a
|
|
68
|
+
regression policy to do neither. The policy converges to the average, the
|
|
69
|
+
average is a path nobody demonstrated, and **the training loss goes down the
|
|
70
|
+
entire time**.
|
|
71
|
+
|
|
72
|
+
Validation loss does not catch it either, because the validation split has the
|
|
73
|
+
same structure as the training split. The same is true of coverage holes, of
|
|
74
|
+
silent recalibrations mid-collection, and of actuator channels that stopped
|
|
75
|
+
moving. Every one of these is detectable before training. None of them is
|
|
76
|
+
currently detected.
|
|
77
|
+
|
|
78
|
+
### Where this sits
|
|
79
|
+
|
|
80
|
+
The robot-data tooling layer is filling in from the bottom. Structural linters
|
|
81
|
+
that check schemas, timestamps and decodability already exist and are improving
|
|
82
|
+
fast — `trajlens` is one, and it audits the public LeRobot Hub today. That layer
|
|
83
|
+
is commoditising and Raftaar does not compete with it.
|
|
84
|
+
|
|
85
|
+
Raftaar works on the layer above: not "is this file valid" but **"what will a
|
|
86
|
+
policy learn from this distribution, and which policy class will fail"**. The
|
|
87
|
+
two are complementary — run a structural linter first, then this.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Quickstart
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# 1. A dataset with known, deliberately injected faults
|
|
95
|
+
raftaar synth field_data --episodes 120 \
|
|
96
|
+
--faults bimodal_detour coverage_hole demonstrator_jitter camera_shard dead_actuator
|
|
97
|
+
|
|
98
|
+
# 2. Diagnose it — no training
|
|
99
|
+
raftaar scan datasets/field_data --out reports/field_data
|
|
100
|
+
|
|
101
|
+
# 3. Check the diagnosis was right — train policies and roll them out
|
|
102
|
+
raftaar validate datasets/field_data --trials 40
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
From Python:
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from raftaar import load_dataset, scan
|
|
109
|
+
|
|
110
|
+
report = scan(load_dataset("datasets/field_data"))
|
|
111
|
+
for finding in report["findings"]:
|
|
112
|
+
print(finding["severity"], finding["id"], finding["where"])
|
|
113
|
+
print(" ", finding["what"])
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## The five detectors
|
|
119
|
+
|
|
120
|
+
| Detector | Question it answers |
|
|
121
|
+
|---|---|
|
|
122
|
+
| `AVERAGING_HAZARD` | Do demonstrations contain competing strategies whose *average* is a trajectory nobody performed? |
|
|
123
|
+
| `COVERAGE_GAP` | Which task conditions were never demonstrated? (sample-size aware — sparsity is not a hole) |
|
|
124
|
+
| `ACTION_INCONSISTENCY` | Do different episodes, in near-identical states, disagree on what to do? |
|
|
125
|
+
| `REPRESENTATION_SHARD` | Was part of this dataset recorded under a different calibration or lighting? |
|
|
126
|
+
| `IDLE_CHANNEL` | Which action channels carry no signal? (sharpened with `--reference`) |
|
|
127
|
+
|
|
128
|
+
`AVERAGING_HAZARD` is the differentiated one. It clusters demonstrations into
|
|
129
|
+
strategies, measures how far their average sits from the nearest real strategy
|
|
130
|
+
in units of within-strategy spread, and **suppresses splits that the task
|
|
131
|
+
conditions themselves explain** — paths to objects on the left and on the right
|
|
132
|
+
*should* differ, and that is the policy's job, not a defect.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Why the naive version doesn't work
|
|
137
|
+
|
|
138
|
+
Three things had to be right before any of this detected anything:
|
|
139
|
+
|
|
140
|
+
1. **Strategy signatures.** Comparing raw trajectories fails: variation in
|
|
141
|
+
*where the object was* swamps variation in *how the operator got there*.
|
|
142
|
+
Subtracting the straight line between a phase's own endpoints isolates
|
|
143
|
+
strategy from condition.
|
|
144
|
+
2. **A confound guard.** A mode split that the initial conditions predict is
|
|
145
|
+
suppressed, or every well-collected dataset would be flagged.
|
|
146
|
+
3. **Elbow selection, not BIC minimum.** BIC falls monotonically as components
|
|
147
|
+
are added, because real demonstration clusters always have sub-structure.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Does it actually predict anything?
|
|
152
|
+
|
|
153
|
+
`raftaar validate` trains a unimodal regression policy (stands in for
|
|
154
|
+
ACT-style behaviour cloning) and a mode-conditioned policy (stands in for
|
|
155
|
+
diffusion/flow policies) on the same data and rolls both out. 120 episodes,
|
|
156
|
+
40 trials.
|
|
157
|
+
|
|
158
|
+
| Dataset | Raftaar verdict | Unimodal BC | Mode-conditioned BC |
|
|
159
|
+
|---|---|---|---|
|
|
160
|
+
| `clean` | no warnings | **100% success, 0% collision** | 78% success, 15% collision |
|
|
161
|
+
| `bimodal_only` | AVERAGING_HAZARD | 75% success, **25% collision** | **100% success, 0% collision** |
|
|
162
|
+
| `field_data` | 5 findings | 20% success, **80% collision** | 88% success, 5% collision |
|
|
163
|
+
|
|
164
|
+
The prediction runs both ways. On clean data the tool stays quiet and the simple
|
|
165
|
+
policy wins outright — reaching for a multimodal policy there makes things
|
|
166
|
+
*worse*. On bimodal data the tool warns, and the simple policy drives into the
|
|
167
|
+
obstacle. That symmetry is what makes the output actionable rather than
|
|
168
|
+
decorative.
|
|
169
|
+
|
|
170
|
+
### A caveat on small datasets
|
|
171
|
+
|
|
172
|
+
"No warnings" on clean data holds at 120 episodes. Below roughly 90,
|
|
173
|
+
`ACTION_INCONSISTENCY` fires at *warning* severity on clean data, because
|
|
174
|
+
near-identical states genuinely do disagree when there are few episodes per
|
|
175
|
+
region of the state space. The detector is measuring something real; it is
|
|
176
|
+
under-powered, not wrong. Both behaviours are pinned by tests in
|
|
177
|
+
`tests/test_detectors.py` so the boundary is documented rather than folklore.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Optional extras
|
|
182
|
+
|
|
183
|
+
The core install is deliberately small. Everything else is opt-in:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
pip install "raftaar[plot]" # matplotlib, for the diagnostic figure
|
|
187
|
+
pip install "raftaar[validate]" # the rollout study
|
|
188
|
+
pip install "raftaar[provenance]" # record what produced each scan
|
|
189
|
+
pip install "raftaar[web]" # the browser demo in web/
|
|
190
|
+
pip install "raftaar[all]"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`raftaar scan` writes its markdown report and JSON with no plotting stack
|
|
194
|
+
installed, and tells you what it skipped. A dataset audit should not require
|
|
195
|
+
matplotlib to run.
|
|
196
|
+
|
|
197
|
+
### Provenance
|
|
198
|
+
|
|
199
|
+
A scan is a measurement and `validate` is an experiment, so both depend on
|
|
200
|
+
seeds, library versions and the exact dataset that went in. With
|
|
201
|
+
[daftar](https://pypi.org/project/daftar/) installed:
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
from raftaar.provenance import tracked_scan
|
|
205
|
+
|
|
206
|
+
report = tracked_scan("datasets/field_data", label="field-data-audit")
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
This records the dataset's content hash, the Raftaar version, every detector's
|
|
210
|
+
headline number and all findings, so two scans of the same dataset can be diffed
|
|
211
|
+
rather than eyeballed. Without daftar it behaves exactly like
|
|
212
|
+
`scan(load_dataset(path))` — the integration is a no-op, not an error.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Tests
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
pip install -e ".[dev]"
|
|
220
|
+
pytest -q # 29 tests
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
The detector tests are the ones that matter. Every fault is *injected
|
|
224
|
+
deliberately* into the synthetic environment, so each detector is scored against
|
|
225
|
+
ground truth rather than opinion — and both directions are tested:
|
|
226
|
+
|
|
227
|
+
- **sensitivity** — a dataset built with a fault must raise that fault's finding
|
|
228
|
+
- **specificity** — clean data must stay quiet, because a detector that fires on
|
|
229
|
+
everything is worse than no detector
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Status
|
|
234
|
+
|
|
235
|
+
Research prototype, honestly labelled. The synthetic environment exists so the
|
|
236
|
+
detectors can be scored against ground truth. The next milestone is a
|
|
237
|
+
`LeRobotDataset` adapter and a run across the public dataset hub — at which
|
|
238
|
+
point the claims above get tested against data nobody generated to order.
|
|
239
|
+
|
|
240
|
+
## Licence
|
|
241
|
+
|
|
242
|
+
Apache 2.0.
|