753 views
1 1 vote
Suppose we build a neural network for a 5-class classification task. Suppose for a single training example, the true label is $\left[\begin{array}{lllll}1 & 0 & 0 & 0 & 0\end{array}\right]$ while the predictions by the neural network are $[0.1 \quad 0.5\quad 0.1 \quad0 .1\quad0 .2]$. What would be the value of cross-entropy loss for this example?

1 Answer

1 1 vote
$$
\begin{aligned}
& \text { Cross entropy }=-\sum y_i \log _2 \hat{y}_i \\
& =-1 * \log _2(0.1)-0 * \log _2(0.5)-0 * \log _2(0.1)-0 * \log _2(0.1)-0 * \log _2(0.2) \\
& =-\log _2(0.1)=3.322
\end{aligned}
$$
Answer:
Position:
Show:

Related questions

1 1 vote
1 1 answer
485
485 views
GO Classes asked Oct 13, 2025
485 views
Consider a neural network with the number of neurons in different layers as mentioned in the below list for a regression task. The first layer is the input layer and the ...
0 0 votes
1 1 answer
439
439 views
GO Classes asked Oct 13, 2025
439 views
Consider a neural network with the number of neurons in different layers as mentioned in the below list for a regression task. The first layer is the input layer and the ...
0 0 votes
1 1 answer
480
480 views
GO Classes asked Oct 13, 2025
480 views
Consider a neural network with the number of neurons in different layers as mentioned in the below list for a regression task. The first layer is the input layer and the ...
1 1 vote
1 1 answer
359
359 views
GO Classes asked Oct 8, 2025
359 views
Given a linearly separable data set where the maximum Euclidean norm of any data point is $R=4$ (i.e., $\max \|x\|=4$), and the margin of separation is $\gamma=2$, what i...