k-nearest neighbors
The simplest model there is: label a gesture like its nearest training gestures. Distance, votes, accuracy, choosing k, a confusion matrix, why the z-scores matter, and what k-NN costs a microcontroller.
Open it in the simulatorGesture recognition from scratch in plain Python on a Raspberry Pi: features, k-nearest neighbors, decision trees, a neuron, gradient descent and a tiny neural network, and weights exported as C arrays for a microcontroller.
0 of 7 done
7 lessons in 4 chapters, about 5 hours on a simulated Raspberry Pi 4 Model B. Free, in your browser, every step checked by the simulator.
The simplest model there is: label a gesture like its nearest training gestures. Distance, votes, accuracy, choosing k, a confusion matrix, why the z-scores matter, and what k-NN costs a microcontroller.
Open it in the simulatorOne artificial neuron: a weighted sum, a bias and a step. Set its weights by hand, then let the perceptron rule learn them, find where a single neuron gives up (a problem that is not linearly separable with one feature), and fire a lamp from it.
Open it in the simulatorShip the model: print the trained weights and the z-score constants as C arrays a microcontroller sketch can paste in, quantize them to int8, prove the small model still agrees, and print the C classify function that uses them.
Open it in the simulatorEach lesson opens when the one before it is done, and each chapter ends in a project.
Turn raw sensor traces into features and split them honestly.
Gestures from a wrist accelerometer: raw traces, six features that summarize half a second in six numbers, class averages that show why it can work, an honest train/test split, and z-scores computed from the training set only.
0 of 5 steps
The simplest model there is: label a gesture like its nearest training gestures. Distance, votes, accuracy, choosing k, a confusion matrix, why the z-scores matter, and what k-NN costs a microcontroller.
0 of 5 steps
Decision trees and a single neuron, and where each one breaks.
A model you can read: the best first question by Gini impurity, a depth-2 tree printed as rules, overfitting made visible with three mislabeled gestures, and the tree turned into C if statements.
0 of 4 steps
One artificial neuron: a weighted sum, a bias and a step. Set its weights by hand, then let the perceptron rule learn them, find where a single neuron gives up (a problem that is not linearly separable with one feature), and fire a lamp from it.
0 of 4 steps
Gradient descent on the Pi, then weights a microcontroller can run.
Gradient descent from scratch: softmax regression for all three gestures, the cross-entropy loss falling epoch by epoch, test accuracy and confidence, learning rates too small and too big, and a 6-4-3 neural network trained by backpropagation.
0 of 5 steps
Ship the model: print the trained weights and the z-score constants as C arrays a microcontroller sketch can paste in, quantize them to int8, prove the small model still agrees, and print the C classify function that uses them.
0 of 4 steps
Live gesture recognition on the traffic lights.
The boss: the whole pipeline live. Press the button, a fresh gesture is recorded, featurized, z-scored and classified, and the traffic lights show wave, punch or circle; a confidence threshold says "not sure" to a gesture it was never taught; and 30 never-seen gestures measure it honestly.
0 of 6 steps
All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.
Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.
Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kitYes. All 7 lessons of Machine learning on a microcontroller are free and run in your browser, with nothing to install and no parts to buy before you start.
No. Every lesson runs on a simulated Raspberry Pi 4 Model B with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.
About 5 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.
Each chapter ends in a project that puts it together: k-nearest neighbors, A neuron and Weights in C.
With "Data and features", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.