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
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.
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());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.
| Module | What it covers |
|---|---|
deepbox/core | Types, errors, config, backends, logging, validation, serialization, worker pool |
deepbox/ndarray | Tensors, over 100 operations, autograd, sparse CSR, FFT, einsum |
deepbox/linalg | Decompositions, matrix functions, solvers, norms, special matrices |
deepbox/dataframe | DataFrame, Series, string and datetime accessors, IO, styling |
deepbox/stats | Descriptive statistics, distributions, hypothesis tests, KDE, power analysis |
deepbox/metrics | Classification, regression, clustering, ranking and pairwise metrics |
deepbox/preprocess | Scalers, encoders, imputers, feature selection, text vectorizers, splitters |
deepbox/ml | Linear models, trees, ensembles, SVM, neighbors, clustering, pipelines, model selection |
deepbox/nn | Modules, layers, recurrent and transformer models, losses, trainer |
deepbox/optim | Optimizers and learning-rate schedulers |
deepbox/random | Seeding, Generator, distributions, sampling |
deepbox/datasets | Built-in datasets, synthetic generators, DataLoader, remote helpers |
deepbox/plot | Figure API, SVG, PNG and PDF output, statistical and diagnostic plots |
Found a mistake? Open an issue.