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.
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)Everything is documented
No black boxes. Every reference page shows the exact math, shapes, edge cases, and implementation details.
Architecture
The full training loop, fused operations, and when validation happens.
Read docs →layers.pyLayers
Dense layers with automatic He/Xavier initialization based on activation.
Read docs →activations.pyActivations
ReLU, LeakyReLU, Sigmoid, Tanh, Softmax — with stable implementations.
Read docs →losses.py · optimizers.pyLosses & Optimizers
Cross entropy, MSE, SGD, Adam, and fused backward passes.
Read docs →metrics.pyMetrics
Accuracy, F1, R², Confusion Matrix and more — with smart label handling.
Read docs →getting-startedQuickstart
The complete four-step workflow used in every example.
Read docs →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.