Building the Training Loop by Hand

I implemented logistic regression and a configurable multilayer perceptron in NumPy, including forward passes, binary cross-entropy, and backpropagation. Synthetic two-dimensional datasets made it possible to inspect the decision boundary alongside the loss curve.

The implementation exposed learning rate, layer width, and depth as experimental controls. ReLU hidden activations and explicit loss tracking helped diagnose vanishing gradients, divergence, and oscillation without relying on an automatic-differentiation framework.

Linking Architecture to Behavior

Logistic regression reached an F1 score of 0.9957 in the reported synthetic-data experiment. In a separate fixed-setting MLP width comparison, increasing the neurons per layer from 20 to 50 raised F1 from 0.8226 to 0.9077.

The resulting tool made both optimization and representation visible: changes to the training configuration could be traced directly to loss behavior and boundary shape.

MLP decision boundary and loss curve