Skip to content

Fix SELU negative branch - #427

Open
andrewdalpino wants to merge 1 commit into
masterfrom
fix-selu-negative-branch
Open

Fix SELU negative branch#427
andrewdalpino wants to merge 1 commit into
masterfrom
fix-selu-negative-branch

Conversation

@andrewdalpino

Copy link
Copy Markdown
Member

SELU: x≤0 → BETA·(eˣ−1), so d/dx = BETA·eˣ where BETA = SCALE·ALPHA. The correct value is (output + ALPHA)·(SCALE/SCALE)... = output + BETA. The code multiplies by SCALE again and uses ALPHA, overstating the gradient. Verified: at x=-0.5 true=1.066341 vs code=1.031268; at x=-10 true=0.00008 vs code=-0.089 (even wrong sign).

@andrewdalpino
andrewdalpino requested review from a team and a lite review from Copilot August 21, 2026 01:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the SELU negative-branch derivative to use output + BETA, correcting gradient calculations.

Changes:

  • Corrected SELU derivative computation.
  • Updated derivative expectations and MLP regression coverage.
  • Documented the fix in the changelog.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/Regressors/MLPRegressorTest.php Exercises SELU in MLP coverage.
tests/NeuralNet/ActivationFunctions/SELUTest.php Updates expected derivative values.
src/NeuralNet/ActivationFunctions/SELU.php Fixes the derivative calculation.
CHANGELOG.md Documents the fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@andrewdalpino andrewdalpino added the bug Something isn't working label Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants