Neurons and Activation Functions in Python
Build an artificial neuron in plain Python: a weighted sum of inputs plus a bias, passed through sigmoid or ReLU.
View example →Learn how neural networks, machine learning, Transformers and classical AI work with short runnable Python lessons that use no AI libraries.
Run AI Concepts in Python onlineBuild an artificial neuron in plain Python: a weighted sum of inputs plus a bias, passed through sigmoid or ReLU.
View example →Pass inputs through a small neural network layer by layer, then measure the error with squared error and cross-entropy.
View example →Train a neuron with gradient descent: use the chain rule to find how each weight affects the loss, then step downhill.
View example →Compare plain gradient descent, momentum and Adam by minimising the same function step by step.
View example →Scale features with min-max normalization and z-score standardization, and multiply matrices by hand.
View example →Fit a straight line with least squares, then turn a score into a probability with logistic regression.
View example →Turn scores into class probabilities with softmax, score them with cross-entropy and classify points with k-nearest neighbours.
View example →Measure how similar two vectors are with cosine similarity and group unlabelled data with k-means.
View example →Turn text into numbers the way language models do: build a vocabulary, one-hot encode words and learn subword tokens with BPE.
View example →Compute scaled dot-product attention by hand with queries, keys and values, then add a causal mask like GPT.
View example →See how a language model picks the next token: layer normalization, temperature and top-k sampling in plain Python.
View example →Find the shortest path on a grid with A* search and pick the best move in a game with minimax.
View example →Predict future states with a Markov chain and balance exploring and exploiting with an epsilon-greedy bandit.
View example →Teach an agent to reach a goal: compute state values with value iteration, then learn them by trial and error with Q-learning.
View example →