Skip to content

Fix: improve Sigmoid efficiency and correct Softmax gradient computation#125

Open
PolarisMurray wants to merge 1 commit intoeriklindernoren:masterfrom
PolarisMurray:patch-1
Open

Fix: improve Sigmoid efficiency and correct Softmax gradient computation#125
PolarisMurray wants to merge 1 commit intoeriklindernoren:masterfrom
PolarisMurray:patch-1

Conversation

@PolarisMurray
Copy link
Copy Markdown

Sigmoid.gradient(): avoid redundant calls to self.call(x)
→ improves numerical stability and efficiency by computing sigmoid(x) once.
View change in code

Softmax.gradient(): replaced incorrect elementwise p*(1-p) derivative with correct Jacobian matrix form: J = diag(p) - outer(p, p) → ensures mathematically accurate gradients for multi-class outputs.
View change in code

Sigmoid.gradient(): avoid redundant calls to self.__call__(x)
  → improves numerical stability and efficiency by computing sigmoid(x) once.

Softmax.gradient(): replaced incorrect elementwise p*(1-p) derivative with correct Jacobian matrix form: J = diag(p) - outer(p, p) → ensures mathematically accurate gradients for multi-class outputs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant