Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT - DO NOT MERGE] Add magnetometer #268

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

microbit-robert
Copy link

@microbit-robert microbit-robert commented Jul 2, 2024

This branch adds the ability to record data using the magnetometer. It is built on top of some proposed model improvements which appear to make the result of model training more consistent.

This branch allows the user to switch between accelerometer and magnetometer data and will warn the user about clearing existing recordings (if present) when this switch is made. The sensor dropdown appears over the live graph in the bottom left.

This branch includes a new filter which seems to help the model differentiate between left and right swiping motions over the top of the micro:bit with a magnetic object. The filter attempts to get the first significant change in gradient and output the signed vector of this gradient.

Accelerometer and magnetometer data cannot be used together. I'm not sure there's a scenario where they would work well together. So far, one dataset has simply occluded another and made training and inference worse.

All data is now scaled to -2..2. This value has been set as a result of dividing accelerometer data by 1000, but it's somewhat abitrary when including the magnetometer data. It has proved difficult to change while maintaining backwards compatibility.

Model accuracy can be highly variable due to non-determinism.
This change improves the consistency of the trained model.
Copy link

github-actions bot commented Jul 2, 2024

Preview build will be at
https://review-ml.microbit.org/add-magnetometer

};

// Store with ML-Algorithm settings
export const settings = persistantWritable<MlSettings>('MLSettings', initialMLSettings);
export const settings = writable<MlSettings>(initialMLSettings);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't persist mlSettings to localStorage. These settings cannot currently be set by the user and storing these data in localStorage is making it tricky to update them independently of other keyed data in localStorage. See persistVersion in storeUtil.ts.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sensor selection, which is user controlled, has been pulled out into persistentSettings which is persisted to localStorage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant