Hey, sure - here's 9 lines of code that implement a perceptron. I get ~95% of precision after a second with 400 samples.
```js
const dotSign = (v1, v2) => v1.reduce((prev, x, i) => prev + x * v2[i], 1) > 0 ? 1 : -1
module.exports = (data, weights = Array(data[0].content.length).fill(0)) => {
for(const {label, content} of data) {
const delta = (label - dotSign(content, weights)) / 2;
weights = weights.map((x, i) => x + delta * content[i]);
}
return { perceive: vector => dotSign(vector, weights), weights };
}
```I can upload an electron app that does this with mnist if interested.