A scalar neuron: weighted sum, bias, and optional ReLU.
This mirrors micrograd.nn.Neuron. The Elixir struct stores immutable
parameter values. Calling MicrogradEx.NN.apply_gradients/3 returns a new
neuron with updated parameter values instead of mutating the existing neuron.
Summary
Functions
Runs a forward pass through the neuron.
Creates a neuron.
Returns this neuron's trainable parameters in weight-then-bias order.
Types
@type t() :: %MicrogradEx.NN.Neuron{ bias: MicrogradEx.Value.t(), nonlin: boolean(), weights: [MicrogradEx.Value.t()] }
Functions
Runs a forward pass through the neuron.
Inputs may be plain numbers, Value structs, or a single scalar when the
neuron has exactly one input. Numbers are promoted to differentiable leaves so
input gradients can be inspected too.
Creates a neuron.
Options:
:nonlin- whentrue, apply ReLU after the affine transform.:weights- exact initial weights, useful for tests and examples.:bias- exact initial bias, defaults to0.0.:seed-{a, b, c}tuple for deterministic random weights.
Returns this neuron's trainable parameters in weight-then-bias order.