Examples
33 hands-on examples covering every Deepbox module — from tensor basics to training neural networks. Each example includes full source code, console output, and detailed explanations.
Quick Start Guide
A rapid introduction to Deepbox's core features — tensors, DataFrames, and machine learning in under 50 lines.
Tensor Basics
Learn the fundamentals of creating and manipulating tensors (N-dimensional arrays).
Tensor Operations
Explore arithmetic, mathematical, and reduction operations on tensors with full broadcasting.
Data Analysis & Visualization
Comprehensive data analysis workflow using DataFrames, statistics, and plotting.
DataFrame Basics
Learn fundamental DataFrame operations for working with tabular data.
DataFrame GroupBy & Aggregation
Learn to group and aggregate data for analysis — similar to SQL GROUP BY.
Complete Machine Learning Pipeline
End-to-end ML pipeline with the Iris dataset — preprocessing, model comparison, cross-validation, and visualization.
Linear Regression
Build a simple linear regression model to predict continuous values.
Logistic Regression
Build a binary classification model using logistic regression on the Iris dataset.
Ridge & Lasso Regression
Compare L1 (Lasso) and L2 (Ridge) regularization techniques for regression.
Advanced ML Models
KMeans clustering, K-Nearest Neighbors, PCA dimensionality reduction, and Gaussian Naive Bayes.
Tree-Based & Ensemble Models
Decision Trees, Random Forests, Gradient Boosting, and Linear SVM for classification and regression.
Neural Network Training
Build and train neural networks using Sequential models, autograd, optimizers, and loss functions.
Automatic Differentiation (Autograd)
Deepbox's autograd builds computation graphs on GradTensors, then computes gradients via backpropagation.
Statistical Analysis
Descriptive statistics, hypothesis testing, and correlation analysis.
Linear Algebra Operations
Matrix decompositions and linear system solving — essential for understanding ML under the hood.
Data Visualization
Create line plots, scatter plots, bar charts, histograms, and heatmaps — output as SVG or PNG.
Built-in Datasets
Explore all 24 built-in datasets and 6 synthetic generators for quick experimentation.
Complete ML Pipeline
End-to-end workflow from data loading to model evaluation and SVG visualization.
Activation Functions
Explore ReLU, Sigmoid, Softmax, GELU, Mish, Swish, ELU, LeakyReLU, Softplus, and LogSoftmax.
Learning Rate Schedulers
Control learning rate during training — StepLR, CosineAnnealing, OneCycleLR, and 5 more.
Preprocessing — Encoders
Transform categorical data into numeric representations: Label, OneHot, Ordinal, MultiLabel, LabelBinarizer.
Preprocessing — Scalers
Feature scaling with StandardScaler, MinMaxScaler, RobustScaler, MaxAbsScaler, and more.
Random Sampling & Distributions
Generate random tensors from uniform, normal, binomial, Poisson, and other distributions.
Cross-Validation Strategies
KFold, StratifiedKFold, LeaveOneOut, LeavePOut, and GroupKFold for robust model evaluation.
Model Evaluation Metrics
Classification, regression, and clustering metrics for comprehensive model evaluation.
Sparse Matrix Operations
CSR (Compressed Sparse Row) format for memory-efficient matrices with many zeros.
CNN Layers
Conv1d, Conv2d, MaxPool2d, and AvgPool2d layers for convolutional neural networks.
Recurrent Neural Network Layers
RNN, LSTM, and GRU layers for sequence modeling tasks.
Attention & Transformer Layers
MultiheadAttention and TransformerEncoderLayer for sequence-to-sequence modeling.
Normalization & Dropout Layers
BatchNorm1d, LayerNorm, and Dropout for training stability and regularization.
DataLoader — Batching & Shuffling
Efficiently iterate over datasets in mini-batches with optional shuffling.
Neural Network Module System
Custom modules, parameter registration, state serialization, train/eval modes, freeze/unfreeze.