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 deepboxNode 24.13 or newerimport { 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
What you can build with it
Each area is a separate import, so you only bundle the parts you use.
Tensors and autograd
Dense and sparse tensors with over 100 operations, FFT, einsum and reverse-mode autodiff. Tensor and GradTensor share one method surface.
Read moreDataFrames
DataFrame and Series with groupBy, joins, window functions, string and datetime accessors, and CSV, JSON, Excel and Parquet IO.
Read moreClassical machine learning
Linear models, trees, forests, SVM, neighbors, clustering and pipelines, with the scikit-learn fit, predict and score pattern.
Read moreNeural networks
Layers, recurrent and transformer blocks, losses, optimizers, schedulers and a Trainer. Training runs on plain tensors.
Read moreStatistics and metrics
Distributions, hypothesis tests, confidence intervals, KDE and the usual classification, regression and clustering metrics.
Read moreWebGPU and WASM
Opt-in backends. Matmul, convolution, reductions and optimizer steps run on the GPU, and the CPU stays the default.
Read more
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 notesTyped 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.
Thirteen modules, one package
deepbox/coreTypes, errors, config, backends, serializationdeepbox/ndarrayTensors, autograd, sparse, FFT, einsumdeepbox/linalgDecompositions, solvers, norms, matrix functionsdeepbox/dataframeDataFrame, Series, accessors, IOdeepbox/statsDescriptive statistics, tests, distributions, KDEdeepbox/metricsClassification, regression, clustering, rankingdeepbox/preprocessScalers, encoders, imputers, splittersdeepbox/mlEstimators, ensembles, pipelines, model selectiondeepbox/nnLayers, losses, Trainer, initializationdeepbox/optimOptimizers and learning-rate schedulersdeepbox/randomSeeded generator, distributions, samplingdeepbox/datasetsBuilt-in datasets, generators, DataLoaderdeepbox/plotFigures, SVG, PNG and PDF output, diagnostics
Start with the quick start
Four short programs show tensors, training, a classifier and a DataFrame. Each one runs as written.