pure NumPy · zero dependencies

Neural networks, with the lid off.

VanillaNets is a from-scratch implementation of dense layers, activations, losses, and optimizers. Every forward() and backward() is plain NumPy you can read, step through, and rewrite.

Neural network signal path diagramForward activations move left to right toward output, while backward gradients move right to left toward inputs.inputhiddenhiddenoutputactivations → .outputgradients ← .dinputs

Two methods.
That’s the entire interface.

Every layer, activation, loss, and optimizer in VanillaNets follows the same simple contract. Learn it once — and you can understand or extend any part of the library.

layer.forward(inputs)
# → caches .inputs, produces .output

layer.backward(dvalues)
# → computes .dinputs
# → (and .dweights / .dbiases if trainable)

Four steps.
Start to finish.

Build, configure, finalize, and train. The same workflow works for binary classification, multiclass, and regression.

from vanillanets import Model, DenseLayer, Optimizer_Adam
from vanillanets.activations import ReLU, Sigmoid
from vanillanets.losses import BinaryCrossEntropy
from vanillanets.metrics import Accuracy

model = Model()
model.add(DenseLayer( 30, 64, activation='relu'))
model.add(ReLU() )
model.add(DenseLayer( 64, 1, activation='sigmoid'))
model.add(Sigmoid() )

model.set(
    loss=BinaryCrossEntropy(),
    optimizer=Optimizer_Adam( learning_rate=0.01),
    metrics={'accuracy': Accuracy()}
)
model.finalize()

model.fit( X_train, y_train, epochs=100, print_every=10 )

Built for

Students & Self-Learners

Understand backpropagation by seeing every matrix operation in plain NumPy.

Educators & Researchers

A transparent, readable reference for teaching or experimenting with new components.

Interview Preparation

Practice real from-scratch implementations and verify them against working code.

Start with the architecture

Master the forward/backward contract and the training loop first. Everything else in VanillaNets is built on these foundations.