Zum Hauptinhalt springen

Build Neural Network With Ms Excel Full 【FAST – 2024】

This is where Excel shines. We compute how much each weight contributed to the error.

We need to multiply the Input vector (1x2) by the Weight matrix (4x2), then add bias.

  • Repeat for Hidden Neuron 2 (H2):

  • Repeat for H3 & H4 in columns D and E.

  • We will build a 2-2-1 network:

    We update weights using: $W_new = W_old - \textLearning Rate \times \textGradient$

    Set Learning Rate (α): Go to Parameters sheet, cell N1, type 0.5.

    Update Weights (in the "Update" tab or Parameters tab):

    The Circular Reference Trick:

    Simpler alternative for beginners: Manually copy the "New Weights" column and Paste Special > Values back into the "Parameters" tab. Repeat 1,000 times.


    Arthur arranged his worksheet.

    He took a deep breath. He entered the four scenarios of XOR into rows 2 through 5: build neural network with ms excel full

    He clicked the LEARN button.

    The screen flickered. The VBA script ran, copying and pasting values rapidly. The line chart on the right, representing "Total Error," plummeted. It was a jagged descent, a jagged heartbeat of a digital creature learning to think.

    The Output cell (K2) began to shift.

    Arthur watched the row for (0,1). The target was 1. The Output cell climbed. 0.6... 0.8... 0.92... 0.99.

    The script stopped after 1,000 iterations.

    Arthur looked at the results.

    Create a "Gradient Summary" table:

    You have just built a fully functional neural network in Excel. You have witnessed:

    Limitations of Excel:

    Why this matters: Understanding this Excel implementation demystifies deep learning. If you can build it in a grid of cells, you truly understand the algorithm. Next, translate this logic into Python with NumPy—you'll realize NumPy is just Excel on steroids.

    Downloadable Template: (In a real scenario, you would link an .xlsx file here). For now, build it yourself. The process of typing each formula is the best way to learn. This is where Excel shines

    Building a neural network in Excel is a fantastic way to demystify "black box" AI. Since Excel doesn’t have a "Neural Network" button, we have to build the math— Forward Propagation Backpropagation —cell by cell. We will build a simple 2-input, 2-hidden neuron, 1-output network designed to solve a basic logic gate (like XOR). 1. The Architecture Input Layer: 2 Inputs ( Hidden Layer: 2 Neurons ( ) with Sigmoid activation. Output Layer: 1 Neuron ( ) with Sigmoid activation.

    Minimize the Error (Loss) between the Prediction and the Actual target. 2. Phase 1: Forward Propagation This is the process of moving from inputs to a prediction. Step A: Set up your weights and biases

    In a new sheet, designate a "Weights" area. Initialize them with small random numbers (e.g., between -1 and 1). Layer 1 Weights: (connecting inputs to hidden neurons). Layer 1 Biases: Layer 2 Weights: (connecting hidden neurons to output). Layer 2 Bias: Step B: Calculate Hidden Layer Values

    For each hidden neuron, you calculate the "Z" (weighted sum) and the "A" (activation). Formula for cap Z sub h 1 end-sub =(x1 * w11) + (x2 * w21) + b1 Sigmoid Activation ( cap A sub h 1 end-sub =1 / (1 + EXP(-Zh1)) Repeat this for Step C: Calculate the Output

    Use the activations from the hidden layer as inputs for the final neuron. Formula for cap Z sub o 1 end-sub =(Ah1 * w3) + (Ah2 * w4) + b3 Final Prediction ( cap A sub o 1 end-sub =1 / (1 + EXP(-Zo1)) 3. Phase 2: The Loss Function To know how wrong we are, we use Mean Squared Error (MSE) =(Target - Prediction)^2

    Your goal is to make this number as close to zero as possible. 4. Phase 3: Backpropagation (The "Learning")

    This is where we calculate how much each weight contributed to the error using the Chain Rule from calculus. We need the "Gradient" for every weight. Output Error Gradient: =(Prediction - Target) * Prediction * (1 - Prediction) Hidden Weight Gradients:

    Multiply the Output Error Gradient by the Hidden Layer Activations. Hidden Layer Error:

    Back-calculate the error from the output layer to the hidden layer weights. Input Weight Gradients: Multiply the Hidden Layer Error by the original Inputs. 5. Phase 4: The Excel "Engine" (Solver) manually update weights using a Learning Rate formula ( New Weight = Old Weight - (Learning Rate * Gradient) ), Excel has a built-in tool that does this automatically:

    tab (if you don't see Solver, enable it in File > Options > Add-ins). Set Objective: Your Loss Function cell (the MSE). By Changing Variable Cells: Highlight all your Weight and Bias cells. Select a GRG Nonlinear engine. Summary of the Flow

    Excel will iterate through thousands of weight combinations until the Loss Function is minimized. Once it stops, you have a trained model. You can change the input values ( Repeat for Hidden Neuron 2 (H2):

    ), and the forward propagation formulas will instantly calculate a prediction based on your "learned" weights. Excel formula template

    for the Sigmoid derivative to help with the manual gradient calculation?

    Creating a full neural network in MS Excel is a fantastic way to understand the "black box" of Deep Learning. It strips away the complex code and forces you to confront the raw mathematics (Linear Algebra) that powers AI.

    Here are the key features of a "Full Neural Network build in MS Excel," broken down by the components you would need to construct.

    There was one problem. Excel is static. If you change a weight, the calculation updates instantly, but the "Old Weight" is lost. A neural network needs to take the new weight and use it for the next round.

    Arthur realized he couldn't just let the formulas sit there. He needed to capture the updated values.

    He sighed, cracked his knuckles, and opened the VBA Editor (Alt + F11).

    "I didn't want to code," he grumbled, "but the grid demands it."

    He wrote a tiny macro, a script to automate the learning loop:

    Sub Train()
        Dim i As Integer
        For i = 1 To 1000
            Calculate
            Range("F2").Value = Range("NewWeight_F2").Value
            Range("F3").Value = Range("NewWeight_F3").Value
            ' ... and so on for all weights
        Next i
    End Sub
    

    He assigned the macro to a button he drew on the screen, labeling it "LEARN".