A neural network is a computer model inspired by how connected brain cells can pass signals and learn patterns. It is used in AI systems that recognize images, translate text, recommend videos, and make predictions from data. The main idea is simple: information enters through an input layer, is transformed by hidden layers, and leaves through an output layer.
Understanding these layers helps students see that AI is not magic, but a system of math, data, and repeated improvement.
Each connection in a neural network has a weight that controls how strongly one neuron affects the next neuron. A neuron combines inputs, adds a bias, and uses an activation function to decide what signal to send forward. During training, the network compares its prediction with the correct answer, calculates an error, and adjusts weights to reduce future errors.
This process connects computer science with statistics because the model learns patterns by improving predictions from many examples.
Key Facts
- A neural network usually has an input layer, one or more hidden layers, and an output layer.
- A neuron often computes z = w1x1 + w2x2 + ... + b before applying an activation function.
- Weights control the strength of connections between neurons.
- Bias shifts a neuron's output so the model can fit patterns more flexibly.
- A common error formula is mean squared error: MSE = (1/n)Σ(y - ŷ)^2.
- Training updates weights to reduce loss, often using the idea w_new = w_old - learning rate × gradient.
Vocabulary
- Input Layer
- The input layer is the first layer of a neural network where data values enter the model.
- Hidden Layer
- A hidden layer is a middle layer that transforms inputs into more useful patterns for prediction.
- Output Layer
- The output layer produces the network's final answer, such as a category, number, or probability.
- Weight
- A weight is a number on a connection that controls how much one neuron influences another neuron.
- Activation Function
- An activation function is a rule that changes a neuron's combined input into an output signal, often adding nonlinearity.
Common Mistakes to Avoid
- Thinking a neural network memorizes every answer, which is wrong because a useful model learns patterns that generalize to new examples.
- Ignoring the role of hidden layers, which is wrong because these layers transform raw inputs into features that make prediction possible.
- Assuming bigger networks are always better, which is wrong because too many neurons can overfit training data and perform poorly on new data.
- Forgetting to compare predictions with correct answers during training, which is wrong because the network needs a loss value to know how to adjust its weights.
Practice Questions
- 1 A neuron has inputs x1 = 2 and x2 = 5, weights w1 = 0.4 and w2 = -0.2, and bias b = 1. Calculate z = w1x1 + w2x2 + b.
- 2 A small network predicts 8, 10, and 6 for three examples, while the correct answers are 7, 12, and 5. Calculate the mean squared error using MSE = (1/n)Σ(y - ŷ)^2.
- 3 A student says the input layer learns the main patterns and the hidden layers only store the original data. Explain why this is incorrect and describe what hidden layers actually do.