Mathematical proof / lesson 02
Treat a forward pass as ordinary transforms
A dense layer can be inspected through the same primitive as any other state transition.
Know what the primitive owns.
Neural terminology can make a simple forward chain feel like a separate architecture. CMG tests whether the generic primitive is expressive enough without importing a training framework.
DenseLayer is a Transform. Activation, loss, and derivative utilities remain mathematical capabilities. The example performs a forward pass and evaluation, not training.
State changes become visible.
Inspectable: Both dense-layer outputs, the prediction, target, mean-squared error, evaluation status, and feedback action.
Move a scalar pre-activation through sigmoid and inspect its local sensitivity.
Static specimen / JavaScript adds controls without changing the lesson.
Same idea, honest surfaces.
const hiddenLayer = new DenseLayer({
id: "dense-4-2",
name: "Dense 4 -> 2",
inputSize: 4,
outputSize: 2,
weights,
bias: [0, 0],
activation: sigmoid,
});
const run = await graph.run([1, 2, 4, 5], {
target: [1],
});
def dense_forward(values, weights, bias):
return [
sigmoid.forward(
sum(value * row[j] for value, row in zip(values, weights))
+ bias[j]
)
for j in range(len(bias))
]
hidden_layer = create_transform(
"dense-4-2",
"Dense 4 -> 2",
lambda values, _ctx: dense_forward(values, weights, [0, 0]),
)
What this does not imply.
There is no backpropagation, optimizer, or weight update here. The implemented proof is the inspectable forward chain.