Skip to content

πŸ€– Micrograd TS

project
74

A tiny scalar-valued autograd engine and a neural net on top of it. A TypeScript version of the karpathy/micrograd repo.

  • AI
  • ML
  • Machine Learning
  • TypeScript

About

Micrograd TS is a TypeScript version of Andrej Karpathy's micrograd: a tiny autograd engine for scalar values, with a small neural network library built on top of it, in about 200 lines of code.

The Value class records math operations such as addition, multiplication, powers, exp and tanh into a computation graph, and its backward() method walks that graph to compute derivatives, which is the heart of backpropagation. The Neuron, Layer and MLP classes then build a multi-layer perceptron out of those values.

A demo app and several playgrounds let you train small networks and experiment with them, which makes the project a hands-on companion to Karpathy's video The spelled-out intro to neural networks and backpropagation: building micrograd.