Skip to main content

Requirements

Before installing Deepbox, ensure your system meets the following requirements:
Node.js Version: Deepbox requires Node.js >= 24.13.0
Check your Node.js version:
node --version
If you need to upgrade, download the latest version from nodejs.org.

Install Deepbox

Install Deepbox using your preferred package manager:
npm install deepbox

Verify Installation

Create a simple test file to verify your installation:
test.ts
import { tensor, add } from "deepbox/ndarray";

const a = tensor([1, 2, 3]);
const b = tensor([4, 5, 6]);
const c = add(a, b);

console.log(c.toString()); // Output: tensor([5, 7, 9])
Run the file:
npx tsx test.ts
If you see tensor([5, 7, 9]), congratulations! Deepbox is installed correctly.

Import Strategies

Deepbox provides flexible import strategies to suit your needs: Import from specific modules for optimal tree-shaking and smaller bundle sizes:
import { tensor, add, mul } from "deepbox/ndarray";
import { DataFrame } from "deepbox/dataframe";
import { LinearRegression } from "deepbox/ml";
import { StandardScaler } from "deepbox/preprocess";
import { accuracy, f1Score } from "deepbox/metrics";

Namespace Imports

Use namespace imports when you prefer explicit module prefixes:
import * as db from "deepbox";

const t = db.ndarray.tensor([1, 2, 3]);
const df = new db.dataframe.DataFrame({ col: [1, 2, 3] });
const model = new db.ml.LinearRegression();

Available Modules

Deepbox is organized into the following modules:
Types, errors, validation, dtype helpers, and configuration
import type { DType, Shape, Device } from "deepbox/core";
N-D tensors with autograd, broadcasting, 90+ operations, and sparse matrices
import { tensor, add, matmul, parameter } from "deepbox/ndarray";
SVD, QR, LU, Cholesky, eigenvalue decomposition, solvers, and norms
import { svd, qr, solve, inv } from "deepbox/linalg";
DataFrame and Series with 50+ operations and CSV I/O
import { DataFrame, Series } from "deepbox/dataframe";
Descriptive stats, correlations, and hypothesis tests
import { mean, std, ttest, anova } from "deepbox/stats";
40+ ML metrics for classification, regression, and clustering
import { accuracy, f1Score, r2Score } from "deepbox/metrics";
Scalers, encoders, normalizers, and cross-validation splits
import { StandardScaler, trainTestSplit } from "deepbox/preprocess";
Classical ML models (Linear, Ridge, Lasso, Trees, SVM, KNN, Ensembles)
import { LinearRegression, RandomForestClassifier } from "deepbox/ml";
Neural network layers (Linear, Conv, RNN/LSTM/GRU, Attention, Normalization)
import { Sequential, Linear, ReLU, mseLoss } from "deepbox/nn";
Optimizers (SGD, Adam, AdamW, RMSprop) and LR schedulers
import { Adam, CosineAnnealingLR } from "deepbox/optim";
Distributions (uniform, normal, binomial, gamma, beta) and sampling
import { normal, uniform, choice } from "deepbox/random";
Built-in datasets (Iris, Digits, Breast Cancer) and synthetic generators
import { loadIris, makeClassification } from "deepbox/datasets";
SVG/PNG plotting (scatter, line, bar, histogram, heatmap, contour)
import { scatter, plot, hist, heatmap, saveFig } from "deepbox/plot";

TypeScript Configuration

For the best development experience, configure your tsconfig.json:
tsconfig.json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "esModuleInterop": true,
    "strict": true,
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "lib": ["ES2022"]
  }
}
Enable strict mode to take full advantage of Deepbox’s type safety.

Package Information

Deepbox is published to npm with the following characteristics:
  • Package name: deepbox
  • Current version: 0.2.0
  • License: MIT
  • Bundle format: ESM and CommonJS
  • Type definitions: Included
  • Runtime dependencies: Zero

Module Exports

Deepbox uses modern ESM exports with CommonJS fallbacks:
package.json
{
  "main": "./dist/index.cjs",
  "module": "./dist/index.js",
  "types": "./dist/index.d.ts"
}
Every module has dedicated exports for tree-shaking:
// ESM
import { tensor } from "deepbox/ndarray";

// CommonJS
const { tensor } = require("deepbox/ndarray");

Next Steps

Quick Start Guide

Build your first Deepbox application in 5 minutes

Core Concepts

Learn about tensors, autograd, and broadcasting

API Reference

Explore the complete API documentation

Examples

See practical examples and use cases

Troubleshooting

If you encounter module resolution errors, ensure:
  1. Your Node.js version is >= 24.13.0
  2. Your tsconfig.json has "moduleResolution": "bundler" or "node16"
  3. You’re using a compatible bundler (Vite, esbuild, Rollup, Webpack 5+)
If you see TypeScript errors:
  1. Ensure you have "strict": true in your tsconfig.json
  2. Install @types/node if you haven’t already
  3. Clear your TypeScript cache: rm -rf node_modules/.cache
For large tensor operations, you may need to increase Node.js memory:
node --max-old-space-size=4096 your-script.js
Need help? Check the GitHub Issues or open a new issue.

Build docs developers (and LLMs) love