Skip to content

Introduction

Deepbox is a TypeScript library for tensors, linear algebra, tabular data, machine learning, neural networks, statistics and plotting. It has no runtime dependencies.

  • v1.5.0
  • No runtime dependencies
  • ESM and CommonJS
  • Typed subpath exports
Modules
13
Examples
50
Projects
9
Source files
324

What Deepbox is

Deepbox brings the scientific Python stack to TypeScript in one package. The API follows NumPy, pandas, scikit-learn and PyTorch, so code written against those libraries translates with few changes, and the types catch mistakes before the code runs. The few defaults that differ are listed in Conventions & Limits.

Everything runs in plain TypeScript. There are no native addons and no runtime dependencies, so installs are small. Deepbox needs Node.js 24.13 or newer, and helpers that touch files, such as save and saveFig, need Node.js. Computation runs on the CPU unless you register the optional WebGPU or WASM backend, see Devices & Execution.

overview.ts
import { parameter, tensor } from "deepbox/ndarray";import { DataFrame } from "deepbox/dataframe";import { LinearRegression } from "deepbox/ml"; // Tensors with automatic differentiationconst x = parameter([[1, 2], [3, 4]]);const w = parameter([[0.5], [1]]);x.matmul(w).sum().backward();console.log(w.grad?.toString()); // Tabular dataconst df = new DataFrame({  name: ["Alice", "Bob", "Charlie"],  score: [91, 84, 96],});console.log(df.get("score").mean()); // Classical machine learningconst model = new LinearRegression();model.fit(tensor([[1], [2], [3], [4]]), tensor([2, 4, 6, 8]));console.log(model.predict(tensor([[5]])).toString());

How the library is organized

Each module is a separate subpath export, such as deepbox/ndarray or deepbox/ml. Import what you need from the module that owns it. The root package deepbox only exports the modules as namespaces.

ModuleWhat it covers
deepbox/coreTypes, errors, config, backends, logging, validation, serialization, worker pool
deepbox/ndarrayTensors, over 100 operations, autograd, sparse CSR, FFT, einsum
deepbox/linalgDecompositions, matrix functions, solvers, norms, special matrices
deepbox/dataframeDataFrame, Series, string and datetime accessors, IO, styling
deepbox/statsDescriptive statistics, distributions, hypothesis tests, KDE, power analysis
deepbox/metricsClassification, regression, clustering, ranking and pairwise metrics
deepbox/preprocessScalers, encoders, imputers, feature selection, text vectorizers, splitters
deepbox/mlLinear models, trees, ensembles, SVM, neighbors, clustering, pipelines, model selection
deepbox/nnModules, layers, recurrent and transformer models, losses, trainer
deepbox/optimOptimizers and learning-rate schedulers
deepbox/randomSeeding, Generator, distributions, sampling
deepbox/datasetsBuilt-in datasets, synthetic generators, DataLoader, remote helpers
deepbox/plotFigure API, SVG, PNG and PDF output, statistical and diagnostic plots

Where to go next