Public facade for the tiny neural-network library.
The modules below intentionally match the scope of original micrograd:
Neuron, Layer, and MLP. There are no tensors, optimizers, batching
primitives, or GPU kernels. The purpose is to make backpropagation visible.
Because models are immutable, training code uses this rhythm:
loss = ...
gradients = MicrogradEx.Value.backward(loss)
model = MicrogradEx.NN.apply_gradients(model, gradients, 0.05)That is the Elixir equivalent of loss.backward(); p.data += -lr * p.grad.
Summary
Functions
Applies one stochastic-gradient-descent style update and returns a new model.
Runs a model forward.
Counts trainable parameters.
Returns trainable parameters from any neural-network module.
Types
@type model() :: MicrogradEx.NN.Neuron.t() | MicrogradEx.NN.Layer.t() | MicrogradEx.NN.MLP.t()
Functions
Applies one stochastic-gradient-descent style update and returns a new model.
learning_rate is the positive step size usually called lr in training
loops. The update rule is:
new_parameter = parameter - learning_rate * gradient
Runs a model forward.
Counts trainable parameters.
Returns trainable parameters from any neural-network module.