Repository navigation
Unit support: units on upload, unit conversion in OnnxPredictor - #23
Merged
Merged
Conversation
- datasetCollector and sendDataset accept { name, unit, quantity } per
time-series and send them when the dataset is created; plain names are
still sent as plain strings
- OnnxPredictor reads input.units from the manifest (inputUnits), converts
declared sensor units (units option / setUnits) to the expected unit and
throws a UnitError for units the model cannot convert from
- models without unit information keep getting values unchanged
- fetchUnits(url) returns the server's unit catalog (GET /ml/units/)
- README, example and types updated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of edge-ml/edge-ml#91 (follow-up to #85).
Uploads
datasetCollectorandsendDatasettake{ name, unit, quantity }per time-series and send it on dataset init. Plain names are still sent as plain strings, so existing apps and servers without unit support keep working.Predictor
OnnxPredictor.inputUnits: expected unit per input, read frommanifest.input.units.loadModel(url, key, id, { units: { accX: "g" } })orpredictor.setUnits(...)); values are converted with the conversions shipped in the manifest before predicting (buffered values andpredictWindow).UnitErrorlisting the accepted units.catalogto also accept labels/aliases like°F,m/s².Other
fetchUnits(url)returnsGET /ml/units/.__tests__/test_units.js, fixtures generated from the ml service's own unit code): conversion, buffered conversion, errors, catalog aliases, backwards compatibility with the existing pre-units fixtures, upload payloads.Checked
npm test44/44,npm run test:browserok.gdeclared → same scores as feeding m/s² directly, 10/10 correct labels;UnitErrorfordegC.Release note: the version is not bumped here on purpose:
npm-publish.ymlpublishes as soon as package.json has a newer version (also on PR runs). Bump to 4.1.0 when this should go out. Uploading with units needs #85 on the server; prod doesn't have it yet (plain names keep working there).