dopetalk does not endorse any advertised product nor does it accept any liability for it's use or misuse


Our Discord Notification Server invitation link is https://discord.gg/jB2qmRrxyD

Author Topic: How Neural Networks Work  (Read 176 times)

Online Chip (OP)

  • Server Admin
  • Hero Member
  • *****
  • Administrator
  • *****
  • Join Date: Dec 2014
  • Location: Australia
  • Posts: 7148
  • Reputation Power: 0
  • Chip has hidden their reputation power
  • Gender: Male
  • Last Login:Today at 10:52:40 PM
  • Deeply Confused Learner
  • Profession: IT Engineer now retired
How Neural Networks Work
« on: May 24, 2026, 08:25:36 AM »
i=hLWXOmiPyl7AZIWr
« Last Edit: Today at 09:27:50 PM by Chip »
friendly
0
funny
0
informative
0
agree
0
disagree
0
like
0
dislike
0
No reactions
No reactions
No reactions
No reactions
No reactions
No reactions
No reactions
Our Discord Server invitation link is https://discord.gg/jB2qmRrxyD

Online Chip (OP)

  • Server Admin
  • Hero Member
  • *****
  • Administrator
  • *****
  • Join Date: Dec 2014
  • Location: Australia
  • Posts: 7148
  • Reputation Power: 0
  • Chip has hidden their reputation power
  • Gender: Male
  • Last Login:Today at 10:52:40 PM
  • Deeply Confused Learner
  • Profession: IT Engineer now retired
Re: How Neural Networks Work
« Reply #1 on: Today at 03:43:56 PM »
Me to AI:

Show me how that same network is written in about 20 lines of Python

AI:

Here’s a minimal “3Blue1Brown-style” neural network in ~20 lines of pure NumPy. It’s a tiny 2-layer network trained on the XOR problem (the classic case where a single line fails).

Code: [Select]
Python
import numpy as np

# data (XOR)
X = np.array([[0,0],[0,1],[1,0],[1,1]])
y = np.array([[0],[1],[1],[0]])

# weights
W1 = np.random.randn(2,4)
b1 = np.zeros((1,4))
W2 = np.random.randn(4,1)
b2 = np.zeros((1,1))

sigmoid = lambda x: 1/(1+np.exp(-x))

for i in range(10000):
    # forward pass
    h = sigmoid(X @ W1 + b1)
    out = sigmoid(h @ W2 + b2)

    # loss gradient
    err = out - y

    # backprop (manual chain rule)
    dW2 = h.T @ (err * out * (1 - out))
    db2 = np.sum(err * out * (1 - out), axis=0, keepdims=True)

    dh = (err * out * (1 - out)) @ W2.T
    dW1 = X.T @ (dh * h * (1 - h))
    db1 = np.sum(dh * h * (1 - h), axis=0, keepdims=True)

    # update
    W2 -= 0.1 * dW2
    b2 -= 0.1 * db2
    W1 -= 0.1 * dW1
    b1 -= 0.1 * db1

print(np.round(out))

What this is doing (in plain terms):

X → inputs (0/1 pairs)
W1, W2 → “knowledge knobs”
sigmoid → squashes values into probabilities
forward pass = “guess”
err = how wrong it is
backprop = how each weight contributed to the mistake
updates slowly push the system toward correct XOR behavior

Reality check

This is literally the core idea behind modern deep learning:
multiply → squish → measure error → nudge weights → repeat
Everything else (GPT, vision models, etc.) is just this scaled up massively.
friendly
0
funny
0
informative
0
agree
0
disagree
0
like
0
dislike
0
No reactions
No reactions
No reactions
No reactions
No reactions
No reactions
No reactions
Our Discord Server invitation link is https://discord.gg/jB2qmRrxyD

Tags:
 

Related Topics

  Subject / Started by Replies Last post
1 Replies
26121 Views
Last post April 05, 2018, 11:38:34 AM
by Mr.pooper
0 Replies
18868 Views
Last post May 04, 2018, 12:34:24 PM
by Chip
0 Replies
18836 Views
Last post May 04, 2018, 09:57:27 PM
by Chip
0 Replies
25008 Views
Last post May 14, 2018, 09:35:43 PM
by Chip
0 Replies
14870 Views
Last post November 16, 2024, 08:25:43 AM
by Chip
0 Replies
12488 Views
Last post December 14, 2024, 06:29:22 PM
by Chip
0 Replies
12080 Views
Last post December 19, 2024, 12:21:37 AM
by Chip
0 Replies
10235 Views
Last post January 11, 2025, 11:49:44 AM
by smfadmin
0 Replies
10285 Views
Last post January 15, 2025, 12:21:49 AM
by smfadmin
0 Replies
16436 Views
Last post April 06, 2025, 09:49:03 AM
by smfadmin


dopetalk does not endorse any advertised product nor does it accept any liability for it's use or misuse





TERMS AND CONDITIONS

In no event will d&u or any person involved in creating, producing, or distributing site information be liable for any direct, indirect, incidental, punitive, special or consequential damages arising out of the use of or inability to use d&u. You agree to indemnify and hold harmless d&u, its domain founders, sponsors, maintainers, server administrators, volunteers and contributors from and against all liability, claims, damages, costs and expenses, including legal fees, that arise directly or indirectly from the use of any part of the d&u site.


TO USE THIS WEBSITE YOU MUST AGREE TO THE TERMS AND CONDITIONS ABOVE


Founded December 2014
SimplePortal 2.3.6 © 2008-2014, SimplePortal