Example networks with diagram, shapes and code

Each example below is a network that ships with Brick DNN. Its page shows how the layers are connected, the output shape and parameter count of every layer, and the complete script the editor generates, in PyTorch for neural networks and in scikit-learn for classical models. Open any of them in the editor to change it, check it and train it.

Images

From a multi-layer perceptron on flattened digits to a U-Net that labels every pixel.

  • MLP for MNIST

    A multi-layer perceptron: 784 pixel values, two hidden layers, ten class scores.

    PyTorch · 235,146 parameters

  • Small CNN for MNIST

    Two convolution blocks and a classifier head: about 99 % test accuracy on MNIST.

    PyTorch · 421,642 parameters

  • Residual CNN for CIFAR-10

    A ResNet-style block with a skip connection merged by Add, then global average pooling.

    PyTorch · 76,490 parameters

  • U-Net for segmentation

    Encoder, decoder and skip connections: a class for every pixel, trained on the built-in Shapes data.

    PyTorch · 1,925,700 parameters

  • U-Net classifier

    The U-Net architecture with a classification head: global pooling and a Linear layer give ten class scores.

    PyTorch · 481,898 parameters

Text

Sequences of token ids, classified by a recurrent network or a Transformer encoder.

  • LSTM text classifier

    Token ids → embeddings → bidirectional LSTM → positive or negative.

    PyTorch · 2,824,706 parameters

  • Transformer text classifier

    A small Transformer encoder with learned positional embeddings and mean pooling, four classes.

    PyTorch · 1,611,268 parameters

Tables and mixed inputs

Neural networks for rows of numbers, a network with two inputs, and a hybrid of an MLP and gradient boosting.

  • Tabular regression

    Predicts one number from 8 numeric features; the script trains on a CSV file.

    PyTorch · 2,817 parameters

  • Multi-input model

    An image and a vector of metadata, combined with Concat, predict one number.

    PyTorch · 50,497 parameters

  • MLP features for gradient boosting

    An MLP learns 32 features, then gradient-boosted trees are fitted on them and predict the class.

    PyTorch + scikit-learn · 2,656 parameters

Classical models

Models for tabular data, built from bricks like the networks: gradient boosting with scikit-learn or LightGBM, a support vector machine and Gaussian processes with kernels.

  • Gradient boosting classifier

    Gradient-boosted trees classify rows of 30 features; balanced class weights for rare classes.

    scikit-learn · HistGradientBoostingClassifier

  • LightGBM classifier

    LightGBM grows its trees leaf by leaf; early stopping on the validation rows picks how many.

    scikit-learn · LGBMClassifier

  • SVM classifier

    A support vector machine with an RBF kernel classifies rows of 4 features, with probabilities.

    scikit-learn · SVC

  • Gaussian process regression

    Predicts a number with its uncertainty; the kernel is a scaled RBF plus white noise.

    scikit-learn · GaussianProcessRegressor

  • Periodic Gaussian process

    A seasonal pattern (RBF × ExpSineSquared) plus a smooth trend and noise, for a value over time.

    scikit-learn · GaussianProcessRegressor

Ensembles

Several classical models combined by voting or by stacking.

  • Voting ensemble

    Gradient boosting, an SVM and a Gaussian process; soft voting averages their probabilities.

    scikit-learn · VotingClassifier

  • Stacking ensemble regression

    Gradient boosting, an SVR and a Gaussian process, combined by a ridge regression.

    scikit-learn · StackingRegressor

  • XGBoost, LightGBM and CatBoost stacked

    The three boosting libraries of tabular competitions, combined by a logistic regression.

    scikit-learn · StackingClassifier

The diagrams, shapes, parameter counts and code on these pages are produced from the examples themselves, with the same shape inference and code generator as the editor.