Neural NetworksCode with Python
scikit-learn's MLPClassifier ("multi-layer perceptron") is a ready-made feed-forward network. Here it learns Riya's sweet spot. The data is built with two loops, and each evening gets the label 1 (sold out) when it lies inside the sweet spot. hidden_layer_sizes sets the hidden neurons, and fit runs forward passes, backward passes and updates again and again. Run it, then pick a different number of hidden neurons and run it again.
A Neuron From Scratch
And here is a neuron in plain Python — a weighted sum and math.exp for the sigmoid — followed by a forward pass through a tiny network of three neurons. Run it, then change the day and run it again.
Every network, however big, does this forward pass: weighted sums, activations, layer after layer.