AI & Machine Learning

Neural Networks from Scratch

📅 December 05, 2025 ⏱️ 1 min read 👁️ 10 views 🏷️ AI & Machine Learning

Understanding neural networks by building one.

import numpy as np

def sigmoid(x):
    return 1 / (1 + np.exp(-x))

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

weights = np.random.random((2, 1))
for _ in range(10000):
    output = sigmoid(np.dot(X, weights))
    error = y - output
    weights += np.dot(X.T, error * output * (1 - output))
🏷️ Tags:
neural networks machine learning numpy ai

📚 Related Articles