Skip to main content
Crowdfunding
Python + AI for Geeks
Practice

Output Layer

The output layer is the layer in a neural network that converts the learned results into the final output, transforming input data into the desired format (predicted values).

The structure of the output layer varies depending on the type of problem.

  • Classification Problem: Since you need to predict a specific class, neurons are arranged for each class.

  • Regression Problem: Since you need to predict a specific number, there might be only one neuron.

For instance, if you're classifying a 5×5 grayscale image into 5 classes ranging from 0 to 4, the number of neurons in the output layer would be 5.

In this case, the Softmax activation function is used in the output layer to calculate the probability of each class.

After going through Softmax, all values are between 0-1, and their total sum is 1.

The class with the highest probability becomes the final prediction of the neural network.

Below is an example of probability values transformed in the output layer.

Example of probabilities converted at the output layer
[
0.05, 0.02, 0.85, 0.03, 0.05
]

Each value represents the probability for class 0, 1, 2, 3, and 4, respectively.

The highest probability value is 0.85, indicating that the neural network classified the given grayscale image as the third number, 2, among numbers 0 through 4.

The value obtained from the output layer is utilized as the final prediction result.

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.