DEEP LEARNING LESSON 2 NEURAL NETWORKS

Output Layer

The output layer is the final layer of a neural network. It receives the processed information from the previous layer and produces the final prediction.

In simple words

The output layer is where the neural network gives its final answer.

Where Is the Output Layer?

The output layer is always at the end of the neural network.

FIRST
Input Layer
MIDDLE
Hidden Layer
Hidden Layer
LAST
Output Layer

Information flows from the input layer, through the hidden layers, and finally reaches the output layer.

What Does the Output Layer Do?

The output layer converts the information learned by the network into a result that we can use.

Input Data
Hidden Layers
Output Layer
Final Prediction

The exact output depends on the machine learning problem.

Example 1 — Pass or Fail

Suppose we want to predict whether a student will pass an exam.

The input could contain:

Hours Studied
Attendance
Previous Score

The information moves through the network:

INPUT
Student Data
HIDDEN
Pattern Processing
OUTPUT
Pass / Fail

The output layer produces the final result for the student.

Binary Classification

Binary classification means there are two possible classes.

Examples include:

Spam
or
Not Spam
Pass
or
Fail

A common output is a value representing the probability of one of the two classes.

Output = 0.92

This could mean that the model estimates a 92% probability for the positive class, depending on how the model and labels were defined.

Important

A probability is not the same thing as absolute certainty. A value such as 0.92 means the model is highly confident according to its learned parameters, not that the prediction is guaranteed.

Multi-Class Classification

Sometimes a model needs to choose between more than two classes.

For example, suppose we want to classify an animal:

Cat
Dog
Horse

The output layer can contain multiple outputs, with each output corresponding to a class.

Class
Predicted Probability
Cat
0.10
Dog
0.85
Horse
0.05

The largest probability is for Dog, so the model's predicted class would be Dog.

Cat = 0.10
Dog = 0.85
Horse = 0.05

Regression Output

Not every neural network predicts a class. Some neural networks predict a numerical value.

For example, we might predict the price of a house.

House Features
Neural Network
$350,000

In this case, the output layer produces a numerical value instead of "Cat", "Dog", "Pass", or "Fail".

Prediction = 350000

The Output Layer Depends on the Problem

There is no single output-layer structure that works for every machine learning problem.

Problem
Example Output
Binary Classification
Spam / Not Spam
Multi-Class Classification
Cat / Dog / Horse
Regression
$350,000

The problem determines what the output should represent.

How Many Neurons Does the Output Layer Have?

The number of output neurons depends on the task.

For a simple binary classification problem, a common design uses one output neuron.

Output Layer
    ↓
    Neuron

For a three-class classification problem, a common design uses three output values.

Output Layer
    ↓
    Neuron 1 → Cat
    Neuron 2 → Dog
    Neuron 3 → Horse

For a regression problem that predicts one number, a common design uses one output value.

Output Layer
    ↓
    Neuron → House Price

Output Layer vs Hidden Layer

Layer
Main Purpose
Input Layer
Receives the input features
Hidden Layers
Process information and learn patterns
Output Layer
Produces the final prediction

Complete Example

Let's put everything together using the student example.

INPUT LAYER
Hours Studied
Attendance
Previous Score
HIDDEN LAYERS
Neurons
Neurons
Neurons
OUTPUT LAYER
Pass Probability

For example, the network might produce:

Prediction = 0.92

The application can then interpret that output according to the problem and the chosen prediction rule.

The Output Is Not Always a Word

A common beginner mistake is thinking that the output layer directly produces words such as "Cat" or "Dog".

Internally, the neural network usually produces numerical values. Those values are then interpreted according to the task.

Neural Network
Numerical Output
Interpreted Result

For example:

0.85
    ↓
Dog

Important idea

The output layer is designed according to the prediction task. Classification and regression problems can require different output structures and different ways of interpreting the output.

QUICK CHECK

Check Your Understanding

What is the output layer?
It is the final layer of a neural network that produces the model's prediction.

Does every problem use the same output layer?
No. The output structure depends on the problem being solved.

What might a regression model output?
A numerical value such as a house price.

What might a classification model output?
Values representing classes such as Cat, Dog, or Horse.

NEXT TOPIC

Neurons

Next, we will look inside the layers and understand what an individual neuron is and what it does.