218k views
0 votes
• Verify that σ' (z) = σ(z) (1 - σ(z))

• One gotcha with the cross-entropy is that it can be difficult at first to remember the respective roles of the ys and the as. It's easy to get confused about whether the right form is:
-[y 1n(a) + (1 - y) 1n(1 - a)] or -[a 1n(y) + (1 − a) 1n(1 − y)]
What happens to the second of these expressions when y = 0 or 1? Does this problem afflict the first expression? Why or why not?

1 Answer

5 votes

Final answer:

The derivative of the sigmoid function is confirmed to be σ'(z) = σ(z)(1 - σ(z)). The correct form of the cross-entropy loss function does not encounter issues when y = 0 or 1, unlike the incorrect form, which involves the undefined logarithm of zero.

Step-by-step explanation:

The function σ'(z) = σ(z)(1 - σ(z)) refers to the derivative of the sigmoid function, which is often used in the context of neural networks and logistic regression within machine learning. To verify this derivative, we must know that the sigmoid function is σ(z) = 1 / (1 + e^{-z}). Differentiating σ(z) with respect to z yields σ'(z) = σ(z)(1 - σ(z)), which confirms that the derivative is the sigmoid function multiplied by one minus the sigmoid function.

In the context of the cross-entropy loss function, the correct form is: -[y ln(a) + (1 - y) ln(1 - a)]. When y = 0 or 1, the incorrect form -[a ln(y) + (1 − a) ln(1 − y)] becomes problematic because it involves taking the logarithm of zero, which is undefined. However, the correct form does not suffer from this issue since the problematic terms become zero and are effectively eliminated from the equation.

The correct form for the cross-entropy is -[y 1n(a) + (1 - y) 1n(1 - a)]. When y = 0 or 1, the first expression remains valid, but the second expression becomes problematic. This is because when y = 0, the second expression becomes -[a 1n(0) + (1 - a) 1n(1 - 0)], which includes the term 1n(0), resulting in undefined behavior. Similarly, when y = 1, the second expression becomes -[a 1n(1) + (1 - a) 1n(1 - 1)], which again includes the term 1n(0), resulting in undefined behavior.

User Slim Shady
by
8.0k points