// Code examples from: How a Neural Network Learns, Explained With a Spreadsheet
// https://www.atulvij.com/neural-network-explained-with-excel
// Review and adapt before running; examples use sample values.

// ---- Example 1 (excel) ----
D2: =A2*$F$1 + B2*$F$2 + $F$3          ' raw score
E2: =1/(1+EXP(-D2))                      ' prediction between 0 and 1

// ---- Example 2 (excel) ----
G2: =E2-C2                               ' how wrong, with direction
H2: =G2^2                                ' squared error
H20: =AVERAGE(H2:H11)                    ' the loss

// ---- Example 3 (excel) ----
I2: =G2*E2*(1-E2)                        ' error signal for this row
J2: =I2*A2                               ' gradient for w1
K2: =I2*B2                               ' gradient for w2

// ---- Example 4 (excel) ----
new w1: =F1 - 0.5*AVERAGE(J2:J11)

