Skip to content
v1.5.0About 1,500 fixes, checked against NumPy, SciPy, scikit-learn and PyTorch

Numerical computing and machine learning, in TypeScript

Tensors, DataFrames, classical ML, neural networks, statistics and plotting in one typed package. The API follows NumPy, pandas, scikit-learn and PyTorch. No runtime dependencies.

npm install deepbox
train.ts
import { tensor } from "deepbox/ndarray";import { Linear, mseLoss, ReLU, Sequential } from "deepbox/nn";import { Adam } from "deepbox/optim"; // Learn y = x1 + 2 * x2 from four points.const X = tensor([[0, 0], [0, 1], [1, 0], [1, 1]]);const y = tensor([[0], [2], [1], [3]]); const model = new Sequential(new Linear(2, 16), new ReLU(), new Linear(16, 1));const optimizer = new Adam(model.parameters(), { lr: 0.01 }); for (let epoch = 0; epoch < 200; epoch++) {  optimizer.zeroGrad();  const loss = mseLoss(model.forward(X), y);  loss.backward();  optimizer.step();}
modules
13
runnable examples
50
end-to-end projects
9
runtime dependencies
0

Checked against the libraries it follows

Deepbox 1.5.0 ships with more than 13,000 unit tests. On top of that, each module was compared with its reference library using randomized differential tests: reductions against NumPy, estimators and metrics against scikit-learn, layers and optimizers against PyTorch, DataFrame operations against pandas and statistics against SciPy.

Read the release notes
  • Typed end to end

    Declarations for every module and subpath.

  • Plain TypeScript

    No native addons. ESM and CommonJS builds.

  • Predictable errors

    Typed error classes instead of silent wrong answers.

  • Stable surface

    1.5 is backward compatible with 1.0.

Start with the quick start

Four short programs show tensors, training, a classifier and a DataFrame. Each one runs as written.