A Simple Deep Learning Example
Let's put the basic Deep Learning ideas together with a simple example. We will use a small student dataset and see how a neural network can learn to predict whether a student will pass an exam.
The simple idea
We give the neural network examples containing student information and the correct result. The network learns patterns from those examples and uses the learned patterns to make predictions for new students.
The Problem We Want to Solve
Suppose we want to predict whether a student will pass an exam.
We have three inputs:
The output is:
Our Training Data
We first give the neural network examples of students whose results are already known.
These examples are called training data. The model uses them to learn relationships between the inputs and the result.
Step 1 — Give the Data to the Neural Network
The student's information becomes the input to the neural network.
Step 2 — The Network Makes a Prediction
Suppose we give the network a new student:
The network processes these values and produces a prediction.
At the beginning of training, the prediction may not be correct. That is normal.
Step 3 — Compare the Prediction With the Answer
During training, we already know the student's actual result.
Example
Model prediction: Fail
Actual result: Pass
The model made a mistake, so it needs to adjust its internal parameters.
Step 4 — Calculate the Loss
The model uses a loss function to measure how far its prediction is from the correct answer.
A larger error generally produces a larger loss, while a prediction closer to the target generally produces a smaller loss.
Think of loss as a mistake score
The loss tells the model how well or poorly it performed on the current training example.
Step 5 — Update the Model
The network uses the error information to adjust its weights and other parameters.
This process allows the network to make better predictions the next time it sees similar examples.
Step 6 — Repeat the Process
The network does not learn from only one student. It repeats the process for many training examples.
After many updates, the network can learn useful relationships between student information and exam results.
Step 7 — Predict for a New Student
After training, we can give the model information about a student it has never seen before.
The important point is that the model is not simply memorizing the training examples. It is using the patterns it learned to make a prediction for new data.
Complete Example
This cycle continues across many examples and training steps until the model has learned useful patterns from the training data.
What Did the Model Learn?
The model does not store a simple rule such as "study more than 6 hours means pass."
Instead, training changes its numerical parameters so that the network can learn relationships between the different inputs.
These learned relationships are then used to produce predictions for new students.
Important
This is a simplified example. Real neural networks can contain many layers, many neurons, and millions or even billions of parameters. But the basic learning cycle remains the same: predict, measure error, update, and repeat.
Check Your Understanding
What is the input in our example?
Hours studied, attendance, and previous score.
What is the output?
Whether the student is predicted to pass or fail.
What happens when the prediction is wrong?
The model calculates the loss and uses the error
information to update its parameters.
Why do we repeat the process?
Repeated updates allow the model to gradually
learn useful patterns from the training data.